Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31809

java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 56

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • scoverage-plugin
    • None

      When using the scoverage plugin you get something like this.

      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)

          [JENKINS-31809] java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 56

          Peter lai added a comment -

          I've previously mendtion this on https://github.com/shanbin/scoverage-plugin/issues/8 but just thought i'll post it here as well in case others are having the same problem.

          It seems the offending bug is here
          In ScoveragePublisher.java

          String relativeFix = content.replaceAll("href=\"/", "href=\"")
                                                  .replaceAll("href=\".*" + pattern + "/", "href=\"");
          

          I've replaced this string with

          String relativeFix = content.replaceAll("href=\"/", "href=\"")
                                                  .replaceAll(Matcher.quoteReplacement("href=\".*" + pattern + "/"), "href=\"");
          

          and it fixed the problem, after talking to Shanbin, he wants a more robust fix to the way html is handled. So for those who's having this problem, i recommend you download the code and change this line and produce you own scoverage plugin in the meant time.

          Peter lai added a comment - I've previously mendtion this on https://github.com/shanbin/scoverage-plugin/issues/8 but just thought i'll post it here as well in case others are having the same problem. It seems the offending bug is here In ScoveragePublisher.java String relativeFix = content.replaceAll( "href=\" / ", " href=\"") .replaceAll( "href=\" .* " + pattern + " / ", " href=\""); I've replaced this string with String relativeFix = content.replaceAll( "href=\" / ", " href=\"") .replaceAll(Matcher.quoteReplacement( "href=\" .* " + pattern + " / "), " href=\""); and it fixed the problem, after talking to Shanbin, he wants a more robust fix to the way html is handled. So for those who's having this problem, i recommend you download the code and change this line and produce you own scoverage plugin in the meant time.

            Unassigned Unassigned
            peterlai Peter lai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: