/hg/icedtea-web: Manual quotation in ClasspathMatcher regex repl...
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Tue Apr 1 09:28:03 UTC 2014
changeset d84effce2642 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=d84effce2642
author: Jiri Vanek <jvanek at redhat.com>
date: Tue Apr 01 11:27:53 2014 +0200
Manual quotation in ClasspathMatcher regex replaced by Pattern.quote
diffstat:
ChangeLog | 6 ++++++
netx/net/sourceforge/jnlp/util/ClasspathMatcher.java | 13 ++++++-------
2 files changed, 12 insertions(+), 7 deletions(-)
diffs (45 lines):
diff -r 70d23452ac83 -r d84effce2642 ChangeLog
--- a/ChangeLog Tue Apr 01 11:20:26 2014 +0200
+++ b/ChangeLog Tue Apr 01 11:27:53 2014 +0200
@@ -1,3 +1,9 @@
+2013-04-01 Jiri Vanek <jvanek at redhat.com>
+
+ Manual quotation in ClasspathMatcher regex replaced by Pattern.quote
+ * netx/net/sourceforge/jnlp/util/ClasspathMatcher.java: (quote)
+ is now using Pattern.quote instead manual \Q + original + \E
+
2013-04-01 Jiri Vanek <jvanek at redhat.com>
Restricted CodebaseMatcher to not match aaexample.com by *.example.com expression
diff -r 70d23452ac83 -r d84effce2642 netx/net/sourceforge/jnlp/util/ClasspathMatcher.java
--- a/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java Tue Apr 01 11:20:26 2014 +0200
+++ b/netx/net/sourceforge/jnlp/util/ClasspathMatcher.java Tue Apr 01 11:27:53 2014 +0200
@@ -326,22 +326,21 @@
private static String quote(String s) {
/*
* coment for lazybones:
- * \Q is start of citation
- * \E is end of citation
- * - all characters in citation are threated as are without any special meaning
+ * 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
*/
if (s.startsWith("*") && s.endsWith("*")) {
- return "^.*\\Q" + s.substring(1, s.length() - 1) + "\\E.*$";
+ return "^.*" + Pattern.quote(s.substring(1, s.length() - 1)) + ".*$";
} else if (s.endsWith("*")) {
- return "^\\Q" + s.substring(0, s.length() - 1) + "\\E.*$";
+ return "^" + Pattern.quote(s.substring(0, s.length() - 1)) + ".*$";
} else if (s.startsWith("*")) {
- return "^.*\\Q" + s.substring(1) + "\\E$";
+ return "^.*" + Pattern.quote(s.substring(1)) + "$";
} else {
- return "^\\Q" + s + "\\E$";
+ return "^" + Pattern.quote(s) + "$";
}
}
More information about the distro-pkg-dev
mailing list