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

setUnitOfWork in DefaultExchange throws NPE when called from Splitter.java

    XMLWordPrintableJSON

Details

    • Novice

    Description

      setUnitOfWork in DefaultExchange throws NPE when called from Splitter.java,

      Line 226 of Splitter.java is: exchange.setUnitOfWork(null);

      Line 372 of DefaultExchange.java checks if onCompletions !=null, in this case because Splitter.java initialized unitOfWork to null on line 376 unitOfWork.addSynchronization(onCompletion) will throw an NPE since unitOfWork is still null.

      Recommendation:

      Line 372 of defaultExchange.java should include a check if unitOfWork is not null:

      if(onCompletions !=null && unitOfWork != null)

      Steps to reproduce:

      1. Include a Split EIP in a Camel Route.
      2. Specify an onPrepareRef=<class>
      3. Add an onCompletion step to the exchange in <class>
      4. NPE should be thrown when processing files.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            dye357 Dye357
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: