Skip to content

URISyntaxException is raised if the spring boot application is started in a location that contains invalid URI characters #40615

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

Closed
FrankKlOS opened this issue May 2, 2024 · 1 comment
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@FrankKlOS
Copy link

The stack trace below is logged, if our spring boot application is started in a path that contains for example '('.
The stack we are using is: thymeleaf together with webjars+jetty

Spring-Boot version: 3.2.4

Caused by: java.io.IOError: java.net.URISyntaxException: Illegal character in path at index 29: nested:/C:/DEV-Install/testaa tst (x86)/service-manager/apps/gateway/gateway-app.jar/!BOOT-INF/lib/i18next-1.11.5.jar
 	at org.springframework.boot.loader.nio.file.NestedPath.toUri(NestedPath.java:148)
 	at jdk.zipfs/jdk.nio.zipfs.ZipPath.toUri(ZipPath.java:201)
 	at org.eclipse.jetty.util.resource.FileSystemPool.mount(FileSystemPool.java:131)
 	at org.eclipse.jetty.util.resource.ResourceFactoryInternals$CompositeResourceFactory.mountIfNeeded(ResourceFactoryInternals.java:268)
 	at org.eclipse.jetty.util.resource.ResourceFactoryInternals$CompositeResourceFactory.newResource(ResourceFactoryInternals.java:225)
 	at org.eclipse.jetty.util.resource.ResourceFactoryInternals$LifeCycle.newResource(ResourceFactoryInternals.java:171)
 	at org.eclipse.jetty.util.resource.ResourceFactory.newResource(ResourceFactory.java:370)
 	at org.eclipse.jetty.ee10.servlet.ServletContextHandler$ServletContextApi.getResourceAsStream(ServletContextHandler.java:2834)
 	at org.springframework.web.context.support.ServletContextResource.isReadable(ServletContextResource.java:120)
 	at org.springframework.web.servlet.resource.PathResourceResolver.getResource(PathResourceResolver.java:190)
 	at org.springframework.web.servlet.resource.PathResourceResolver.getResource(PathResourceResolver.java:159)
 	at org.springframework.web.servlet.resource.PathResourceResolver.resolveUrlPathInternal(PathResourceResolver.java:149)
 	at org.springframework.web.servlet.resource.AbstractResourceResolver.resolveUrlPath(AbstractResourceResolver.java:53)
 	at org.springframework.web.servlet.resource.DefaultResourceResolverChain.resolveUrlPath(DefaultResourceResolverChain.java:82)
 	at org.springframework.web.servlet.resource.WebJarsResourceResolver.resolveUrlPathInternal(WebJarsResourceResolver.java:96)
 	at org.springframework.web.servlet.resource.AbstractResourceResolver.resolveUrlPath(AbstractResourceResolver.java:53)
 	at org.springframework.web.servlet.resource.DefaultResourceResolverChain.resolveUrlPath(DefaultResourceResolverChain.java:82)
 	at org.springframework.web.servlet.resource.CachingResourceResolver.resolveUrlPathInternal(CachingResourceResolver.java:172)
 	at org.springframework.web.servlet.resource.AbstractResourceResolver.resolveUrlPath(AbstractResourceResolver.java:53)
 	at org.springframework.web.servlet.resource.DefaultResourceResolverChain.resolveUrlPath(DefaultResourceResolverChain.java:82)
 	at org.springframework.web.servlet.resource.ResourceUrlProvider.getForLookupPath(ResourceUrlProvider.java:245)
 	at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter$ResourceUrlEncodingRequestWrapper.resolveUrlPath(ResourceUrlEncodingFilter.java:126)
 	at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter$ResourceUrlEncodingResponseWrapper.encodeURL(ResourceUrlEncodingFilter.java:159)
 	at org.thymeleaf.web.servlet.JakartaServletWebExchange.transformURL(JakartaServletWebExchange.java:124)
 	at org.thymeleaf.linkbuilder.StandardLinkBuilder.processLink(StandardLinkBuilder.java:547)
 	at org.thymeleaf.linkbuilder.StandardLinkBuilder.buildLink(StandardLinkBuilder.java:138)
 	at org.thymeleaf.context.AbstractEngineContext.buildLink(AbstractEngineContext.java:167)
 	at org.thymeleaf.standard.expression.LinkExpression.executeLinkExpression(LinkExpression.java:292)
 	at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:85)
 	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109)
 	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138)
 	at org.thymeleaf.standard.processor.AbstractStandardExpressionAttributeTagProcessor.doProcess(AbstractStandardExpressionAttributeTagProcessor.java:144)
 	at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)
 	at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)
 	at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)
 	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314)
 	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205)
 	at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136)
 	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:592)
 	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103)
 	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077)
 	at org.thymeleaf.spring6.view.ThymeleafView.renderFragment(ThymeleafView.java:372)
 	at org.thymeleaf.spring6.view.ThymeleafView.render(ThymeleafView.java:192)
 	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1431)
 	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1167)
 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1106)
 	... 146 common frames omitted
 Caused by: java.net.URISyntaxException: Illegal character in path at index 29: nested:/C:/DEV-Install/testaa tst (x86)/service-manager/apps/gateway/gateway-app.jar/!BOOT-INF/lib/i18next-1.11.5.jar
 	at java.base/java.net.URI$Parser.fail(URI.java:2974)
 	at java.base/java.net.URI$Parser.checkChars(URI.java:3145)
 	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3227)
 	at java.base/java.net.URI$Parser.parse(URI.java:3175)
 	at java.base/java.net.URI.<init>(URI.java:623)
 	at org.springframework.boot.loader.nio.file.NestedPath.toUri(NestedPath.java:145)
 	... 191 common frames omitted

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 2, 2024
@philwebb philwebb added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels May 2, 2024
@philwebb philwebb self-assigned this May 2, 2024
@philwebb philwebb added this to the 3.2.x milestone May 2, 2024
@philwebb philwebb modified the milestones: 3.2.x, 3.2.6 May 2, 2024
@philwebb philwebb reopened this May 3, 2024
@philwebb
Copy link
Member

philwebb commented May 3, 2024

@mhalbritter has noticed I've got this logic wrong and we should be using !isAllowed.

philwebb added a commit that referenced this issue May 3, 2024
Fix `isAllowed` check and write test to ensure that additional object
instances are not created unnecessarily.

See gh-40615
@philwebb philwebb closed this as completed May 3, 2024
snicoll pushed a commit to snicoll/spring-boot that referenced this issue May 7, 2024
Fix `isAllowed` check and write test to ensure that additional object
instances are not created unnecessarily.

See spring-projectsgh-40615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants