Class RegexErrorPattern
- All Implemented Interfaces:
Cloneable
RegexErrorPattern specifies a regular expression and rules how to create markers for
Problems View. It is used by RegexErrorParser to process build output.
Regex pattern used by this class is Java regular expression and defines capturing groups. Those capturing groups are used in file, line, description expressions to get the values.
For example: pattern "(../../..) (.*):(\d*): (Error:.*)" could go along with file-expression "$2", line-expression "$3" and description-expression "$1 $4".
Note: variable name is being stored in marker tag. However currently it is not being used.
Severity could be one of:
- IMarkerGenerator.SEVERITY_INFO,
- IMarkerGenerator.SEVERITY_WARNING,
- IMarkerGenerator.SEVERITY_ERROR_RESOURCE,
- IMarkerGenerator.SEVERITY_ERROR_BUILD
- SEVERITY_SKIP
SEVERITY_SKIP means that output line is checked to match the pattern
but won't be parsed to create a marker. It is useful with conjunction with
eatProcessedLine=true to filter out certain lines.
eatProcessedLine specifies if the current output line is being passed
to the rest of patterns for further processing or consumed by the pattern.
Clients may extend this class. As it implements Cloneable interface those clients
must implement Object.clone() and Object.equals(java.lang.Object) methods to avoid slicing.
- Since:
- 5.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAdditional "severity" flag which tells if qualified output line should be ignored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanprotected Stringprotected StringgetFileName(Matcher matcher) protected intgetLineNum(Matcher matcher) intprotected intgetSeverity(Matcher matcher) protected StringgetVarName(Matcher matcher) booleanbooleanprocessLine(String line, ErrorParserManager eoParser) Parse a line of build output and register error/warning for Problems view.protected booleanrecordError(Matcher matcher, ErrorParserManager eoParser) Register the error inErrorParserManager.voidsetDescriptionExpression(String descriptionExpression) voidsetEatProcessedLine(boolean eatProcessedLine) voidsetFileExpression(String fileExpression) voidsetLineExpression(String lineExpression) voidsetPattern(String pattern) voidsetSeverity(int severity) voidsetVarNameExpression(String varNameExpression)
-
Field Details
-
SEVERITY_SKIP
public static final int SEVERITY_SKIPAdditional "severity" flag which tells if qualified output line should be ignored.- See Also:
-
-
Constructor Details
-
RegexErrorPattern
public RegexErrorPattern(String pattern, String fileExpression, String lineExpression, String descriptionExpression, String varNameExpression, int severity, boolean eat) Constructor.- Parameters:
pattern- - regular expression describing the capturing groupsfileExpression- - capturing group expression defining file namelineExpression- - capturing group expression defining line numberdescriptionExpression- - capturing group expression defining descriptionvarNameExpression- -capturing group expression defining variable nameseverity- - severity, one ofIMarkerGenerator.SEVERITY_INFO,IMarkerGenerator.SEVERITY_WARNING,IMarkerGenerator.SEVERITY_ERROR_RESOURCE,IMarkerGenerator.SEVERITY_ERROR_BUILDSEVERITY_SKIPeat- - defines whether to consume output line avoiding further processing by other patternsSee general description for this class
RegexErrorPatternfor more details.
-
-
Method Details
-
getPattern
- Returns:
- regular expression pattern
-
getFileExpression
- Returns:
- expression defining file name
-
getLineExpression
- Returns:
- expression defining line number
-
getDescriptionExpression
- Returns:
- expression defining description
-
getVarNameExpression
- Returns:
- expression defining variable name
-
getSeverity
public int getSeverity()- Returns:
- severity of the marker, one of:
IMarkerGenerator.SEVERITY_INFO,IMarkerGenerator.SEVERITY_WARNING,IMarkerGenerator.SEVERITY_ERROR_RESOURCE,IMarkerGenerator.SEVERITY_ERROR_BUILD
-
isEatProcessedLine
public boolean isEatProcessedLine()- Returns:
- whether output line is consumed and not processed further by other patterns
-
setPattern
- Parameters:
pattern- - regular expression pattern describing the capturing groups
-
setFileExpression
- Parameters:
fileExpression- - capturing group expression defining file name
-
setLineExpression
- Parameters:
lineExpression- - capturing group expression defining line number
-
setDescriptionExpression
- Parameters:
descriptionExpression- - capturing group expression defining description
-
setVarNameExpression
- Parameters:
varNameExpression- -capturing group expression defining variable name
-
setSeverity
public void setSeverity(int severity) - Parameters:
severity- - severity, one ofIMarkerGenerator.SEVERITY_INFO,IMarkerGenerator.SEVERITY_WARNING,IMarkerGenerator.SEVERITY_ERROR_RESOURCE,IMarkerGenerator.SEVERITY_ERROR_BUILDSEVERITY_SKIP
-
setEatProcessedLine
public void setEatProcessedLine(boolean eatProcessedLine) - Parameters:
eatProcessedLine- - whether to consume output line avoiding further processing by other patterns
-
getFileName
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed file name or
null.
-
getLineNum
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed line number or
0.
-
getDesc
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed description or
null.
-
getVarName
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed variable name or
null.
-
getSeverity
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- severity of the problem.
-
processLine
Parse a line of build output and register error/warning for Problems view.- Parameters:
line- - one line of output.eoParser- -ErrorParserManager.- Returns:
trueif error/warning/info problem was found.
-
recordError
Register the error inErrorParserManager.- Parameters:
matcher- - matcher to parse the input line.eoParser- -ErrorParserManager.- Returns:
trueindicating that error was found.
-
equals
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-