[icedtea-web] RFC: Clean up some code in ClasspathMatcher
Omair Majid
omajid at redhat.com
Wed Apr 2 14:51:40 UTC 2014
Hi,
The attached patch renames a method in ClasspathMatcher to better
reflect what the method does.
Okay for HEAD?
Thanks,
Omair
--
PGP Key: 66484681 (http://pgp.mit.edu/)
Fingerprint = F072 555B 0A17 3957 4E95 0056 F286 F14F 6648 4681
-------------- next part --------------
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-02 Omair Majid <omajid at redhat.com>
+
+ * netx/net/sourceforge/jnlp/util/ClasspathMatcher.java
+ (quote): Rename to ..
+ (convertWildcardToRegEx): New method. Adjust all callers.
+
2014-04-02 Jiri Vanek <jvanek at redhat.com>
* NEWS: Added 1.6 section
diff --git a/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java b/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java
--- a/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java
+++ b/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java
@@ -152,7 +152,7 @@
//this is handling case, when *.abc.xy
//should match also abc.xy except whatever.abc.xz
//but NOT whatewerabc.xy
- pre = "(" + quote(domain.substring(2)) + ")|(";
+ pre = "(" + convertWildcardToRegEx(domain.substring(2)) + ")|(";
post = ")";
}
return Pattern.compile(pre + ClasspathMatcher.sourceToRegExString(domain) + post);
@@ -320,17 +320,10 @@
if (s.equals("*")) {
return ".*";
}
- return quote(s);
+ return convertWildcardToRegEx(s);
}
- private static String quote(String s) {
- /*
- * coment for lazybones:
- * Pattern.quote - all characters in citation are threated as are without any special meaning
- * Citation is based on \Q and \E marks wwith escapped inner \Q and \E
- * ^ is start of th e line
- * $ is end of the line
- */
+ private static String convertWildcardToRegEx(String s) {
if (s.startsWith("*") && s.endsWith("*")) {
return "^.*" + Pattern.quote(s.substring(1, s.length() - 1)) + ".*$";
} else if (s.endsWith("*")) {
More information about the distro-pkg-dev
mailing list