Class IssueParser

java.lang.Object
edu.hm.hafner.analysis.IssueParser
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbstractDryParser, AbstractViolationAdapter, AjcParser, CargoCheckParser, CcmParser, CheckStyleParser, ClangAnalyzerPlistParser, EclipseXMLParser, EmbeddedEngineerParser, FindBugsParser, FxCopParser, GendarmeParser, IdeaInspectionParser, JcReportParser, JsonIssueParser, JsonLogParser, JsonParser, LintParser, LookaheadParser, PmdParser, PolyspaceParser, PVSStudioParser, QtTranslationParser, RfLintParser, SimulinkCheckParser, StyleCopParser, TaglistParser, XmlParser

public abstract class IssueParser extends Object implements Serializable
Parses a file and returns the issues reported in this file.
Author:
Ullrich Hafner
See Also:
  • Constructor Details

    • IssueParser

      public IssueParser()
  • Method Details

    • parse

      public abstract Report parse(ReaderFactory readerFactory) throws ParsingException, ParsingCanceledException
      Parses the specified file for issues.
      Parameters:
      readerFactory - provides a reader to the reports
      Returns:
      the issues
      Throws:
      ParsingException - Signals that during parsing a non recoverable error has been occurred
      ParsingCanceledException - Signals that the parsing has been aborted by the user
    • parseFile

      public Report parseFile(ReaderFactory readerFactory) throws ParsingException, ParsingCanceledException
      Parses the specified file for issues. Invokes the parser using parse(ReaderFactory) and sets the file name of the report.
      Parameters:
      readerFactory - provides a reader to the reports
      Returns:
      the issues
      Throws:
      ParsingException - Signals that during parsing a non recoverable error has been occurred
      ParsingCanceledException - Signals that the parsing has been aborted by the user
    • accepts

      public boolean accepts(ReaderFactory readerFactory)
      Returns whether this parser accepts the specified file as valid input. Parsers may reject a file if it is in the wrong format to avoid exceptions during parsing.
      Parameters:
      readerFactory - provides a reader to the reports
      Returns:
      true if this parser accepts this file as valid input, or false if the file could not be parsed by this parser
    • isXmlFile

      protected boolean isXmlFile(ReaderFactory readerFactory)
      Returns whether the specified file is an XML file. This method just checks if the first 10 lines contain the XML tag rather than parsing the whole document.
      Parameters:
      readerFactory - the file to check
      Returns:
      true if the file is an XML file, false otherwise
    • equalsIgnoreCase

      public static boolean equalsIgnoreCase(@CheckForNull String a, @CheckForNull String b)

      Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

      nulls are handled without exceptions. Two null references are considered equal. The comparison is case insensitive.

       StringUtils.equalsIgnoreCase(null, null)   = true
       StringUtils.equalsIgnoreCase(null, "abc")  = false
       StringUtils.equalsIgnoreCase("abc", null)  = false
       StringUtils.equalsIgnoreCase("abc", "abc") = true
       StringUtils.equalsIgnoreCase("abc", "ABC") = true
       
      Parameters:
      a - the first CharSequence, may be null
      b - the second CharSequence, may be null
      Returns:
      true if the CharSequences are equal (case-insensitive), or both null