camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Franz Forsthofer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7055) NullPointerException at FileInputStreamCache.<init>(FileInputStreamCache.java:52) in connection with DataFormat.marshal
Date Fri, 20 Dec 2013 07:09:07 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-7055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13853745#comment-13853745
] 

Franz Forsthofer commented on CAMEL-7055:
-----------------------------------------

Hi Willem,
I am not sure if it is a good idea to generally delete the temp file when the input stream
is closed. If you have streamCache=true on the route then the inputStream can be passed from
one processor to the next and in between the input stream is reset so that it can be reused
in the next processer. The resetting creates a new FileInputStream on the temp file. 

Regards Franz

> 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.11.2, 2.12.2
>            Reporter: Franz Forsthofer
>            Assignee: Claus Ibsen
>             Fix For: 2.12.3, 2.13.0
>
>         Attachments: 0001-bug-CachedOutputStream-close.patch
>
>
> 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 DataFromat.marshal method a CachedOutputStream
instance. In the marschal method data are written 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)

Mime
View raw message