Package net.sourceforge.pmd.lang.ast
Class FileAnalysisException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- net.sourceforge.pmd.lang.ast.FileAnalysisException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MalformedSourceException
,ParseException
,SemanticException
,TokenMgrError
public class FileAnalysisException extends RuntimeException
An exception that occurs while processing a file. Subtypes includeTokenMgrError
: lexical syntax errorsParseException
: syntax errorsSemanticException
: exceptions occurring after the parsing phase, because the source code is semantically invalid
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FileAnalysisException()
FileAnalysisException(String message)
FileAnalysisException(String message, Throwable cause)
FileAnalysisException(Throwable cause)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
errorKind()
@NonNull String
getFileName()
The name of the file in which the error occurred.String
getMessage()
protected boolean
hasFileName()
protected String
positionToString()
FileAnalysisException
setFileName(String filename)
static FileAnalysisException
wrap(@NonNull String filename, @NonNull String message, @NonNull Throwable cause)
Wraps the cause into an analysis exception.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
setFileName
public FileAnalysisException setFileName(String filename)
-
hasFileName
protected boolean hasFileName()
-
getFileName
public @NonNull String getFileName()
The name of the file in which the error occurred.
-
getMessage
public String getMessage()
- Overrides:
getMessage
in classThrowable
-
errorKind
protected String errorKind()
-
positionToString
protected String positionToString()
-
wrap
public static FileAnalysisException wrap(@NonNull String filename, @NonNull String message, @NonNull Throwable cause)
Wraps the cause into an analysis exception. If it is itself an analysis exception, just returns it after setting the filename for context.- Parameters:
filename
- Filenamemessage
- Context message, if the cause is not aFileAnalysisException
cause
- Exception to wrap- Returns:
- An exception
-
-