mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-29 22:40:26 +08:00
2004-01-06 Michael Koch <konqueror@gmx.de>
* java/lang/Package.java (getPackage): Get the current class loader directly. * java/lang/SecurityManager.java (currentLoadedClass): Dont iterate over class contexts. (classLoaderDepth): Don't check class loaders if everything is allowed. From-SVN: r75465
This commit is contained in:
parent
24746a428d
commit
907cdc7fad
@ -1,3 +1,11 @@
|
||||
2004-01-06 Michael Koch <konqueror@gmx.de>
|
||||
|
||||
* java/lang/Package.java
|
||||
(getPackage): Get the current class loader directly.
|
||||
* java/lang/SecurityManager.java
|
||||
(currentLoadedClass): Dont iterate over class contexts.
|
||||
(classLoaderDepth): Don't check class loaders if everything is allowed.
|
||||
|
||||
2004-01-05 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
|
||||
|
@ -269,8 +269,7 @@ public class Package
|
||||
public static Package getPackage(String name)
|
||||
{
|
||||
// Get the caller's classloader
|
||||
Class c = VMSecurityManager.getClassContext()[1];
|
||||
ClassLoader cl = c.getClassLoader();
|
||||
ClassLoader cl = VMSecurityManager.currentClassLoader();
|
||||
return cl != null ? cl.getPackage(name) : null;
|
||||
}
|
||||
|
||||
|
@ -207,11 +207,8 @@ public class SecurityManager
|
||||
*/
|
||||
protected Class currentLoadedClass()
|
||||
{
|
||||
Class[] c = getClassContext();
|
||||
for (int i = 0; i < c.length; i++)
|
||||
if (c[i].getClassLoader() != null)
|
||||
return c[i];
|
||||
return null;
|
||||
int i = classLoaderDepth();
|
||||
return i >= 0 ? getClassContext()[i] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -247,10 +244,18 @@ public class SecurityManager
|
||||
*/
|
||||
protected int classLoaderDepth()
|
||||
{
|
||||
Class[] c = getClassContext();
|
||||
for (int i = 0; i < c.length; i++)
|
||||
if (c[i].getClassLoader() != null)
|
||||
return i;
|
||||
try
|
||||
{
|
||||
checkPermission(new AllPermission());
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
Class[] c = getClassContext();
|
||||
for (int i = 0; i < c.length; i++)
|
||||
if (c[i].getClassLoader() != null)
|
||||
// XXX Check if c[i] is AccessController, or a system class.
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1016,6 +1021,7 @@ public class SecurityManager
|
||||
for (int index = list.indexOf(packageName);
|
||||
index != -1; index = list.indexOf(packageName, index + 1))
|
||||
{
|
||||
// Exploit package visibility for speed.
|
||||
int packageNameCount = packageName.length();
|
||||
if (index + packageNameCount == list.length()
|
||||
|| list.charAt(index + packageNameCount) == ',')
|
||||
|
Loading…
Reference in New Issue
Block a user