Package net.sourceforge.pmd.lang.ast
Class FileAnalysisException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.commons.lang3.exception.ContextedRuntimeException
net.sourceforge.pmd.lang.ast.FileAnalysisException
- All Implemented Interfaces:
Serializable,org.apache.commons.lang3.exception.ExceptionContext
- Direct Known Subclasses:
LexException,MalformedSourceException,ParseException,SemanticException
public class FileAnalysisException
extends org.apache.commons.lang3.exception.ContextedRuntimeException
An exception that occurs while processing a file. Subtypes include
MalformedSourceException: error in source format, eg invalid character escapes (in case that happens before lexing)LexException: lexical syntax errorsParseException: syntax errorsSemanticException: exceptions occurring after the parsing phase, because the source code is semantically invalid
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFileAnalysisException(String message) FileAnalysisException(String message, Throwable cause) FileAnalysisException(Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionprotected String@NonNull FileIdThe name of the file in which the error occurred.final Stringprotected booleanprotected @Nullable FileLocationlocation()static FileAnalysisExceptionWraps the cause into an analysis exception.Methods inherited from class org.apache.commons.lang3.exception.ContextedRuntimeException
addContextValue, getContextEntries, getContextLabels, getContextValues, getFirstContextValue, getFormattedExceptionMessage, getRawMessage, setContextValueMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
FileAnalysisException
public FileAnalysisException() -
FileAnalysisException
-
FileAnalysisException
-
FileAnalysisException
-
-
Method Details
-
setFileId
-
hasFileName
protected boolean hasFileName() -
getFileId
The name of the file in which the error occurred. -
getMessage
- Overrides:
getMessagein classorg.apache.commons.lang3.exception.ContextedRuntimeException
-
errorKind
-
location
-
wrap
public static FileAnalysisException wrap(@NonNull FileId fileId, @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:
fileId- Filenamemessage- Context message, if the cause is not aFileAnalysisExceptioncause- Exception to wrap- Returns:
- An exception
-