Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.11.2, 2.12.2
-
None
-
Patch Available
-
Unknown
Description
Stack Trace:
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)
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.
Attachments
Attachments
Issue Links
- relates to
-
CAMEL-8134 We should not add synchronisation if the CachedOutputStream closedOnCompletion option is false
- Resolved