org.incava.doctorj

Class ExceptionDocAnalyzer


public class ExceptionDocAnalyzer
extends DocAnalyzer

Checks for violations of rules applying to exceptions.

Field Summary

protected static int
CHKLVL_EXCEPTIONS_ALPHABETICAL
protected static int
CHKLVL_EXCEPTION_DOC_EXISTS
protected static String[]
KNOWN_RUNTIME_EXCEPTIONS
static String
MSG_EXCEPTIONS_NOT_ALPHABETICAL
static String
MSG_EXCEPTION_MISSPELLED
static String
MSG_EXCEPTION_NOT_DOCUMENTED
static String
MSG_EXCEPTION_NOT_IN_THROWS_LIST
static String
MSG_EXCEPTION_WITHOUT_CLASS_NAME
static String
MSG_EXCEPTION_WITHOUT_DESCRIPTION

Fields inherited from class org.incava.doctorj.DocAnalyzer

CHKLVL_DOC_EXISTS, CHKLVL_TAG_CONTENT

Constructor Summary

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

Method Summary

protected void
checkAgainstCode(JavadocTag tag, JavadocElement tgt, String shortExcName, String fullExcName, Class excClass)
protected net.sourceforge.pmd.ast.ASTName
getClosestMatchingException(String str)
Returns the name in the list that most closely matches the given string.
protected String
getExactMatch(String name)
protected net.sourceforge.pmd.ast.ASTName
getMatchingException(String str)
Returns the first name in the list that matches the given string.
protected String
getShortName(String name)
Returns the short name of the class, e.g., Integer instead of java.lang.Integer.
protected boolean
isRuntimeException(Class excClass)
Returns whether the given class is derived from Runtimeexception or Error.
protected Class
loadClass(String clsName)
protected Map
makeImportMap(net.sourceforge.pmd.ast.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, addViolation, getReport

Field Details

CHKLVL_EXCEPTIONS_ALPHABETICAL

protected static final int CHKLVL_EXCEPTIONS_ALPHABETICAL
Field Value:
2

CHKLVL_EXCEPTION_DOC_EXISTS

protected static final int CHKLVL_EXCEPTION_DOC_EXISTS
Field Value:
1

KNOWN_RUNTIME_EXCEPTIONS

protected static final String[] KNOWN_RUNTIME_EXCEPTIONS

MSG_EXCEPTIONS_NOT_ALPHABETICAL

public static final String MSG_EXCEPTIONS_NOT_ALPHABETICAL

MSG_EXCEPTION_MISSPELLED

public static final String MSG_EXCEPTION_MISSPELLED

MSG_EXCEPTION_NOT_DOCUMENTED

public static final String MSG_EXCEPTION_NOT_DOCUMENTED

MSG_EXCEPTION_NOT_IN_THROWS_LIST

public static final String MSG_EXCEPTION_NOT_IN_THROWS_LIST

MSG_EXCEPTION_WITHOUT_CLASS_NAME

public static final String MSG_EXCEPTION_WITHOUT_CLASS_NAME

MSG_EXCEPTION_WITHOUT_DESCRIPTION

public static final String MSG_EXCEPTION_WITHOUT_DESCRIPTION

Constructor Details

ExceptionDocAnalyzer

public ExceptionDocAnalyzer(Report report,
                            JavadocNode javadoc,
                            net.sourceforge.pmd.ast.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 Details

checkAgainstCode

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

getClosestMatchingException

protected net.sourceforge.pmd.ast.ASTName getClosestMatchingException(String str)
Returns the name in the list that most closely matches the given string.

getExactMatch

protected String getExactMatch(String name)

getMatchingException

protected net.sourceforge.pmd.ast.ASTName getMatchingException(String str)
Returns the first name in the list that matches the given string.

getShortName

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

isRuntimeException

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

loadClass

protected Class loadClass(String clsName)

makeImportMap

protected Map makeImportMap(net.sourceforge.pmd.ast.ASTImportDeclaration[] imports)

reportUndocumentedExceptions

protected void reportUndocumentedExceptions()

run

public void run()