• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-plugin
    • None

      In a custom parser, the current input line number should be available (i.e. the line that matched the regex).
      Otherwise you cannot add Warning annotations correctly to e.g. the console log, if a source file is not available for the warning.

          [JENKINS-21569] Expose current input line in groovy script

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/DynamicParser.java
          src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
          http://jenkins-ci.org/commit/warnings-plugin/fb9924a16dead75cdf8a73b811c4824b413a0a6d
          Log:
          [FIXED JENKINS-21569] Expose current line in groovy.
          Added getCurrentLine() method for line based parsers.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/DynamicParser.java src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java http://jenkins-ci.org/commit/warnings-plugin/fb9924a16dead75cdf8a73b811c4824b413a0a6d Log: [FIXED JENKINS-21569] Expose current line in groovy. Added getCurrentLine() method for line based parsers.

          Ulli Hafner added a comment -

          Hmm, is not that easy...

          Ulli Hafner added a comment - Hmm, is not that easy...

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/DynamicParser.java
          src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
          src/test/java/hudson/plugins/warnings/parser/DynamicParserTest.java
          http://jenkins-ci.org/commit/warnings-plugin/c2fcaec495f69bb8a90b0edc83b03a22635bb30a
          Log:
          [FIXED JENKINS-21569] Expose variable lineNumber in groovy.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/DynamicParser.java src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java src/test/java/hudson/plugins/warnings/parser/DynamicParserTest.java http://jenkins-ci.org/commit/warnings-plugin/c2fcaec495f69bb8a90b0edc83b03a22635bb30a Log: [FIXED JENKINS-21569] Expose variable lineNumber in groovy.

          Ulli Hafner added a comment -

          The line number is exposed via property 'lineNumber'.

          Ulli Hafner added a comment - The line number is exposed via property 'lineNumber'.

          James Howe added a comment -

          Upgraded to 4.39, and get this error on the "Configure System" page when testing the script you added to the tests.
          An exception occurred during evaluation of the Groovy script: No such property: lineNumber for class: Script1

          James Howe added a comment - Upgraded to 4.39, and get this error on the "Configure System" page when testing the script you added to the tests. An exception occurred during evaluation of the Groovy script: No such property: lineNumber for class: Script1

          Ulli Hafner added a comment -

          I see, but this is only in the UI validation code. The parser still does work even though an error is shown. Seems that I need to remove some duplicate code

          Ulli Hafner added a comment - I see, but this is only in the UI validation code. The parser still does work even though an error is shown. Seems that I need to remove some duplicate code

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/GroovyParser.java
          src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
          http://jenkins-ci.org/commit/warnings-plugin/14b3ce92f80a51778b37e2eef44687897c14d562
          Log:
          [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/GroovyParser.java src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java http://jenkins-ci.org/commit/warnings-plugin/14b3ce92f80a51778b37e2eef44687897c14d562 Log: [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          warnings
          http://jenkins-ci.org/commit/analysis-suite-plugin/cb1d3e4b9c59fc693064952ba2c1c8b5dce495b1
          Log:
          [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: warnings http://jenkins-ci.org/commit/analysis-suite-plugin/cb1d3e4b9c59fc693064952ba2c1c8b5dce495b1 Log: [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

            drulli Ulli Hafner
            jameshowe James Howe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: