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

ZipkinServerResponseAdapter#onResponse possible NullPointerException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.10.0
    • Fix Version/s: 3.11.0
    • Component/s: camel-zipkin
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      ZipkinServerResponseAdapter#onResponse possible NullPointerException

      ISSUE:

       

      if (exchange.getException() != null) { 
        String message = exchange.getException().getMessage();
        span.tag("camel.server.exchange.failure", message); 
      }
      

      span is instance of SpanCustomizer.
      SpanCustomizer has method:

       

      // Params: key – Name used to lookup spans, such as "your_app.version". 
      //         value – String value, cannot be null.
      SpanCustomizer tag(String key, String value);
      

       

      SpanCustomizer#tag second parameter cannot be null. 

      exchange.getException() is instance of Throwable
      Throwable#getMethod documentation:

      //Returns the detail message string of this throwable. 
      //Returns: the detail message string of this Throwable instance (which may be null).
      public String getMessage() { return detailMessage; }
      

      Throwable.getMessage() may be null

      FIX:
      Second null check of getMessage method should fix this bug

      if (exchange.getException() != null && exchange.getException().getMessage() != null) { 
        String message = exchange.getException().getMessage();
        span.tag("camel.server.exchange.failure", message); 
      }
      

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              p8z Pavol Zabka
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: