Package org.apache.commons.jexl3
Class JexlException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.apache.commons.jexl3.JexlException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
JexlException.Annotation,JexlException.Break,JexlException.Cancel,JexlException.Continue,JexlException.Method,JexlException.Operator,JexlException.Parsing,JexlException.Property,JexlException.Return,JexlException.StackOverflow,JexlException.Throw,JexlException.Tokenization,JexlException.TryFailed,JexlException.Variable,JxltEngine.Exception
public class JexlException extends java.lang.RuntimeExceptionWraps any error that might occur during interpretation of a script or expression.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJexlException.AmbiguousThrown when parsing fails due to an ambiguous statement.static classJexlException.AnnotationThrown when an annotation handler throws an exception.static classJexlException.AssignmentThrown when parsing fails due to an invalid assignment.static classJexlException.BreakThrown to break a loop.static classJexlException.CancelThrown to cancel a script execution.static classJexlException.ContinueThrown to continue a loop.static classJexlException.FeatureThrown when parsing fails due to a disallowed feature.static classJexlException.MethodThrown when a method or ctor is unknown, ambiguous or inaccessible.static classJexlException.OperatorThrown when an operator fails.static classJexlException.ParsingThrown when parsing fails.static classJexlException.PropertyThrown when a property is unknown.static classJexlException.ReturnThrown to return a value.static classJexlException.StackOverflowThrown when reaching stack-overflow.static classJexlException.ThrowThrown to throw a value.static classJexlException.TokenizationThrown when tokenization fails.static classJexlException.TryFailedThrown when method/ctor invocation fails.static classJexlException.VariableThrown when a variable is unknown.static classJexlException.VariableIssueThe various type of variable issues.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StackTraceElement[]EMPTY_STACK_TRACE_ELEMENT_ARRAYprivate JexlInfoinfoThe debug info.private JexlNodemarkThe point of origin for this exception.private static intMAX_EXCHARLOCMaximum number of characters around exception location.private static longserialVersionUIDprivate static java.lang.StringVARQUOTEUsed 3 times.
-
Constructor Summary
Constructors Modifier Constructor Description JexlException(JexlInfo jinfo, java.lang.String msg, java.lang.Throwable cause)Creates a new JexlException.JexlException(JexlNode node, java.lang.String msg)Creates a new JexlException.JexlException(JexlNode node, java.lang.String msg, java.lang.Throwable cause)Creates a new JexlException.protectedJexlException(JexlNode node, java.lang.String msg, java.lang.Throwable cause, boolean trace)Creates a new JexlException.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.StringannotationError(JexlNode node, java.lang.String annotation)Generates a message for an annotation error.JexlExceptionclean()Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.(package private) static <X extends java.lang.Throwable>
Xclean(X xthrow)Cleans a Throwable from any org.apache.commons.jexl3.internal stack trace element.(package private) static JexlInfodetailedInfo(JexlNode node, JexlInfo info)Gets the most specific information attached to a node.protected java.lang.StringdetailedMessage()Accesses detailed message.(package private) static java.lang.StringBuildererrorAt(JexlNode node)Creates a string builder pre-filled with common error information (if possible).java.lang.StringgetDetail()Gets the exception specific detailJexlInfogetInfo()Gets the specific information for this exception.static JexlInfogetInfo(JexlNode node, JexlInfo info)Deprecated.3.2java.lang.StringgetMessage()Detailed info message about this error.protected JexlInfoinfo()Pleasing checkstyle.(package private) static JexlInfomerge(JexlInfo info, JavaccError cause)Merge the node info and the cause info to obtain the best possible location.static java.lang.StringmethodError(JexlNode node, java.lang.String method)Deprecated.3.2static java.lang.StringmethodError(JexlNode node, java.lang.String method, java.lang.Object[] args)Generates a message for a unsolvable method error.(package private) static java.lang.StringmethodSignature(java.lang.String name, java.lang.Object[] args)Creates a signed-name for a given method name and arguments.static java.lang.StringoperatorError(JexlNode node, java.lang.String symbol)Generates a message for an operator error.protected java.lang.StringparserError(java.lang.String prefix, java.lang.String expr)Formats an error message from the parser.static java.lang.StringpropertyError(JexlNode node, java.lang.String var)Deprecated.3.2static java.lang.StringpropertyError(JexlNode node, java.lang.String pty, boolean undef)Generates a message for an unsolvable property error.static java.lang.StringsliceSource(java.lang.String src, int froml, int fromc, int tol, int toc)Removes a slice from a source.static JexlExceptiontryFailed(java.lang.reflect.InvocationTargetException xinvoke)Wrap an invocation exception.(package private) static java.lang.Throwableunwrap(java.lang.Throwable xthrow)Unwraps the cause of a throwable due to reflection.static java.lang.StringvariableError(JexlNode node, java.lang.String variable, boolean undef)Deprecated.3.2static java.lang.StringvariableError(JexlNode node, java.lang.String variable, JexlException.VariableIssue issue)Generates a message for a variable error.
-
-
-
Field Detail
-
EMPTY_STACK_TRACE_ELEMENT_ARRAY
private static final java.lang.StackTraceElement[] EMPTY_STACK_TRACE_ELEMENT_ARRAY
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
MAX_EXCHARLOC
private static final int MAX_EXCHARLOC
Maximum number of characters around exception location.- See Also:
- Constant Field Values
-
VARQUOTE
private static final java.lang.String VARQUOTE
Used 3 times.- See Also:
- Constant Field Values
-
mark
private final transient JexlNode mark
The point of origin for this exception.
-
info
private final transient JexlInfo info
The debug info.
-
-
Constructor Detail
-
JexlException
public JexlException(JexlInfo jinfo, java.lang.String msg, java.lang.Throwable cause)
Creates a new JexlException.- Parameters:
jinfo- the debugging information associatedmsg- the error messagecause- the exception causing the error
-
JexlException
public JexlException(JexlNode node, java.lang.String msg)
Creates a new JexlException.- Parameters:
node- the node causing the errormsg- the error message
-
JexlException
public JexlException(JexlNode node, java.lang.String msg, java.lang.Throwable cause)
Creates a new JexlException.- Parameters:
node- the node causing the errormsg- the error messagecause- the exception causing the error
-
JexlException
protected JexlException(JexlNode node, java.lang.String msg, java.lang.Throwable cause, boolean trace)
Creates a new JexlException.- Parameters:
node- the node causing the errormsg- the error messagecause- the exception causing the errortrace- whether this exception has a stack trace and can not be suppressed
-
-
Method Detail
-
annotationError
public static java.lang.String annotationError(JexlNode node, java.lang.String annotation)
Generates a message for an annotation error.- Parameters:
node- the node where the error occurredannotation- the annotation name- Returns:
- the error message
- Since:
- 3.1
-
clean
static <X extends java.lang.Throwable> X clean(X xthrow)
Cleans a Throwable from any org.apache.commons.jexl3.internal stack trace element.- Type Parameters:
X- the throwable type- Parameters:
xthrow- the thowable- Returns:
- the throwable
-
detailedInfo
static JexlInfo detailedInfo(JexlNode node, JexlInfo info)
Gets the most specific information attached to a node.- Parameters:
node- the nodeinfo- the information- Returns:
- the information or null
-
errorAt
static java.lang.StringBuilder errorAt(JexlNode node)
Creates a string builder pre-filled with common error information (if possible).- Parameters:
node- the node- Returns:
- a string builder
-
getInfo
@Deprecated public static JexlInfo getInfo(JexlNode node, JexlInfo info)
Deprecated.3.2Gets the most specific information attached to a node.- Parameters:
node- the nodeinfo- the information- Returns:
- the information or null
-
merge
static JexlInfo merge(JexlInfo info, JavaccError cause)
Merge the node info and the cause info to obtain the best possible location.- Parameters:
info- the nodecause- the cause- Returns:
- the info to use
-
methodError
@Deprecated public static java.lang.String methodError(JexlNode node, java.lang.String method)
Deprecated.3.2Generates a message for a unsolvable method error.- Parameters:
node- the node where the error occurredmethod- the method name- Returns:
- the error message
-
methodError
public static java.lang.String methodError(JexlNode node, java.lang.String method, java.lang.Object[] args)
Generates a message for a unsolvable method error.- Parameters:
node- the node where the error occurredmethod- the method nameargs- the method arguments- Returns:
- the error message
-
methodSignature
static java.lang.String methodSignature(java.lang.String name, java.lang.Object[] args)Creates a signed-name for a given method name and arguments.- Parameters:
name- the method nameargs- the method arguments- Returns:
- a suitable signed name
-
operatorError
public static java.lang.String operatorError(JexlNode node, java.lang.String symbol)
Generates a message for an operator error.- Parameters:
node- the node where the error occurredsymbol- the operator name- Returns:
- the error message
-
propertyError
@Deprecated public static java.lang.String propertyError(JexlNode node, java.lang.String var)
Deprecated.3.2Generates a message for an unsolvable property error.- Parameters:
node- the node where the error occurredvar- the variable- Returns:
- the error message
-
propertyError
public static java.lang.String propertyError(JexlNode node, java.lang.String pty, boolean undef)
Generates a message for an unsolvable property error.- Parameters:
node- the node where the error occurredpty- the propertyundef- whether the property is null or undefined- Returns:
- the error message
-
sliceSource
public static java.lang.String sliceSource(java.lang.String src, int froml, int fromc, int tol, int toc)Removes a slice from a source.- Parameters:
src- the sourcefroml- the beginning linefromc- the beginning columntol- the ending linetoc- the ending column- Returns:
- the source with the (begin) to (to) zone removed
-
tryFailed
public static JexlException tryFailed(java.lang.reflect.InvocationTargetException xinvoke)
Wrap an invocation exception.Return the cause if it is already a JexlException.
- Parameters:
xinvoke- the invocation exception- Returns:
- a JexlException
-
unwrap
static java.lang.Throwable unwrap(java.lang.Throwable xthrow)
Unwraps the cause of a throwable due to reflection.- Parameters:
xthrow- the throwable- Returns:
- the cause
-
variableError
@Deprecated public static java.lang.String variableError(JexlNode node, java.lang.String variable, boolean undef)
Deprecated.3.2Generates a message for a variable error.- Parameters:
node- the node where the error occurredvariable- the variableundef- whether the variable is null or undefined- Returns:
- the error message
-
variableError
public static java.lang.String variableError(JexlNode node, java.lang.String variable, JexlException.VariableIssue issue)
Generates a message for a variable error.- Parameters:
node- the node where the error occurredvariable- the variableissue- the variable kind of issue- Returns:
- the error message
-
clean
public JexlException clean()
Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.- Returns:
- this exception
-
detailedMessage
protected java.lang.String detailedMessage()
Accesses detailed message.- Returns:
- the message
-
getDetail
public final java.lang.String getDetail()
Gets the exception specific detail- Returns:
- this exception specific detail
- Since:
- 3.2
-
getInfo
public JexlInfo getInfo()
Gets the specific information for this exception.- Returns:
- the information
-
getMessage
public java.lang.String getMessage()
Detailed info message about this error.Format is "debug![begin,end]: string \n msg" where:
- debug is the debugging information if it exists
JexlBuilder.debug(boolean) - begin, end are character offsets in the string for the precise location of the error
- string is the string representation of the offending expression
- msg is the actual explanation message for this error
- Overrides:
getMessagein classjava.lang.Throwable- Returns:
- this error as a string
- See Also:
JexlEngine.isDebug()
- debug is the debugging information if it exists
-
info
protected JexlInfo info()
Pleasing checkstyle.- Returns:
- the info
-
parserError
protected java.lang.String parserError(java.lang.String prefix, java.lang.String expr)Formats an error message from the parser.- Parameters:
prefix- the prefix to the messageexpr- the expression in error- Returns:
- the formatted message
-
-