-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
PathMatchingResourcePatternResolver
returns duplicate resources when using classpath*:
prefix [SPR-16117]
#20665
Comments
Juergen Hoeller commented Looks like it's not the difference in slashes but the lower-case "c:" versus upper-case "C:" that's causing |
Juergen Hoeller commented We're upper-casing drive letter prefixes in |
Udayakumar commented Hello, Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:5.0.2.BUILD-SNAPSHOT from/to repository.spring.snapshot (http://repo.spring.io/snapshot): connect timed out Can you help. |
Udayakumar commented Found a strange thing. This issue do not exist in 4.2.5.RELEASE |
Juergen Hoeller commented The above looks like a temporary problem with the snapshot repository. Trying at a later point might work... As for this not occurring with 4.2.5, this is expect since Spring's evaluation of the "java.class.path" manifest entry only came in 4.3: #18260 |
Udayakumar commented I was able to download the artifact and install into local maven repo. I am finding it hard to test because we are using spring boot and versions are getting messed up. I am not able to use the downloaded artifact standalone. |
Juergen Hoeller commented Stéphane Nicoll, overriding the Spring Framework version underneath Boot to a snapshot should work under normal circumstances? Any advice? |
Udayakumar commented spring-framework-bom-5.0.2.BUILD-SNAPSHOT is missing |
Juergen Hoeller commented I've noticed that the last build hasn't properly completed, so would have received an outdated snapshot in any case. Maybe that's also the reason why the last published snapshot appears inconsistent. In any case, I've triggered a new build which should be ready and published in about half an hour. |
Udayakumar commented Hi Hoeller, |
Juergen Hoeller commented Good to hear, thanks for the feedback! I'll backport this to 4.3.13 tomorrow, along with a few other refinements. Both 5.0.2 and 4.3.13 are scheduled for release on November 15th, with corresponding Boot 2.0 RC1 and Boot 1.5.9 releases following soon thereafter. |
PathMatchingResourcePatternResolver
returns duplicate resources when using classpath*:
prefix [SPR-16117]
Udayakumar opened SPR-16117 and commented
I am working on a drools project. The goal is to search all the rules(*.rdrl) files in the classpath and write it into the KieFileSystem. The rules file(.rdrl) will be present under multiple jar files. These jar files were added as a dependency in the drools project.
Below is the code that is used to find all the .rdrl files.
ClassLoader classloader = this.getClass().getClassLoader();
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(classloader);
for (Resource file : resourcePatternResolver.getResources("classpath*:/**/*.rdrl")) {
System.out.println("name: " + file.getURL());
kieFileSystem.write(ResourceFactory.newUrlResource(file.getURL()));
}
Below is the sample output printed by the above code
name: jar:file:/C:/mvn_repo/com/myteam/OOP_Modular/1.0.0/OOP_Modular-1.0.0.jar!/com/myteam/oop_modular/OOP_MOD_Network_In_Network.rdrl
name: jar:file:/C:/mvn_repo/com/myteam/OOP_Modular/1.0.0/OOP_Modular-1.0.0.jar!/com/myteam/oop_modular/OOP_MOD_Individual1.rdrl
name: jar:file:c:\mvn_repo\com\myteam\OOP_Modular\1.0.0\OOP_Modular-1.0.0.jar!/com/myteam/oop_modular/OOP_MOD_Network_In_Network.rdrl
name: jar:file:c:\mvn_repo\com\myteam\OOP_Modular\1.0.0\OOP_Modular-1.0.0.jar!/com/myteam/oop_modular/OOP_MOD_Individual1.rdrl
As seen from the above output there are two entries for the same files OOP_MOD_Network_In_Network.rdrl and OOP_MOD_Individual1.rdrl. When you look at the output, the path is exactly same except that one starts with /C: and other with c:
Because of this issue, since i am trying to write each rule twice into kiefilesystem, it throws an exception saying "Duplicate rule name".
Note: When using pattern such as ("classpath*:com/**/*.rdrl"), the resources are returned only once but we are not sure if the rules file will be present only under 'com', it can also be under 'org' or anything else.
System: Windows 7, JDK 1.8
Affects: 4.3.12, 5.0.1
Issue Links:
PathMatchingResourcePatternResolver
provides duplicate resources when usingclasspath*:
prefix combined with ant-style [SPR-15989] #20539 PathMatchingResourcePatternResolver provides duplicate resources when using classpath* prefix combined with ant-styleReferenced from: commits 8904de2, a2f5e12
Backported to: 4.3.13
The text was updated successfully, but these errors were encountered: