1.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Mon Nov 03 07:29:46 2014 +0100 1.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Mon Nov 03 11:47:41 2014 +0100 1.3 @@ -26,12 +26,9 @@ 1.4 package jdk.nashorn.api.scripting; 1.5 1.6 import static org.testng.Assert.fail; 1.7 - 1.8 import java.lang.reflect.InvocationHandler; 1.9 import java.lang.reflect.Method; 1.10 import java.lang.reflect.Proxy; 1.11 -import java.util.Objects; 1.12 -import javax.script.Invocable; 1.13 import javax.script.ScriptEngine; 1.14 import javax.script.ScriptEngineManager; 1.15 import javax.script.ScriptException; 1.16 @@ -40,9 +37,10 @@ 1.17 /** 1.18 * jsr223 tests for security access checks. 1.19 */ 1.20 +@SuppressWarnings("javadoc") 1.21 public class ScriptEngineSecurityTest { 1.22 1.23 - private void log(final String msg) { 1.24 + private static void log(final String msg) { 1.25 org.testng.Reporter.log(msg, true); 1.26 } 1.27 1.28 @@ -169,6 +167,7 @@ 1.29 } 1.30 1.31 // @bug 8032948: Nashorn linkages awry 1.32 + @SuppressWarnings("serial") 1.33 public static class FakeProxy extends Proxy { 1.34 public FakeProxy(final InvocationHandler ih) { 1.35 super(ih); 1.36 @@ -180,7 +179,7 @@ 1.37 } 1.38 1.39 @Test 1.40 - public void fakeProxySubclassAccessCheckTest() throws ScriptException { 1.41 + public void fakeProxySubclassAccessCheckTest() { 1.42 if (System.getSecurityManager() == null) { 1.43 // pass vacuously 1.44 return; 1.45 @@ -197,7 +196,7 @@ 1.46 1.47 // Should not be able to call static methods of Proxy via fake subclass 1.48 try { 1.49 - final Class<?> c = (Class<?>)e.eval(getClass); 1.50 + e.eval(getClass); 1.51 fail("should have thrown SecurityException"); 1.52 } catch (final Exception exp) { 1.53 if (! (exp instanceof SecurityException)) { 1.54 @@ -207,7 +206,7 @@ 1.55 } 1.56 1.57 @Test 1.58 - public void fakeProxySubclassAccessCheckTest2() throws ScriptException { 1.59 + public void fakeProxySubclassAccessCheckTest2() { 1.60 if (System.getSecurityManager() == null) { 1.61 // pass vacuously 1.62 return; 1.63 @@ -224,7 +223,7 @@ 1.64 1.65 // Should not be able to call static methods of Proxy via fake subclass 1.66 try { 1.67 - final Class<?> c = (Class<?>)e.eval(getClass); 1.68 + e.eval(getClass); 1.69 fail("should have thrown SecurityException"); 1.70 } catch (final Exception exp) { 1.71 if (! (exp instanceof SecurityException)) { 1.72 @@ -234,7 +233,7 @@ 1.73 } 1.74 1.75 @Test 1.76 - public static void proxyStaticAccessCheckTest() throws ScriptException { 1.77 + public static void proxyStaticAccessCheckTest() { 1.78 if (System.getSecurityManager() == null) { 1.79 // pass vacuously 1.80 return; 1.81 @@ -247,7 +246,7 @@ 1.82 new Class[] { Runnable.class }, 1.83 new InvocationHandler() { 1.84 @Override 1.85 - public Object invoke(final Object p, final Method m, final Object[] a) { 1.86 + public Object invoke(final Object p, final Method mtd, final Object[] a) { 1.87 return null; 1.88 } 1.89 }); 1.90 @@ -284,7 +283,9 @@ 1.91 } 1.92 }); 1.93 fail("SecurityException should have been thrown"); 1.94 - } catch (final SecurityException exp) {} 1.95 + } catch (final SecurityException e) { 1.96 + //empty 1.97 + } 1.98 } 1.99 1.100 @Test 1.101 @@ -303,6 +304,8 @@ 1.102 } 1.103 }); 1.104 fail("SecurityException should have been thrown"); 1.105 - } catch (final SecurityException exp) {} 1.106 + } catch (final SecurityException e) { 1.107 + //empty 1.108 + } 1.109 } 1.110 }