Skip to content
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

NullPointerException in ServletDefinition:215 #1655

Closed
kurtseebauer opened this issue Nov 14, 2022 · 1 comment
Closed

NullPointerException in ServletDefinition:215 #1655

kurtseebauer opened this issue Nov 14, 2022 · 1 comment

Comments

@kurtseebauer
Copy link
Contributor

Hi all,

in com/google/inject/servlet/ServletDefinition.java, Line 215

              pathInfo = requestUri.substring(getContextPath().length()).replaceAll("[/]{2,}", "/");

a NullPointerException is thrown when getContextPath() returns null. My understanding of the javadoc on javax.servlet.http.HttpServletRequest.getContextPath() is that it should never be null, but it happens.

In my case I'm running a dropwizard application with the elastic apm agent and graphql-java.
The elastic apm java agent calls this method at the end of an apm-transaction, with instrumentation enabled. It seems to work fine for all servlets, except the graphql one. I checked my setup/config multiple times, but cannot detect anything wrong.

Is there a chance we can introduce a null-check before calling length() on the context path?
Can I help with more info?

Thank you!

@mustafa-zidan
Copy link

👍🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants