mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
applied a change on behalf of Jesse.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1037 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
bc7085a770
commit
4e1cf37bf8
1 file changed
+23
-1
@@ -184,7 +184,7 @@ public class Mailer extends Publisher {
|
||||
// workspaceDir will not normally end with one;
|
||||
// workspaceDir.toURI() will end with '/' if and only if workspaceDir.exists() at time of call
|
||||
wsPattern = Pattern.compile("(" +
|
||||
Pattern.quote(workspaceDir.getPath()) + "|" + Pattern.quote(workspaceDir.toURI().toString()) + ")[/\\\\]?([^:#\\s]*)");
|
||||
quoteRegexp(workspaceDir.getPath()) + "|" + quoteRegexp(workspaceDir.toURI().toString()) + ")[/\\\\]?([^:#\\s]*)");
|
||||
}
|
||||
for (int i = start; i < lines.length; i++) {
|
||||
String line = lines[i];
|
||||
@@ -414,4 +414,26 @@ public class Mailer extends Publisher {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from JDK5, to avoid 5.0 dependency.
|
||||
*/
|
||||
private static String quoteRegexp(String s) {
|
||||
int slashEIndex = s.indexOf("\\E");
|
||||
if (slashEIndex == -1)
|
||||
return "\\Q" + s + "\\E";
|
||||
|
||||
StringBuilder sb = new StringBuilder(s.length() * 2);
|
||||
sb.append("\\Q");
|
||||
slashEIndex = 0;
|
||||
int current = 0;
|
||||
while ((slashEIndex = s.indexOf("\\E", current)) != -1) {
|
||||
sb.append(s.substring(current, slashEIndex));
|
||||
current = slashEIndex + 2;
|
||||
sb.append("\\E\\\\E\\Q");
|
||||
}
|
||||
sb.append(s.substring(current, s.length()));
|
||||
sb.append("\\E");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user