org.incava.doctorj
Class ExceptionDocAnalyzer

java.lang.Object
  extended by org.incava.analysis.Analyzer
      extended by org.incava.doctorj.DocAnalyzer
          extended by org.incava.doctorj.ExceptionDocAnalyzer

public class ExceptionDocAnalyzer
extends DocAnalyzer

Checks for violations of rules applying to exceptions.


Field Summary
protected static int CHKLVL_EXCEPTION_DOC_EXISTS
           
protected static int CHKLVL_EXCEPTIONS_ALPHABETICAL
           
protected static java.lang.String[] KNOWN_RUNTIME_EXCEPTIONS
           
static java.lang.String MSG_EXCEPTION_MISSPELLED
           
static java.lang.String MSG_EXCEPTION_NOT_DOCUMENTED
           
static java.lang.String MSG_EXCEPTION_NOT_IN_THROWS_LIST
           
static java.lang.String MSG_EXCEPTION_WITHOUT_CLASS_NAME
           
static java.lang.String MSG_EXCEPTION_WITHOUT_DESCRIPTION
           
static java.lang.String MSG_EXCEPTIONS_NOT_ALPHABETICAL
           
 
Fields inherited from class org.incava.doctorj.DocAnalyzer
CHKLVL_DOC_EXISTS, CHKLVL_TAG_CONTENT
 
Constructor Summary
ExceptionDocAnalyzer(Report report, JavadocNode javadoc, SimpleNode function, int nodeLevel)
          Creates and runs the exception documentation analyzer.
 
Method Summary
protected  void checkAgainstCode(JavadocTag tag, JavadocElement tgt, java.lang.String shortExcName, java.lang.String fullExcName, java.lang.Class excClass)
           
protected  ASTName getClosestMatchingException(java.lang.String str)
          Returns the name in the list that most closely matches the given string.
protected  java.lang.String getExactMatch(java.lang.String name)
           
protected  ASTName getMatchingException(java.lang.String str)
          Returns the first name in the list that matches the given string.
protected  java.lang.String getShortName(java.lang.String name)
          Returns the short name of the class, e.g., Integer instead of java.lang.Integer.
protected  boolean isRuntimeException(java.lang.Class excClass)
          Returns whether the given class is derived from Runtimeexception or Error.
protected  java.lang.Class loadClass(java.lang.String clsName)
           
protected  java.util.Map makeImportMap(ASTImportDeclaration[] imports)
           
protected  void reportUndocumentedExceptions()
           
 void run()
           
 
Methods inherited from class org.incava.doctorj.DocAnalyzer
isCheckable
 
Methods inherited from class org.incava.analysis.Analyzer
addViolation, addViolation, addViolation, getReport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_EXCEPTION_WITHOUT_CLASS_NAME

public static final java.lang.String MSG_EXCEPTION_WITHOUT_CLASS_NAME
See Also:
Constant Field Values

MSG_EXCEPTION_WITHOUT_DESCRIPTION

public static final java.lang.String MSG_EXCEPTION_WITHOUT_DESCRIPTION
See Also:
Constant Field Values

MSG_EXCEPTIONS_NOT_ALPHABETICAL

public static final java.lang.String MSG_EXCEPTIONS_NOT_ALPHABETICAL
See Also:
Constant Field Values

MSG_EXCEPTION_NOT_IN_THROWS_LIST

public static final java.lang.String MSG_EXCEPTION_NOT_IN_THROWS_LIST
See Also:
Constant Field Values

MSG_EXCEPTION_MISSPELLED

public static final java.lang.String MSG_EXCEPTION_MISSPELLED
See Also:
Constant Field Values

MSG_EXCEPTION_NOT_DOCUMENTED

public static final java.lang.String MSG_EXCEPTION_NOT_DOCUMENTED
See Also:
Constant Field Values

CHKLVL_EXCEPTIONS_ALPHABETICAL

protected static final int CHKLVL_EXCEPTIONS_ALPHABETICAL
See Also:
Constant Field Values

CHKLVL_EXCEPTION_DOC_EXISTS

protected static final int CHKLVL_EXCEPTION_DOC_EXISTS
See Also:
Constant Field Values

KNOWN_RUNTIME_EXCEPTIONS

protected static final java.lang.String[] KNOWN_RUNTIME_EXCEPTIONS
Constructor Detail

ExceptionDocAnalyzer

public ExceptionDocAnalyzer(Report report,
                            JavadocNode javadoc,
                            SimpleNode function,
                            int nodeLevel)
Creates and runs the exception documentation analyzer.

Parameters:
report - The report to which to send violations.
javadoc - The javadoc for the function. Should not be null.
function - The constructor or method.
Method Detail

run

public void run()

makeImportMap

protected java.util.Map makeImportMap(ASTImportDeclaration[] imports)

getShortName

protected java.lang.String getShortName(java.lang.String name)
Returns the short name of the class, e.g., Integer instead of java.lang.Integer.


getExactMatch

protected java.lang.String getExactMatch(java.lang.String name)

loadClass

protected java.lang.Class loadClass(java.lang.String clsName)

isRuntimeException

protected boolean isRuntimeException(java.lang.Class excClass)
Returns whether the given class is derived from Runtimeexception or Error.


checkAgainstCode

protected void checkAgainstCode(JavadocTag tag,
                                JavadocElement tgt,
                                java.lang.String shortExcName,
                                java.lang.String fullExcName,
                                java.lang.Class excClass)

reportUndocumentedExceptions

protected void reportUndocumentedExceptions()

getMatchingException

protected ASTName getMatchingException(java.lang.String str)
Returns the first name in the list that matches the given string.


getClosestMatchingException

protected ASTName getClosestMatchingException(java.lang.String str)
Returns the name in the list that most closely matches the given string.