@@ -104,7 +104,7 @@ private static List<URL> getUrlsFromClassPathOfJarManifestIfPossible(URL url) {
104
104
return Collections .<URL >emptyList ();
105
105
}
106
106
try {
107
- return getUrlsFromManifestClassPathAttribute (jarFile );
107
+ return getUrlsFromManifestClassPathAttribute (url , jarFile );
108
108
}
109
109
catch (IOException ex ) {
110
110
throw new IllegalStateException (
@@ -126,8 +126,8 @@ private static JarFile getJarFileIfPossible(URL url) {
126
126
return null ;
127
127
}
128
128
129
- private static List <URL > getUrlsFromManifestClassPathAttribute (JarFile jarFile )
130
- throws IOException {
129
+ private static List <URL > getUrlsFromManifestClassPathAttribute (URL jarUrl ,
130
+ JarFile jarFile ) throws IOException {
131
131
Manifest manifest = jarFile .getManifest ();
132
132
if (manifest == null ) {
133
133
return Collections .<URL >emptyList ();
@@ -138,17 +138,13 @@ private static List<URL> getUrlsFromManifestClassPathAttribute(JarFile jarFile)
138
138
return Collections .emptyList ();
139
139
}
140
140
String [] entries = StringUtils .delimitedListToStringArray (classPath , " " );
141
- List <URL > urls = new ArrayList <URL >(entries .length );
142
- File parent = new File (jarFile .getName ()).getParentFile ();
143
- List <File > nonExistentEntries = new ArrayList <File >();
141
+ List <URL > urls = new ArrayList <>(entries .length );
142
+ List <URL > nonExistentEntries = new ArrayList <>();
144
143
for (String entry : entries ) {
145
144
try {
146
- File referenced = new File (entry );
147
- if (!referenced .isAbsolute ()) {
148
- referenced = new File (parent , entry );
149
- }
150
- if (referenced .exists ()) {
151
- urls .add (referenced .toURI ().toURL ());
145
+ URL referenced = new URL (jarUrl , entry );
146
+ if (new File (referenced .getFile ()).exists ()) {
147
+ urls .add (referenced );
152
148
}
153
149
else {
154
150
nonExistentEntries .add (referenced );
0 commit comments