Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Windows XP, JDK 1.5
Description
I am try to use the JpegXMPWriter to write xmp values from a Jpeg file. Using JpegImageParser, I can retrieve existing xmp values out the file fine. However, attempting to write back into the file produces an exception.
byte[] b = null;
String existingXMP = null;
String newXMP = null;
XMPMeta meta = null;
Document licenseDoc = null;
JpegImageParser parser = null;
JpegXmpRewriter xmpWriter = null;
ByteArrayOutputStream baos = null;
b = new byte[is.available()]; // is is a jpeg input stream passed into the function.
is.read(b);
is.close();
parser = new JpegImageParser();
ByteSourceArray bs = new ByteSourceArray(b);
existingXMP = parser.getXmpXml(bs, null); // works fine, passes back valid xmp from the file
/* I did have other functionality here to manipulate the xmp which
works fine, but I also ran the test without changing the xmp,
with the same resulting exception. */
baos = new ByteArrayOutputStream();
xmpWriter.updateXmpXml(bs, baos, existingXMP); // NullPointerException occurs here.
b = baos.toByteArray();
is = new ByteArrayInputStream(b);
return is;
Exception produced:
java.lang.NullPointerException
at au.gov.abs.manager.injector.jpeg.JPEGXMPInjector.doLicenseInsertionSan(JPEGXMPInjector.java:230)
at au.gov.abs.manager.injector.jpeg.JPEGXMPInjector.doLicenseInsertionSan(JPEGXMPInjector.java:170)
at au.gov.abs.manager.test.TestJPEGXMPInjector.testDoLicenseInsertionSan(TestJPEGXMPInjector.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)