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:
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
Wraps any error that might occur during interpretation of a script or expression.
- Since:
- 2.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Thrown when parsing fails due to an ambiguous statement.static class
Thrown when an annotation handler throws an exception.static class
Thrown when parsing fails due to an invalid assignment.static class
Thrown to break a loop.static class
Thrown to cancel a script execution.static class
Thrown to continue a loop.static class
Thrown when parsing fails due to a disallowed feature.static class
Thrown when a method or ctor is unknown, ambiguous or inaccessible.static class
Thrown when an operator fails.static class
Thrown when parsing fails.static class
Thrown when a property is unknown.static class
Thrown to return a value.static class
Thrown when reaching stack-overflow.static class
Thrown to throw a value.static class
Thrown when tokenization fails.static class
Thrown when method/ctor invocation fails.static class
Thrown when a variable is unknown.static enum
The various type of variable issues. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionJexlException
(JexlInfo jinfo, String msg, Throwable cause) Creates a new JexlException.JexlException
(JexlNode node, String msg) Creates a new JexlException.JexlException
(JexlNode node, String msg, Throwable cause) Creates a new JexlException.protected
JexlException
(JexlNode node, String msg, Throwable cause, boolean trace) Creates a new JexlException. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
annotationError
(JexlNode node, String annotation) Generates a message for an annotation error.clean()
Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.(package private) static <X extends Throwable>
Xclean
(X xthrow) Cleans a Throwable from any org.apache.commons.jexl3.internal stack trace element.(package private) static JexlInfo
detailedInfo
(JexlNode node, JexlInfo info) Gets the most specific information attached to a node.protected String
Accesses detailed message.(package private) static StringBuilder
Creates a string builder pre-filled with common error information (if possible).final String
getInfo()
Gets the specific information for this exception.static JexlInfo
Deprecated.3.2Detailed info message about this error.protected JexlInfo
info()
Pleasing checkstyle.(package private) static JexlInfo
merge
(JexlInfo info, JavaccError cause) Merge the node info and the cause info to obtain the best possible location.static String
methodError
(JexlNode node, String method) Deprecated.3.2static String
methodError
(JexlNode node, String method, Object[] args) Generates a message for a unsolvable method error.(package private) static String
methodSignature
(String name, Object[] args) Creates a signed-name for a given method name and arguments.static String
operatorError
(JexlNode node, String symbol) Generates a message for an operator error.protected String
parserError
(String prefix, String expr) Formats an error message from the parser.static String
propertyError
(JexlNode node, String var) Deprecated.3.2static String
propertyError
(JexlNode node, String pty, boolean undef) Generates a message for an unsolvable property error.static String
sliceSource
(String src, int froml, int fromc, int tol, int toc) Removes a slice from a source.static JexlException
tryFailed
(InvocationTargetException xinvoke) Wrap an invocation exception.(package private) static Throwable
Unwraps the cause of a throwable due to reflection.static String
variableError
(JexlNode node, String variable, boolean undef) Deprecated.3.2static String
variableError
(JexlNode node, String variable, JexlException.VariableIssue issue) Generates a message for a variable error.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
MAX_EXCHARLOC
private static final int MAX_EXCHARLOCMaximum number of characters around exception location.- See Also:
-
VARQUOTE
Used 3 times.- See Also:
-
mark
The point of origin for this exception. -
info
The debug info.
-
-
Constructor Details
-
JexlException
Creates a new JexlException.- Parameters:
jinfo
- the debugging information associatedmsg
- the error messagecause
- the exception causing the error
-
JexlException
Creates a new JexlException.- Parameters:
node
- the node causing the errormsg
- the error message
-
JexlException
Creates a new JexlException.- Parameters:
node
- the node causing the errormsg
- the error messagecause
- the exception causing the error
-
JexlException
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 Details
-
annotationError
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
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
Gets the most specific information attached to a node.- Parameters:
node
- the nodeinfo
- the information- Returns:
- the information or null
-
errorAt
Creates a string builder pre-filled with common error information (if possible).- Parameters:
node
- the node- Returns:
- a string builder
-
getInfo
Deprecated.3.2Gets the most specific information attached to a node.- Parameters:
node
- the nodeinfo
- the information- Returns:
- the information or null
-
merge
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.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
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
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
Generates a message for an operator error.- Parameters:
node
- the node where the error occurredsymbol
- the operator name- Returns:
- the error message
-
propertyError
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
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
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
Wrap an invocation exception.Return the cause if it is already a JexlException.
- Parameters:
xinvoke
- the invocation exception- Returns:
- a JexlException
-
unwrap
Unwraps the cause of a throwable due to reflection.- Parameters:
xthrow
- the throwable- Returns:
- the cause
-
variableError
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 String variableError(JexlNode node, 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
Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.- Returns:
- this exception
-
detailedMessage
Accesses detailed message.- Returns:
- the message
-
getDetail
- Returns:
- this exception specific detail
- Since:
- 3.2
-
getInfo
Gets the specific information for this exception.- Returns:
- the information
-
getMessage
Detailed info message about this error. Format is "debug![begin,end]: string \n msg" where: - debug is the debugging information if it exists (@link JexlEngine.setDebug) - 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:
getMessage
in classThrowable
- Returns:
- this error as a string
-
info
Pleasing checkstyle.- Returns:
- the info
-
parserError
Formats an error message from the parser.- Parameters:
prefix
- the prefix to the messageexpr
- the expression in error- Returns:
- the formatted message
-