diff --git a/build.gradle b/build.gradle index 43fd477ab..3974979bd 100644 --- a/build.gradle +++ b/build.gradle @@ -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' ] diff --git a/metafacture-javaintegration/src/main/java/org/metafacture/javaintegration/pojo/ComplexTypeEncoder.java b/metafacture-javaintegration/src/main/java/org/metafacture/javaintegration/pojo/ComplexTypeEncoder.java index 3d32dde72..193928dbb 100644 --- a/metafacture-javaintegration/src/main/java/org/metafacture/javaintegration/pojo/ComplexTypeEncoder.java +++ b/metafacture-javaintegration/src/main/java/org/metafacture/javaintegration/pojo/ComplexTypeEncoder.java @@ -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); diff --git a/metafacture-xml/src/main/java/org/metafacture/xml/XmlDecoder.java b/metafacture-xml/src/main/java/org/metafacture/xml/XmlDecoder.java index ff0dac5e3..1712c2771 100644 --- a/metafacture-xml/src/main/java/org/metafacture/xml/XmlDecoder.java +++ b/metafacture-xml/src/main/java/org/metafacture/xml/XmlDecoder.java @@ -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. @@ -56,9 +57,12 @@ public final class XmlDecoder extends DefaultObjectPipe { */ 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); } }