-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential NPE in Spring module when handling exceptions #93
Comments
Hey, Thanks for reporting the issue you are having. The expected behavior for this would be that the call to It looks like you've identified an edge case where if for some reason, the code path for I think a fix would be to have an explicit check for this case to ensure that the object returned isn't null in case if the customer has a configuration to not throw exceptions (such as So instead of Lines 54 to 57 in f893f6c
It should be } catch (Exception e) {
Segment currentSegment = AWSXRay.getCurrentSegment();
if (currentSegment != null) {
currentSegment.addException(e);
}
throw e;
} finally { Some things I wanted to ask to verify some of the assumptions above:
Thanks! |
Thanks for the response, @chanchiem. I agree with your proposed fix. From what I've gathered that would be enough. Regarding your questions:
Yes, that's the strategy we are using. There are logs mentioning the suppression of |
Are there any updates on this? |
Hey, we have this in our priority and will come out with a PR. Please stay tuned. |
…ws#93) Adds a null check prior to adding the exception to the segment.
…93) Adds a null check prior to adding the exception to the segment.
When intercepted code throws exceptions, these are added to the current segment:
aws-xray-sdk-java/aws-xray-recorder-sdk-spring/src/main/java/com/amazonaws/xray/spring/aop/AbstractXRayInterceptor.java
Lines 54 to 55 in f893f6c
However, when the segment does not exist, I'm experiencing NPEs (using v2.2.1). This seems similar to #41, which referenced the same method, but this is a different case.
The text was updated successfully, but these errors were encountered: