Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScoveragePublisher.java gives java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near #8

Closed
peterlai-roboops opened this issue Nov 25, 2015 · 2 comments

Comments

@peterlai-roboops
Copy link

When ScoveragePublisher.java scans a scoverage results file i side a folder that starts with M (e.g.
scoverage-report\com\nephila\attribution\common**mail\test.xml)

It gives this error,

Publishing Scoverage XML and HTML report ...
ERROR: Build step failed with exception
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 56
href=".*scoverage-report\com\nephila\attribution\common\mail/
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.escape(Unknown Source)
at java.util.regex.Pattern.atom(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at org.jenkinsci.plugins.scoverage.ScoveragePublisher.processReport(ScoveragePublisher.java:128)
at org.jenkinsci.plugins.scoverage.ScoveragePublisher.perform(ScoveragePublisher.java:67)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:76)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)

@peterlai-roboops
Copy link
Author

package org.jenkinsci.plugins.scoverage;

Here's a mini test class to replicate the problem, the replaceAll uses Reggex pattern matching and it's causing issues when confronted with \m

public class test {
public static void main(String args[]){
String line = "";
String pattern = "scoverage-report\com\nephila\attribution\common\mail";
String pete = line.replaceAll("href=" + pattern, "href=");
}}

@shanbin
Copy link
Owner

shanbin commented Mar 9, 2016

Fixed on master.

@shanbin shanbin closed this as completed Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants