changeset 648:8a7fa31629d0

UnsignedAppletActionStorageImpl: (isMatching) is now ignring archives if empty.
author Jiri Vanek <jvanek@redhat.com>
date Fri, 22 Mar 2013 14:27:12 +0100
parents dc7889501235
children 7543d0b4e502
files ChangeLog netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImplTest.java
diffstat 3 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 21 18:14:53 2013 +0100
+++ b/ChangeLog	Fri Mar 22 14:27:12 2013 +0100
@@ -1,3 +1,10 @@
+2013-03-22  Jiri Vanek <jvanek@redhat.com>
+
+	* netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java:
+	(isMatching) is now ignring archives if empty.
+	* tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImplTest.java:
+	tests adapted and enriched for new archives processing.
+
 2013-03-21  Jiri Vanek <jvanek@redhat.com>
 
 	Launchers made aware of custom set JRE
--- a/netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java	Thu Mar 21 18:14:53 2013 +0100
+++ b/netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java	Fri Mar 22 14:27:12 2013 +0100
@@ -180,7 +180,11 @@
             result = result && codeBase.matches(unsignedAppletActionEntry.getCodeBase().getRegEx());
         }
         if (archives != null) {
-            result = result && compareArchives(archives, unsignedAppletActionEntry.getArchives());
+            List<String> saved = unsignedAppletActionEntry.getArchives();
+            if (saved == null || saved.isEmpty()) {
+                return result;
+            }
+            result = result && compareArchives(archives, saved);
         }
         return result;
     }
--- a/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImplTest.java	Thu Mar 21 18:14:53 2013 +0100
+++ b/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImplTest.java	Fri Mar 22 14:27:12 2013 +0100
@@ -42,6 +42,7 @@
 import java.io.IOException;
 import java.util.Arrays;
 import net.sourceforge.jnlp.ServerAccess;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -61,9 +62,28 @@
         f4 = File.createTempFile("itwMatching", "testFile4");
         ServerAccess.saveFile("A 123456 .* .* jar1,jar2", f1);
         ServerAccess.saveFile("A 123456 .* \\Qbla\\E jar1,jar2", f2);
+        ServerAccess.saveFile(""
+                + "A 1 \\Qhttp://jmol.sourceforge.net/demo/atoms/\\E \\Qhttp://jmol.sourceforge.net/jmol/\\E JmolApplet0.jar\n"
+                + "A 1363278653454 \\Qhttp://www.walter-fendt.de/ph14e\\E.* \\Qhttp://www.walter-fendt.de\\E.*\n"
+                + "n 1363281783104 \\Qhttp://www.walter-fendt.de/ph14e/inclplane.htm\\E \\Qhttp://www.walter-fendt.de/ph14_jar/\\E Ph14English.jar,SchiefeEbene.jar"
+                + "", f3);
     }
 
-    @Test
+     @AfterClass
+    public static void removeTestFiles() throws IOException {
+         f1.delete();
+         f2.delete();
+         f3.delete();
+     }
+
+
+     @Test
+    public void wildcards1() {
+        UnsignedAppletActionStorageImpl i1 = new UnsignedAppletActionStorageImpl(f3);
+        UnsignedAppletActionEntry r1 = i1.getMatchingItem("http://www.walter-fendt.de/ph14e/inclplane.htm", "http://www.walter-fendt.de/ph14_jar/", Arrays.asList(new String[]{"Ph14English.jar","SchiefeEbene.jar"}));
+         System.out.println(r1.toString());
+     }
+     @Test
     public void allMatchingDocAndCode() {
         UnsignedAppletActionStorageImpl i1 = new UnsignedAppletActionStorageImpl(f1);
         UnsignedAppletActionEntry r1 = i1.getMatchingItem("bla", "blaBla", Arrays.asList(new String[]{"jar1", "jar2"}));