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 UrlPathHelper #29843

Closed
mipo256 opened this issue Jan 18, 2023 · 5 comments
Closed

NullPointerException in UrlPathHelper #29843

mipo256 opened this issue Jan 18, 2023 · 5 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: invalid An issue that we don't feel is valid

Comments

@mipo256
Copy link

mipo256 commented Jan 18, 2023

During our prod monitoring in kibana, we have noticed the following logs"

                java.lang.NullPointerException: null
                at org.springframework.web.util.UrlPathHelper.getSanitizedPath(UrlPathHelper.java:355)
                at org.springframework.web.util.UrlPathHelper.decodeAndCleanUriString(UrlPathHelper.java:495)
                at org.springframework.web.util.UrlPathHelper.getOriginatingRequestUri(UrlPathHelper.java:440)
                at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.addContentDispositionHeader(AbstractMessageConverterMethodProcessor.java:423)
                at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:275)
                at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:219)
                at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
                at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)
                at org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(ExceptionHandlerExceptionResolver.java:403)
                at org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver.doResolveException(AbstractHandlerMethodExceptionResolver.java:61)
                at org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:141)
                at org.springframework.web.servlet.handler.HandlerExceptionResolverComposite.resolveException(HandlerExceptionResolverComposite.java:80)
                at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1300)
                at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1111)
                at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)
                at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
                at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
                at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
                at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:97)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at io.opentracing.contrib.web.servlet.filter.TracingFilter.doFilter(TracingFilter.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
                at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:764)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)
                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.base/java.lang.Thread.run(Thread.java:834)

we are using spring-boot-starter-web and we do not include spring-web module directly. Also we get version from our dependencyManagement in maven:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <type>pom</type>
    <version>2.3.12.RELEASE</version>
    <scope>import</scope>
</dependency>

I have researched myself the version of spring-web module that is brought by spring-boot-dependencies, and it seems to be:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>5.2.15.RELEASE</version>
    <scope>compile</scope>
</dependency>

Unfortunately, for now I cannot provide more information on this. If you need anything else, I will do my best to provide the required information. Thank you!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 18, 2023
@bclozel bclozel self-assigned this Jan 18, 2023
@bclozel
Copy link
Member

bclozel commented Jan 18, 2023

Unfortunately, this code has changed a lot since, in 0015fd6 and #27623.
Spring Framework 5.2.15 is out of OSS support and we don't plan on releasing a new version (unless a customer request comes in).

I would suggest upgrading to a supported version as soon as possible. If you can reproduce this error with a supported version, could you provide the current request URL for this log trace?

Thanks!

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 18, 2023
@mipo256
Copy link
Author

mipo256 commented Jan 18, 2023

as far as I understood you, this is already fixed in newer versions of spring-web, right?

@bclozel
Copy link
Member

bclozel commented Jan 18, 2023

@mikhail2048 I don't know that as I'm not able to reproduce the exception you've encountered. We've released a lot of versions since 5.2.15 and we didn't get any report like this so it could be that it's been fixed by various refactorings but it's impossible to know without a proper repro.

@Johnny-ZTSD
Copy link

so, how to resolve the issue now for us? @bclozel @mikhail2048

@bclozel
Copy link
Member

bclozel commented Mar 12, 2024

@Johnny-ZTSD can you reproduce this problem on a supported version? If so, please create a new issue and provide the sample application that reproduces the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants