hudson.plugins.warnings.parser
Class RegexpParser

java.lang.Object
  extended by hudson.plugins.warnings.parser.RegexpParser
All Implemented Interfaces:
AnnotationParser
Direct Known Subclasses:
AntJavacParser, HpiCompileParser, JavacParser, MsBuildParser

public abstract class RegexpParser
extends java.lang.Object
implements AnnotationParser

Parses an input stream for compiler warnings using the provided regular expression.

Author:
Ulli Hafner

Constructor Summary
RegexpParser(java.lang.String warningPattern)
          Creates a new instance of RegexpParser.
 
Method Summary
protected abstract  Warning createWarning(java.util.regex.Matcher matcher)
          Creates a new annotation for the specified pattern.
protected  int getLineNumber(java.lang.String lineNumber)
          Converts a string line number to an integer value.
 java.util.Collection<FileAnnotation> parse(java.io.InputStream file)
          Parses the specified input stream for compiler warnings using the provided regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexpParser

public RegexpParser(java.lang.String warningPattern)
Creates a new instance of RegexpParser.

Parameters:
warningPattern - pattern of compiler warnings.
Method Detail

parse

public java.util.Collection<FileAnnotation> parse(java.io.InputStream file)
                                           throws java.io.IOException
Parses the specified input stream for compiler warnings using the provided regular expression.

Specified by:
parse in interface AnnotationParser
Parameters:
file - the file to parse
Returns:
the collection of annotations
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

createWarning

protected abstract Warning createWarning(java.util.regex.Matcher matcher)
Creates a new annotation for the specified pattern.

Parameters:
matcher - the regular expression matcher
Returns:
a new annotation for the specified pattern

getLineNumber

protected final int getLineNumber(java.lang.String lineNumber)
Converts a string line number to an integer value. If the string is not a valid line number, then 0 is returned which indicates a warning at the top of the file.

Parameters:
lineNumber - the line number (as a string)
Returns:
the line number


Copyright © 2008. All Rights Reserved.