Skip to content

NullPointerException in ServletDefinition:215 #1655

@kurtseebauer

Description

@kurtseebauer

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions