cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From balorian <balor...@gmail.com>
Subject Issue with CXF 2.2.10 LazyDataSource
Date Fri, 19 Nov 2010 11:53:36 GMT

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.java:154)
        at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.decodeBase64(RuntimeBuiltinLeafInfoImpl.java:877)
        at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.access$100(RuntimeBuiltinLeafInfoImpl.java:111)
        at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$14.parse(RuntimeBuiltinLeafInfoImpl.java:678)
        at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$14.parse(RuntimeBuiltinLeafInfoImpl.java:681)
        at
com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:243)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.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;
                }
            }
        }
    }
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Issue-with-CXF-2-2-10-LazyDataSource-tp3272196p3272196.html
Sent from the cxf-issues mailing list archive at Nabble.com.

Mime
View raw message