42 |
import gnu.classpath.SystemProperties; |
import gnu.classpath.SystemProperties; |
43 |
|
|
44 |
import java.io.File; |
import java.io.File; |
45 |
|
import java.io.IOException; |
46 |
import java.net.MalformedURLException; |
import java.net.MalformedURLException; |
47 |
import java.net.URL; |
import java.net.URL; |
48 |
import java.security.ProtectionDomain; |
import java.security.ProtectionDomain; |
49 |
import java.util.Enumeration; |
import java.util.Enumeration; |
|
import java.util.Map; |
|
50 |
import java.util.HashMap; |
import java.util.HashMap; |
51 |
|
import java.util.Map; |
52 |
import java.util.StringTokenizer; |
import java.util.StringTokenizer; |
53 |
import java.util.Vector; |
import java.util.Vector; |
54 |
|
import java.util.zip.ZipFile; |
55 |
|
|
56 |
/** |
/** |
57 |
* java.lang.VMClassLoader is a package-private helper for VMs to implement |
* java.lang.VMClassLoader is a package-private helper for VMs to implement |
166 |
Vector v = new Vector(); |
Vector v = new Vector(); |
167 |
while (st.hasMoreTokens()) |
while (st.hasMoreTokens()) |
168 |
{ |
{ |
169 |
File file = new File(st.nextToken(), name); |
File file = new File(st.nextToken()); |
170 |
if (!file.exists()) |
if (file.isDirectory()) |
|
continue; |
|
|
try |
|
171 |
{ |
{ |
172 |
v.add(new URL("file://" + file.getAbsolutePath())); |
try |
173 |
|
{ |
174 |
|
v.add(new URL("file://" |
175 |
|
+ new File(file, name).getAbsolutePath())); |
176 |
|
} |
177 |
|
catch (MalformedURLException e) |
178 |
|
{ |
179 |
|
throw new Error(e); |
180 |
|
} |
181 |
} |
} |
182 |
catch (MalformedURLException e) |
else if (file.isFile()) |
183 |
{ |
{ |
184 |
throw new Error(e); |
ZipFile zip; |
185 |
|
try |
186 |
|
{ |
187 |
|
zip = new ZipFile(file); |
188 |
|
} |
189 |
|
catch (IOException e) |
190 |
|
{ |
191 |
|
continue; |
192 |
|
} |
193 |
|
String zname = name.startsWith("/") ? name.substring(1) : name; |
194 |
|
try |
195 |
|
{ |
196 |
|
if (zip.getEntry(zname) == null) |
197 |
|
continue; |
198 |
|
} |
199 |
|
finally |
200 |
|
{ |
201 |
|
try |
202 |
|
{ |
203 |
|
zip.close(); |
204 |
|
} |
205 |
|
catch (IOException e) |
206 |
|
{ |
207 |
|
} |
208 |
|
} |
209 |
|
try |
210 |
|
{ |
211 |
|
v.add(new URL("jar:file://" |
212 |
|
+ file.getAbsolutePath() + "!/" + zname)); |
213 |
|
} |
214 |
|
catch (MalformedURLException e) |
215 |
|
{ |
216 |
|
throw new Error(e); |
217 |
|
} |
218 |
} |
} |
219 |
} |
} |
220 |
return v.elements(); |
return v.elements(); |