incubator-sanselan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kelly Boettcher <kelly.boettc...@abs.gov.au>
Subject Re: [jira] Resolved: (SANSELAN-19) JpegXMPWriter throws NullPointerException [SEC=UNCLASSIFIED]
Date Sun, 01 Mar 2009 21:31:42 GMT

Oh, der. Sorry about that, silly mistake. Thanks for pointing it out
though!



                                                                                         
                                                           
  From:       "Charles Matthew Chen (JIRA)" <jira@apache.org>                      
                                                                 
                                                                                         
                                                           
  To:         sanselan-dev@incubator.apache.org                                          
                                                           
                                                                                         
                                                           
  Date:       01/03/2009 03:02 AM                                                        
                                                           
                                                                                         
                                                           
  Subject:    [jira] Resolved: (SANSELAN-19) JpegXMPWriter throws NullPointerException   
                                                           
                                                                                         
                                                           






     [
https://issues.apache.org/jira/browse/SANSELAN-19?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Charles Matthew Chen resolved SANSELAN-19.
------------------------------------------

    Resolution: Fixed

I don't think you are initializing the variable xmpWriter in that code
snippet.  Hence the NPE?

> JpegXMPWriter throws NullPointerException
> -----------------------------------------
>
>                 Key: SANSELAN-19
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-19
>             Project: Sanselan
>          Issue Type: Bug
>         Environment: Windows XP, JDK 1.5
>            Reporter: Kelly Boettcher
>         Attachments: TestJPG.jpg
>
>
> 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)


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



------------------------------------------------------------------------------------------------
Free publications and statistics available on www.abs.gov.au


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message