Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1866

NPE in HttpServletRequest#getHttpServletMapping()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.2.6.Final
    • 2.2.2.Final
    • Servlet
    • None
    • Hide

      used inside Wildfly 21.0.2.Final outline structure:

       

      EAR:
      	application.xml:
      		module/web/ <context-root>/manager</context-root>
      WAR:
      	web.xml:
      		this exists (nothing notable configured inside)
      	jboss-web.xml:
      		<context-root>/manager</context-root>
      		<virtual-host>default-host</virtual-host>
      	Servlet registered at WAR deployment startup with:
      		ServletRegistration.Dynamic#addMappings(String[] { "/", "/*", "" })
      
      Access to servlet invoked from browser results:
      		
      Successful usage:
      	http://localhost:8080/manager/index.html  (HTTP/200 that is expected)
      	http://localhost:8080/manager/  (HTTP/200 that is expected)
      
      The bug being reported here:
      	http://localhost:8080/manager  (NPE from HttpServletRequestImpl.getHttpServletMapping(HttpServletRequestImpl.java:253))
      
      NOTE the lack of trailing slash in the path
      
      
      
      The servlet code calls:
      	HttpServletRequest#getHttpServletMapping()
      I hope this is enough information to assist.
      
      
      

       

       https://github.com/undertow-io/undertow/blob/2.2.2.Final/servlet/src/main/java/io/undertow/servlet/handlers/ServletPathMatch.java
      There is plenty of code here that will set this.remaining=null or take any value from caller

       

      Show
      used inside Wildfly 21.0.2.Final outline structure:   EAR: application.xml: module/web/ <context-root>/manager</context-root> WAR: web.xml: this exists (nothing notable configured inside) jboss-web.xml: <context-root>/manager</context-root> <virtual-host>default-host</virtual-host> Servlet registered at WAR deployment startup with: ServletRegistration.Dynamic#addMappings(String[] { "/", "/*", "" }) Access to servlet invoked from browser results: Successful usage: http://localhost:8080/manager/index.html (HTTP/200 that is expected) http://localhost:8080/manager/ (HTTP/200 that is expected) The bug being reported here: http://localhost:8080/manager (NPE from HttpServletRequestImpl.getHttpServletMapping(HttpServletRequestImpl.java:253)) NOTE the lack of trailing slash in the path The servlet code calls: HttpServletRequest#getHttpServletMapping() I hope this is enough information to assist.     https://github.com/undertow-io/undertow/blob/2.2.2.Final/servlet/src/main/java/io/undertow/servlet/handlers/ServletPathMatch.java There is plenty of code here that will set this.remaining=null or take any value from caller  
    • Undefined

      Caused by: java.lang.NullPointerException
      at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.spec.HttpServletRequestImpl.getHttpServletMapping(HttpServletRequestImpl.java:253)
      at javax.servlet.api@2.0.0.Final//javax.servlet.http.HttpServletRequestWrapper.getHttpServletMapping(HttpServletRequestWrapper.java:117)
      at

       

      https://github.com/undertow-io/undertow/blob/2.2.2.Final/servlet/src/main/java/io/undertow/servlet/spec/HttpServletRequestImpl.java#L253

       

              rhn-cservice-bbaranow Bartosz Baranowski
              darryl.miles@dlmc.co.uk Darryl Miles (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: