Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-21569] Expose current line in groovy.
Added getCurrentLine() method for line based parsers.
  • Loading branch information
uhafner committed Jan 31, 2014
1 parent 4605175 commit fb9924a16dead75cdf8a73b811c4824b413a0a6d
@@ -41,6 +41,8 @@ public DynamicParser(final String name, final String regexp, final String script
*/
@Override
protected Warning createWarning(final Matcher matcher) {
expressionMatcher.setCurrentLine(getCurrentLine());

return expressionMatcher.createWarning(matcher);
}
}
@@ -23,9 +23,11 @@ public class GroovyExpressionMatcher implements Serializable {

private final Warning falsePositive;
private final String script;
private int currentLine;

private transient Script compiled;


/**
* Creates a new instance of {@link GroovyExpressionMatcher}.
*
@@ -53,6 +55,24 @@ private void compileScriptIfNotYetDone() {
}
}

/**
* Returns the current line number that is handled by the parser.
*
* @return the current line number
*/
public int getCurrentLine() {
return currentLine;
}

/**
* Sets the current line number to the specified value.
*
* @param currentLine the new line number
*/
void setCurrentLine(int currentLine) {
this.currentLine = currentLine;
}

/**
* Creates a new annotation for the specified match.
*

0 comments on commit fb9924a

Please sign in to comment.