/hg/icedtea-web: Allowed wrong match of the aaaexample.com by *....

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Mon Mar 31 17:20:32 UTC 2014


changeset 79a3a7a01760 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=79a3a7a01760
author: Jiri Vanek <jvanek at redhat.com>
date: Mon Mar 31 19:20:19 2014 +0200

	Allowed wrong match of the aaaexample.com by *.example.com expression as in specification.


diffstat:

 ChangeLog                                                           |  9 +++++++++
 netx/net/sourceforge/jnlp/util/ClasspathMatcher.java                |  9 +++++----
 tests/netx/unit/net/sourceforge/jnlp/util/ClasspathMatcherTest.java |  8 ++++++--
 3 files changed, 20 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r ee80e215928e -r 79a3a7a01760 ChangeLog
--- a/ChangeLog	Mon Mar 31 16:54:52 2014 +0200
+++ b/ChangeLog	Mon Mar 31 19:20:19 2014 +0200
@@ -1,3 +1,12 @@
+2013-03-31  Jiri Vanek  <jvanek at redhat.com>
+
+	Allowed wrong match of the aaaexample.com by *.example.com expression as in
+	specification.
+	* netx/net/sourceforge/jnlp/util/ClasspathMatcher.java: uncommented  handling 
+	of dot in (domainToRegEx).
+	* tests/netx/unit/net/sourceforge/jnlp/util/ClasspathMatcherTest.java:
+	(matchTest) uncommented and added tests of/for dot issue.
+
 2013-03-31  Jiri Vanek  <jvanek at redhat.com>
             Alexandr Kolouch  <skolnag at gmail.com>
 
diff -r ee80e215928e -r 79a3a7a01760 netx/net/sourceforge/jnlp/util/ClasspathMatcher.java
--- a/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java	Mon Mar 31 16:54:52 2014 +0200
+++ b/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java	Mon Mar 31 19:20:19 2014 +0200
@@ -146,10 +146,11 @@
         }
 
         private static Pattern domainToRegEx(String domain) {
-            // I have conisdered the "dot" as bug i specification
-            // while (domain.startsWith("*.")) {
-            //    domain = "*" + domain.substring(2);
-            //}
+            // Although I have conisdered the "dot" as bug in specification, 
+            // to many applications are depnding on it
+            while (domain.startsWith("*.")) {
+                domain = "*" + domain.substring(2);
+            }
             return ClasspathMatcher.sourceToRegEx(domain);
         }
     }
diff -r ee80e215928e -r 79a3a7a01760 tests/netx/unit/net/sourceforge/jnlp/util/ClasspathMatcherTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/util/ClasspathMatcherTest.java	Mon Mar 31 16:54:52 2014 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/ClasspathMatcherTest.java	Mon Mar 31 19:20:19 2014 +0200
@@ -422,9 +422,13 @@
         Assert.assertTrue(p.match(urls[13]));
         Assert.assertTrue(p.match(urls[14]));
         //those represent the "dot" issue 
-        //Assert.assertTrue(p.match(urls[15]));
-        //Assert.assertTrue(p.match(urls[16]));
+        Assert.assertTrue(p.match(urls[15]));
+        Assert.assertTrue(p.match(urls[16]));
         Assert.assertFalse(p.match(urls[17]));
+        //reasons for alowing "dot" issue
+        Assert.assertTrue(p.match(new URL("http://www.example.com")));
+        Assert.assertTrue(p.match(new URL("http://example.com"))); //yah, this is really nasty
+        //still the DOT issue is an BUG
     }
 
     @Test


More information about the distro-pkg-dev mailing list