Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Java 11 forward compatibility. #519

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subprojects {
'guava': '29.0-jre',
'jackson_databind': '2.15.1',
'junit': '4.12',
'mockito': '2.5.7',
'mockito': '2.27.0',
'slf4j': '1.7.36',
'wiremock_jre': '2.35.0'
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ComplexTypeEncoder implements TypeEncoder {

private static Object createInstance(final Class<?> clazz) {
try {
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
}
catch (final Exception e) { // checkstyle-disable-line IllegalCatch
throw new MetafactureException("Can't instantiate object of class: " + clazz, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

import java.io.IOException;
import java.io.Reader;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;

/**
* Reads an XML file and passes the XML events to a receiver.
Expand All @@ -56,9 +57,12 @@ public final class XmlDecoder extends DefaultObjectPipe<Reader, XmlReceiver> {
*/
public XmlDecoder() {
try {
saxReader = XMLReaderFactory.createXMLReader();
final SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setNamespaceAware(true);

saxReader = parserFactory.newSAXParser().getXMLReader();
}
catch (final SAXException e) {
catch (final ParserConfigurationException | SAXException e) {
throw new MetafactureException(e);
}
}
Expand Down
Loading