You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2010/11/19 23:00:11 UTC

Re: Issue with CXF 2.2.10 LazyDataSource


Not sure how accessing them all ahead of time like that would change anything.  
Strange.   Is there any chance you can try with 2.2.12-SNAPSHOT?   There was 
some parsing issues found as part of:
https://issues.apache.org/jira/browse/CXF-3068
that COULD cause  some strange and unpredictable behavior.   Those fixes may 
have fixed this as well.

Dan



On Friday 19 November 2010 6:53:36 am balorian wrote:
> We are using CXF version 2.2.10 in our project, where a client application
> sends a request through our service onto a 3rd party service, using MTOM
> for attachements. The problem we face is that irregularely LazyDataSource
> would throw a null pointer exception when accessing the input stream of
> the response:
> 
> Caused by: java.lang.NullPointerException
>         at
> org.apache.cxf.attachment.LazyDataSource.getInputStream(LazyDataSource.java
> :67) at
> com.sun.xml.bind.v2.runtime.unmarshaller.Base64Data.get(Base64Data.java:188
> ) at
> com.sun.xml.bind.v2.runtime.unmarshaller.Base64Data.getExact(Base64Data.jav
> a:154) at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.decodeBase64(Runt
> imeBuiltinLeafInfoImpl.java:877) at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.access$100(Runtim
> eBuiltinLeafInfoImpl.java:111) at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$14.parse(RuntimeB
> uiltinLeafInfoImpl.java:678) at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$14.parse(RuntimeB
> uiltinLeafInfoImpl.java:681) at
> com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedA
> ccessorImpl.parse(TransducedAccessor.java:243) at
> com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafProper
> tyLoader.java:61) ... 78 more
> 
> This mostly happened with smaller responses, under 2KB. After modifiying
> the LazyDataSource class for more logging, I noticed that the issue is
> resolved if the Attachements of the LazyDataSource are accessed prior to
> searching for the correct datasource in the LazyDataSource.load() method.
> Any help on the matter would be greatly appriciated. Please feel free to
> ask for further details.
> 
> Here is the modified version of the load method that no longer caused the
> issue:
> 
> private synchronized void load() {
>         if (dataSource == null) {
>             for (Attachment a : attachments) {
>                 a.getId();
>             }
> 
>             for (Attachment a : attachments) {
>                 if (a.getId().equals(id)) {
>                     this.dataSource = a.getDataHandler().getDataSource();
>                     break;
>                 }
>             }
>         }
>     }

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog