XMPMetaParser { public static XMPMeta parse(Object input, ParseOptions options) throws XMPException { ParameterAsserts.assertNotNull(input); options = options != null ? options : new ParseOptions(); Document document = parseXml(input, options); boolean xmpmetaRequired = options.getRequireXMPMeta(); Object[] result = new Object[3]; result = findRootNode(document, xmpmetaRequired, result); if (result != null && result[1] == XMP_RDF) { XMPMetaImpl xmp = ParseRDF.parse((Node) result[0]); xmp.setPacketHeader((String) result[2]); if (!options.getOmitNormalization()) { return XMPNormalizer.process(xmp, options); } else { return xmp; } } else { return new XMPMetaImpl(); } } private  XMPMetaParser(); static XMPMeta parse(Object input, ParseOptions options);  }
@Test public void xxeTestFromString() { try { XMPMetaParser.parse(XMP_WITH_XXE, null); } catch (XMPException e) { Assert.assertEquals("Children of resource property element must be XML elements", e.getMessage()); } }
@Test public void xxeTestFromByteBuffer() { try { XMPMetaParser.parse(XMP_WITH_XXE.getBytes(), null); } catch (XMPException e) { Assert.assertEquals("Children of resource property element must be XML elements", e.getMessage()); } }
@Test public void xxeTestFromInputStream() throws IOException { InputStream inputStream = null; try { inputStream = new ByteArrayInputStream(XMP_WITH_XXE.getBytes()); XMPMetaParser.parse(inputStream, null); } catch (XMPException e) { Assert.assertEquals("Children of resource property element must be XML elements", e.getMessage()); } finally { if (inputStream != null) { inputStream.close(); } } }