-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
I am trying to test whether a given resource is a regular file or a directory or exists at all. My actual case is resolving node_modules. The resolver will try very hard to locate a given request by iterating over the current module parent directories, but also giving instance predefined paths a try.
Using the nio Paths API seemed strait forward and also the possibility to create a Path of an URI looked promising. It all works fine till the point of being repackaged. I created a simple test Project related to the issue demonstrating that normal jar works fine but breaks with the repacked version.
This issue is related to these issues #7096 #7110.
Executing java -jar /Users/jharth/OtherProjects/spring-boot-issues/gh-8822/build/libs/gh-8822-repack.jar
produces the following output:
Using current thread context ClassLoader:
▸org.springframework.boot.loader.LaunchedURLClassLoader
└─╴sun.misc.Launcher.AppClassLoader
└─╴sun.misc.Launcher.ExtClassLoader
Opening jar…
Files.exists(resourcePath): false
resourcePath: /BOOT-INF/classes!/test.txt
resourceUri: jar:file:/Users/jharth/OtherProjects/spring-boot-issues/gh-8822/build/libs/gh-8822-repack.jar!/BOOT-INF/classes!/test.txt
Applying workaround. Replacing '!/BOOT-INF/classes!/' with '!/BOOT-INF/classes/'.
Files.exists(resourcePath): true
resourcePath: /BOOT-INF/classes/test.txt
resourceUri: jar:file:/Users/jharth/OtherProjects/spring-boot-issues/gh-8822/build/libs/gh-8822-repack.jar!/BOOT-INF/classes/test.txt
Related pull request spring-attic/spring-boot-issues#66