Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7055

NullPointerException at FileInputStreamCache.<init>(FileInputStreamCache.java:52) in connection with DataFormat.marshal

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.11.2, 2.12.2
    • 2.12.3, 2.13.0
    • camel-core
    • 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

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              forsthofer Franz Forsthofer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: