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

ZipkinServerResponseAdapter#onResponse possible NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.10.0
    • 3.11.0
    • camel-zipkin
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: