37 |
|
|
38 |
package java.lang; |
package java.lang; |
39 |
|
|
|
import gnu.classpath.VMStackWalker; |
|
|
|
|
40 |
import java.net.URL; |
import java.net.URL; |
41 |
import java.util.NoSuchElementException; |
import java.util.NoSuchElementException; |
42 |
import java.util.StringTokenizer; |
import java.util.StringTokenizer; |
273 |
public static Package getPackage(String name) |
public static Package getPackage(String name) |
274 |
{ |
{ |
275 |
// Get the caller's classloader |
// Get the caller's classloader |
276 |
ClassLoader cl = VMStackWalker.getCallingClassLoader(); |
ClassLoader cl = VMSecurityManager.currentClassLoader(); |
277 |
return cl != null ? cl.getPackage(name) : null; |
return cl != null ? cl.getPackage(name) : null; |
278 |
} |
} |
279 |
|
|
286 |
public static Package[] getPackages() |
public static Package[] getPackages() |
287 |
{ |
{ |
288 |
// Get the caller's classloader |
// Get the caller's classloader |
289 |
ClassLoader cl = VMStackWalker.getCallingClassLoader(); |
Class c = VMSecurityManager.getClassContext()[1]; |
290 |
|
ClassLoader cl = c.getClassLoader(); |
291 |
// Sun's implementation returns the packages loaded by the bootstrap |
// Sun's implementation returns the packages loaded by the bootstrap |
292 |
// classloader if cl is null, but right now our bootstrap classloader |
// classloader if cl is null, but right now our bootstrap classloader |
293 |
// does not create any Packages. |
// does not create any Packages. |