/hg/icedtea-web: Minor code formatting & cosmetic changes

adomurad at icedtea.classpath.org adomurad at icedtea.classpath.org
Fri Jan 4 09:32:23 PST 2013


changeset e335e39c382b in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=e335e39c382b
author: Adam Domurad <adomurad at redhat.com>
date: Fri Jan 04 12:32:15 2013 -0500

	Minor code formatting & cosmetic changes


diffstat:

 ChangeLog                                                                     |  11 +
 plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java             |  14 +-
 plugin/icedteanp/java/sun/applet/PluginAppletViewer.java                      |  10 +-
 tests/reproducers/simple/JSObjectFromEval/srcs/JSObjectFromEval.java          |   2 -
 tests/reproducers/simple/JSObjectFromEval/testcases/JSObjectFromEvalTest.java |  59 ++++-----
 5 files changed, 54 insertions(+), 42 deletions(-)

diffs (186 lines):

diff -r b758667cc17c -r e335e39c382b ChangeLog
--- a/ChangeLog	Thu Jan 03 13:17:37 2013 -0500
+++ b/ChangeLog	Fri Jan 04 12:32:15 2013 -0500
@@ -1,3 +1,14 @@
+2013-01-04  Adam Domurad  <adomurad at redhat.com>
+
+	* plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java:
+	Code-formatting fixes and cosmetic changes.
+	* plugin/icedteanp/java/sun/applet/PluginAppletViewer.java:
+	Same.
+	* tests/reproducers/simple/JSObjectFromEval/srcs/JSObjectFromEval.java:
+	Same.
+	* tests/reproducers/simple/JSObjectFromEval/testcases/JSObjectFromEvalTest.java:
+	Same.
+
 2013-01-03  Adam Domurad  <adomurad at redhat.com>
 
 	Fix breakage in unit test CodeBaseClassLoaderTest.testParentClassLoaderIsAskedForClassesApplication
diff -r b758667cc17c -r e335e39c382b plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
--- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java	Thu Jan 03 13:17:37 2013 -0500
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java	Fri Jan 04 12:32:15 2013 -0500
@@ -53,13 +53,16 @@
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
+import net.sourceforge.jnlp.DefaultLaunchHandler;
 import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.DefaultLaunchHandler;
+import netscape.javascript.JSObject;
 import netscape.javascript.JSObjectCreatePermission;
+import netscape.javascript.JSUtil;
 
 class Signature {
     private String signature;
@@ -489,9 +492,7 @@
                 final Object fValue = MethodOverloadResolver.getCostAndCastedObject(value, f.getType())[1];
 
                 AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-                checkPermission(src,
-                                                message.startsWith("SetStaticField") ? (Class) o : o.getClass(),
-                                                acc);
+                checkPermission(src, message.startsWith("SetStaticField") ? (Class) o : o.getClass(), acc);
 
                 Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
                     public Object run() {
@@ -514,8 +515,9 @@
                 Integer arrayID = parseCall(args[1], null, Integer.class);
                 Integer index = parseCall(args[2], null, Integer.class);
 
-                Object ret = Array.get(store.getObject(arrayID), index);
-                Class retClass = store.getObject(arrayID).getClass().getComponentType(); // prevent auto-boxing influence
+                Object array = store.getObject(arrayID);
+                Object ret = Array.get(array, index);
+                Class<?> retClass = array.getClass().getComponentType(); // prevent auto-boxing influence
 
                 if (ret == null) {
                     write(reference, "GetObjectArrayElement literalreturn null");
diff -r b758667cc17c -r e335e39c382b plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Thu Jan 03 13:17:37 2013 -0500
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Fri Jan 04 12:32:15 2013 -0500
@@ -1014,9 +1014,10 @@
     }
 
     public static void setMember(long internal, String name, Object value) {
-        System.err.println("Setting to class " + value.getClass() + ":" + value.getClass().isPrimitive());
-        AppletSecurityContextManager.getSecurityContext(0).store(name);
-        int nameID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(name);
+        PluginDebug.debug("Setting to class " + value.getClass() + ":" + value.getClass().isPrimitive());
+        PluginAppletSecurityContext securityContext = AppletSecurityContextManager.getSecurityContext(0);
+        securityContext.store(name);
+        int nameID = securityContext.getIdentifier(name);
         Long reference = getRequestIdentifier();
 
         // work on a copy of value, as we don't want to be manipulating
@@ -1072,7 +1073,8 @@
 
     // FIXME: handle long index as well.
     public static void setSlot(long internal, int index, Object value) {
-        AppletSecurityContextManager.getSecurityContext(0).store(value);
+        PluginAppletSecurityContext securityContext = AppletSecurityContextManager.getSecurityContext(0);
+        securityContext.store(value);
         Long reference = getRequestIdentifier();
 
         // work on a copy of value, as we don't want to be manipulating
diff -r b758667cc17c -r e335e39c382b tests/reproducers/simple/JSObjectFromEval/srcs/JSObjectFromEval.java
--- a/tests/reproducers/simple/JSObjectFromEval/srcs/JSObjectFromEval.java	Thu Jan 03 13:17:37 2013 -0500
+++ b/tests/reproducers/simple/JSObjectFromEval/srcs/JSObjectFromEval.java	Fri Jan 04 12:32:15 2013 -0500
@@ -55,8 +55,6 @@
 	}
 
 	public void setJSMember(JSObject js, String memb, Object val) {
-		String typeName = val.getClass().getName();
-		System.out.println("setJSMember: passed '" + typeName + "'");
 		js.setMember(memb, val);
 	}
 }
\ No newline at end of file
diff -r b758667cc17c -r e335e39c382b tests/reproducers/simple/JSObjectFromEval/testcases/JSObjectFromEvalTest.java
--- a/tests/reproducers/simple/JSObjectFromEval/testcases/JSObjectFromEvalTest.java	Thu Jan 03 13:17:37 2013 -0500
+++ b/tests/reproducers/simple/JSObjectFromEval/testcases/JSObjectFromEvalTest.java	Fri Jan 04 12:32:15 2013 -0500
@@ -37,10 +37,11 @@
 
 import static org.junit.Assert.assertTrue;
 
+import net.sourceforge.jnlp.annotations.KnownToFail;
+
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess.AutoClose;
 import net.sourceforge.jnlp.annotations.Bug;
-import net.sourceforge.jnlp.annotations.KnownToFail;
 import net.sourceforge.jnlp.annotations.NeedsDisplay;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
 import net.sourceforge.jnlp.browsertesting.BrowserTest;
@@ -51,40 +52,38 @@
 
 public class JSObjectFromEvalTest extends BrowserTest {
 
-	private static final String END_STRING = AutoOkClosingListener.MAGICAL_OK_CLOSING_STRING;
+    private static final String END_STRING = AutoOkClosingListener.MAGICAL_OK_CLOSING_STRING;
 
-	private static final String JAVA_CREATE = "Java create\n";
-	private static final String JS_CREATE = "JS create\n";
-	private static final String JAVA_SET = "Java set\n";
-	private static final String PASSED_INTEGER = "setJSMember: passed 'java.lang.Integer'\n";
-	private static final String CORRECT_VALUE = "obj.test = 0";
+    private static final String JAVA_CREATE = "Java create\n";
+    private static final String JS_CREATE = "JS create\n";
+    private static final String JAVA_SET = "Java set\n";
+    private static final String CORRECT_VALUE = "obj.test = 0";
 
-	@Test
-	@TestInBrowsers(testIn = { Browsers.all })
-	@NeedsDisplay
-	@Bug(id = { "PR1198" })
-	@KnownToFail
-	public void testJSObjectSetMemberIsSet() throws Exception {
-		ProcessResult pr = server.executeBrowser("/JSObjectFromEval.html",
-				AutoClose.CLOSE_ON_BOTH);
+    @Test
+    @TestInBrowsers(testIn = { Browsers.all })
+    @NeedsDisplay
+    @KnownToFail
+    @Bug(id = { "PR1198" })
+    public void testJSObjectSetMemberIsSet() throws Exception {
+        ProcessResult pr = server.executeBrowser("/JSObjectFromEval.html",
+                AutoClose.CLOSE_ON_BOTH);
 
-		String expectedJSCreateOutput = JS_CREATE + JAVA_SET + PASSED_INTEGER
-				+ CORRECT_VALUE;
-		String expectedJavaCreateOutput = JAVA_CREATE + JAVA_SET
-				+ PASSED_INTEGER + CORRECT_VALUE;
+        String expectedJSCreateOutput = JS_CREATE + JAVA_SET + CORRECT_VALUE;
+        String expectedJavaCreateOutput = JAVA_CREATE + JAVA_SET
+                + CORRECT_VALUE;
 
-		// No reason JS create should fail, this is mostly a sanity check:
-		assertTrue("stdout should contain 'JS create [...] " + CORRECT_VALUE
-				+ "' but did not.", pr.stdout.contains(expectedJSCreateOutput));
+        // No reason JS create should fail, this is mostly a sanity check:
+        assertTrue("stdout should contain 'JS create [...] " + CORRECT_VALUE
+                + "' but did not.", pr.stdout.contains(expectedJSCreateOutput));
 
-		// Demonstrates PR1198:
-		assertTrue("stdout should contain 'Java create [...] " + CORRECT_VALUE
-				+ "' but did not.",
-				pr.stdout.contains(expectedJavaCreateOutput));
+        // Demonstrates PR1198:
+        assertTrue("stdout should contain 'Java create [...] " + CORRECT_VALUE
+                + "' but did not.",
+                pr.stdout.contains(expectedJavaCreateOutput));
 
-		// Make sure we got to the end of the script
-		assertTrue("stdout should contain '" + END_STRING + "' but did not.",
-				pr.stdout.contains(END_STRING));
-	}
+        // Make sure we got to the end of the script
+        assertTrue("stdout should contain '" + END_STRING + "' but did not.",
+                pr.stdout.contains(END_STRING));
+    }
 
 }



More information about the distro-pkg-dev mailing list