1--- a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java 2+++ b/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java 3@@ -4,9 +4,6 @@ 4 5 package org.mozilla.javascript; 6 7-import java.lang.reflect.Method; 8-import java.lang.reflect.InvocationTargetException; 9- 10 /** 11 * Load generated classes. 12 * 13@@ -27,19 +24,16 @@ 14 15 private void init() { 16 this.contextLoader = null; 17- if (method_getContextClassLoader != null) { 18- try { 19- this.contextLoader = (ClassLoader) 20- method_getContextClassLoader.invoke( 21- Thread.currentThread(), 22- ScriptRuntime.emptyArgs); 23- } catch (IllegalAccessException ex) { 24- } catch (InvocationTargetException ex) { 25- } catch (SecurityException ex) { 26- } 27- if (this.contextLoader == this.parentLoader) { 28- this.contextLoader = null; 29- } 30+ try { 31+ this.contextLoader = Thread.currentThread().getContextClassLoader(); 32+ } catch (SecurityException ex) { 33+ /* Context class loader access denied in restricted 34+ environments (e.g. applets, sandboxed class loaders). 35+ Fall back to the parent class loader only. */ 36+ this.contextLoader = null; 37+ } 38+ if (this.contextLoader == this.parentLoader) { 39+ this.contextLoader = null; 40 } 41 } 42 43@@ -90,23 +84,4 @@ 44 private final ClassLoader parentLoader; 45 46 private ClassLoader contextLoader; 47- 48- // We'd like to use "Thread.getContextClassLoader", but 49- // that's only available on Java2. 50- private static Method method_getContextClassLoader; 51- 52- static { 53- try { 54- // Don't use "Thread.class": that performs the lookup 55- // in the class initializer, which doesn't allow us to 56- // catch possible security exceptions. 57- Class threadClass = Class.forName("java.lang.Thread"); 58- method_getContextClassLoader = 59- threadClass.getDeclaredMethod("getContextClassLoader", 60- new Class[0]); 61- } catch (ClassNotFoundException e) { 62- } catch (NoSuchMethodException e) { 63- } catch (SecurityException e) { 64- } 65- } 66 } 67