Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1305

syntax highlights rendering problem in case if backslash character coded as \u005c in character literal

      Apache Pig project (http://pig.apache.org/) has the following constant in one of source files:
      private static final char SINGLE_QUOTE = '\u005c'';

      (Here backslash character in the literal quoted with unicode escape \u005c.)
      Clover 3.1.11 encounters problem rendering the syntax highlights in the html report for such file (trace below). The file is present in the report, and coverage inside it seems to be calculated correctly, but the file's source in the report is not colored completely.

      2013-07-13 07:19:07.862 [clover-report] Failed to render syntax highlights for /home/jenkins/jenkins/workspace/Pig-Integration-trunk-gd/pig/src/org/apache/pig/parser/StreamingCommandUtils.java: expecting ''', found '\n'
      2013-07-13 07:19:07.863 [clover-report] line 47:56: expecting ''', found '\n'line 47:56: expecting ''', found '\n'
      2013-07-13 07:19:07.863 [clover-report] at com.atlassian.clover.instr.java.JavaLexer.nextToken(JavaLexer.java:441)
      2013-07-13 07:19:07.864 [clover-report] at com.atlassian.clover.instr.java.UnicodeJavaLexer.nextToken(UnicodeJavaLexer.java:56)
      2013-07-13 07:19:07.864 [clover-report] at com.cenqua.clover.reporters.html.source.java.JavaTokenTraverser.traverse(JavaTokenTraverser.java:93)
      2013-07-13 07:19:07.864 [clover-report] at com.cenqua.clover.reporters.html.source.java.JavaSourceRenderer.render(JavaSourceRenderer.java:18)
      2013-07-13 07:19:07.865 [clover-report] at com.cenqua.clover.reporters.html.source.SourceRenderHelper.render(SourceRenderHelper.java:317)
      2013-07-13 07:19:07.865 [clover-report] at com.cenqua.clover.reporters.html.source.SourceRenderHelper.gatherSrcRenderInfo(SourceRenderHelper.java:123)
      2013-07-13 07:19:07.865 [clover-report] at com.cenqua.clover.reporters.html.source.SourceRenderHelper.insertLineInfosForFile(SourceRenderHelper.java:53)
      2013-07-13 07:19:07.866 [clover-report] at com.cenqua.clover.reporters.html.RenderFileAction.insertLineInfos(RenderFileAction.java:284)
      2013-07-13 07:19:07.866 [clover-report] at com.cenqua.clover.reporters.html.RenderFileAction.render(RenderFileAction.java:131)
      2013-07-13 07:19:07.866 [clover-report] at com.cenqua.clover.reporters.html.RenderFileAction.call(RenderFileAction.java:115)
      2013-07-13 07:19:07.867 [clover-report] at com.cenqua.clover.util.CloverExecutors$LoggingCallable.call(CloverExecutors.java:86)
      2013-07-13 07:19:07.867 [clover-report] at clover.retrotranslator.edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:178)
      2013-07-13 07:19:07.867 [clover-report] at clover.retrotranslator.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
      2013-07-13 07:19:07.868 [clover-report] at clover.retrotranslator.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
      2013-07-13 07:19:07.869 [clover-report] at java.lang.Thread.run(Thread.java:662)

            [CLOV-1305] syntax highlights rendering problem in case if backslash character coded as \u005c in character literal

            Marek Parfianowicz added a comment - - edited

            fix grammar
            fix highlighting in eclipse
            fix highlighting in idea

            Marek Parfianowicz added a comment - - edited fix grammar fix highlighting in eclipse fix highlighting in idea

            Marek Parfianowicz added a comment - - edited

            Clover 3.2.2:

            When such backslash is present in a source file, Clover-for-Eclipse fails to render coverage highlights. It also does not show any metrics for a class, as if it would not be instrumentable:

            After enabling Clover logging (Preferences > Clover > Logging level) in the Error Log view we can see messages like:

             
            Error C:\...\Unicode2.java:3:53:expecting ''', found '\r'
            Error Clover instrumentation failed for file .../Unicode2.java - code coverage will not be recorded for this file.
            

            In IDEA it ends with a build error:

            Marek Parfianowicz added a comment - - edited Clover 3.2.2: When such backslash is present in a source file, Clover-for-Eclipse fails to render coverage highlights. It also does not show any metrics for a class, as if it would not be instrumentable: After enabling Clover logging (Preferences > Clover > Logging level) in the Error Log view we can see messages like: Error C:\...\Unicode2.java:3:53:expecting ''', found '\r' Error Clover instrumentation failed for file .../Unicode2.java - code coverage will not be recorded for this file. In IDEA it ends with a build error:

            Hi, Marek,
            1) yes, looks like so. At least the coverage numbers and traces from tests seem to be adequate.
            2) yes, the file is available, and the tracing from tests is present (numbers and green bars on the left side). Just the code of the class is not highlighted (shown in black and white).

            Ivan Veselovsky added a comment - Hi, Marek, 1) yes, looks like so. At least the coverage numbers and traces from tests seem to be adequate. 2) yes, the file is available, and the tracing from tests is present (numbers and green bars on the left side). Just the code of the class is not highlighted (shown in black and white).

            Hi Ivan, thank you for reporting this.

            1) Could you confirm that this error occurs only during HTML report rendering, i.e. the instrumentation of the source file via <clover-setup> or <clover-instr> works fine?

            2) Could you confirm that the file is available in the report, despite the parsing problem, i.e. that it's rendered as a plain text?

            Cheers
            Marek

            Marek Parfianowicz added a comment - Hi Ivan, thank you for reporting this. 1) Could you confirm that this error occurs only during HTML report rendering, i.e. the instrumentation of the source file via <clover-setup> or <clover-instr> works fine? 2) Could you confirm that the file is available in the report, despite the parsing problem, i.e. that it's rendered as a plain text? Cheers Marek

              mparfianowicz Marek Parfianowicz
              5eb0ba3ce860 Ivan Veselovsky
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: