Franz Forsthofer created CAMEL-7055:
---------------------------------------

             Summary: NullPointerException at 
FileInputStreamCache.<init>(FileInputStreamCache.java:52) in connection with 
DataFormat.marshal
                 Key: CAMEL-7055
                 URL: https://issues.apache.org/jira/browse/CAMEL-7055
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.12.2
            Reporter: Franz Forsthofer
            Priority: Critical
             Fix For: 2.12.3


Stack Trace:
{code}
Caused by: java.lang.NullPointerException
        at 
org.apache.camel.converter.stream.FileInputStreamCache.<init>(FileInputStreamCache.java:52)
        at 
org.apache.camel.converter.stream.CachedOutputStream.newStreamCache(CachedOutputStream.java:199)
        at 
org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:79)
{code}

Error occurs, if streamCache is true and the stream is put into the file system 
because the spool threashold is reached. 

The following is happening:
The Marshall Processor handels over to the DataFroamat.marshal method a 
CachedOutputStream instance. In the marschal method data are writtin into the 
output stream, when the spool threshold is reached the data are streamed into 
the file system. Finally the output stream is closed and the CachedOutputStream 
instance deletes the cached file during closing. The next processor tries to 
read the FileInputStreamCache and gets the NullPointerException.

Currently this problem can occur in the following DataFormat classes (because 
they close the stream, which is actually correct):

GzipDataFormat
CryptoDataFormat
PGPDataFormat
SerializationDataFormat
XMLSecurityDataFormat
ZipDataFormat

My proposal is not to delete the cached file during closing the output stream. 
The cached file shall only be closed on the onCompletion event of the route. 
See attached patch.






--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to