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

UseOriginalAggregationStrategy - null pointer

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.8.0
    • 4.8.2, 4.9.0
    • came-core
    • None
    • Moderate

    Description

      I found a case when NullPointerException occurs in 
      UseOriginalAggregationStrategy's aggregate method.
       
      I have this route configuration:

      .multicast(AggregationStrategies.useOriginal()).parallelProcessing()
      .to(DIRECT_ROUTE1)
      .to(DIRECT_ROUTE2) 
      

       
      and in the DIRECT_ROUTE2 there is:

       
      .doTry() 
      .unmarshal().zipFile()
      

      When the zip file is invalid there's exception handling in UseOriginalAggregationStrategy::aggregate method:
       

      exception = checkCaughtException(oldExchange, newExchange);
      if (exception != null) {
          if (original != null) {
              original.setProperty(Exchange.EXCEPTION_CAUGHT, exception);
          } else {
              oldExchange.setProperty(Exchange.EXCEPTION_CAUGHT, exception);   //NULL POINTER oldExchange is null
          }
      } 

       
      I checked javadoc about this aggregate method it says that:
      Params:
      oldExchange - the oldest exchange (is null on first aggregation as we only have the new exchange)
       
      and I think this is what happens in my case when I get NullPointerException in line 78 (oldExchange is null):
       

       } else {
            oldExchange.setProperty(Exchange.EXCEPTION_CAUGHT, exception);
      }
       

      When I create my own aggregation strategy based on UseOriginalAggregationStrategy and modify this `else` part everything works properly:
       

      } else if (oldExchange != null) {
            oldExchange.setProperty(Exchange.EXCEPTION_CAUGHT, exception);
      }
      

       
      I see that similar null check already exists in checkCaughtException method.
       
       The full stack trace can be found as attachment to this ticket.

      This error does not happen on Camel 4.4.0.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gregrzn Grzegorz Rozanski

            Dates

              Created:
              Updated:

              Slack

                Issue deployment