/hg/icedtea-web: Use Arrays.asList instead of custom implementation

omajid at icedtea.classpath.org omajid at icedtea.classpath.org
Mon Sep 16 09:37:24 PDT 2013


changeset f544f5b40bb7 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=f544f5b40bb7
author: Omair Majid <omajid at redhat.com>
date: Mon Sep 16 12:35:20 2013 -0400

	Use Arrays.asList instead of custom implementation

	2013-09-16  Omair Majid  <omajid at redhat.com>

	    * tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java
	    (toList): Remove.
	    (checkForMainFileLeakTest): Use Arrays.asList.
	    * tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
	    (toList): Remove.
	    (testToRelativePaths): Use Arrays.asList.


diffstat:

 ChangeLog                                                                                                     |   9 +++
 tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java                                         |  11 +---
 tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java |  27 +++------
 3 files changed, 21 insertions(+), 26 deletions(-)

diffs (102 lines):

diff -r 838dea89725a -r f544f5b40bb7 ChangeLog
--- a/ChangeLog	Mon Sep 16 10:39:33 2013 +0200
+++ b/ChangeLog	Mon Sep 16 12:35:20 2013 -0400
@@ -1,3 +1,12 @@
+2013-09-16  Omair Majid  <omajid at redhat.com>
+
+	* tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java
+	(toList): Remove.
+	(checkForMainFileLeakTest): Use Arrays.asList.
+	* tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
+	(toList): Remove.
+	(testToRelativePaths): Use Arrays.asList.
+
 2013-09-16  Jiri Vanek  <jvanek at redhat.com>
 
 	* Makefile.am: returned modified (EXTRA_DIST) variable. It is enriched  for
diff -r 838dea89725a -r f544f5b40bb7 tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java	Mon Sep 16 10:39:33 2013 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java	Mon Sep 16 12:35:20 2013 -0400
@@ -43,6 +43,7 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
@@ -131,14 +132,6 @@
         }
     }
 
-    static private <T> List<T> toList(T ... parts) {
-        List<T> list = new ArrayList<T>();
-        for (T part : parts) {
-            list.add(part);
-        }
-        return list;
-    }
-
     /* Note: Although it does a basic check, this mainly checks for file-descriptor leak */
     @Test
     public void checkForMainFileLeakTest() throws Exception {
@@ -152,7 +145,7 @@
             @Override
             public void run() {
                 try {
-                    classLoader.checkForMain(toList(jnlpFile.jarDesc));
+                    classLoader.checkForMain(Arrays.asList(jnlpFile.jarDesc));
                 } catch (LaunchException e) {
                     fail(e.toString());
                 }
diff -r 838dea89725a -r f544f5b40bb7 tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java	Mon Sep 16 10:39:33 2013 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java	Mon Sep 16 12:35:20 2013 -0400
@@ -4,36 +4,29 @@
 
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.junit.Test;
 
 public class UnsignedAppletTrustConfirmationTest {
 
-    private List<String> toList(String ... parts) {
-        List<String> list = new ArrayList<String>();
-        for (String part : parts) {
-            list.add(part);
-        }
-        return list;
-    }
-
     @Test
     public void testToRelativePaths() throws Exception {
         /* Absolute -> Relative */
-        assertEquals(toList("test.jar"), 
-                UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example.com/test.jar"), "http://example.com/"));
+        assertEquals(Arrays.asList("test.jar"),
+                UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("http://example.com/test.jar"), "http://example.com/"));
 
         /* Relative is unchanged */
-        assertEquals(toList("test.jar"), 
-                UnsignedAppletTrustConfirmation.toRelativePaths(toList("test.jar"), "http://example.com/"));
+        assertEquals(Arrays.asList("test.jar"),
+                UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("test.jar"), "http://example.com/"));
 
         /* Different root URL is unchanged */
-        assertEquals(toList("http://example2.com/test.jar"), 
-                UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example2.com/test.jar"), "http://example.com/"));
+        assertEquals(Arrays.asList("http://example2.com/test.jar"),
+                UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("http://example2.com/test.jar"), "http://example.com/"));
 
         /* Path with invalid URL characters is handled */
-        assertEquals(toList("test .jar"), 
-                UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example.com/test .jar"), "http://example.com/"));
+        assertEquals(Arrays.asList("test .jar"),
+                UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("http://example.com/test .jar"), "http://example.com/"));
     }
-}
\ No newline at end of file
+}



More information about the distro-pkg-dev mailing list