You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/03/04 07:11:40 UTC

[GitHub] [skywalking] zifeihan edited a comment on issue #6481: NullPointerException when using KafkaProducer.send(record)

zifeihan edited a comment on issue #6481:
URL: https://github.com/apache/skywalking/issues/6481#issuecomment-790377757


   > And I think that we should add a null check for `ContextManager.activeSpan()` in `CallbackInterceptor.handleMethodException`:
   
   Sorry this is my hand error. 
   
   
   > ```
   > @Override
   > public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
   >     Class<?>[] argumentsTypes, Throwable t) {
   >     ContextManager.activeSpan().log(t);
   > }
   > ```
   
   How about using this judgment,
   ```
       public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
           Class<?>[] argumentsTypes, Throwable t) {
           CallbackCache cache = (CallbackCache) objInst.getSkyWalkingDynamicField();
           if (null != cache) {
               ContextManager.activeSpan().log(t);
           }
       }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org