org.apache.commons.jexl3
Class JexlException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by 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.Tokenization, JexlException.Variable, JxltEngine.Exception

public class JexlException
extends RuntimeException

Wraps any error that might occur during interpretation of a script or expression.

Since:
2.0
See Also:
Serialized Form

Nested Class Summary
static class JexlException.Ambiguous
          Thrown when parsing fails due to an ambiguous statement.
static class JexlException.Annotation
          Thrown when an annotation handler throws an exception.
static class JexlException.Assignment
          Thrown when parsing fails due to an invalid assigment.
static class JexlException.Break
          Thrown to break a loop.
static class JexlException.Cancel
          Thrown to cancel a script execution.
static class JexlException.Continue
          Thrown to continue a loop.
static class JexlException.Method
          Thrown when a method or ctor is unknown, ambiguous or inaccessible.
static class JexlException.Operator
          Thrown when an operator fails.
static class JexlException.Parsing
          Thrown when parsing fails.
static class JexlException.Property
          Thrown when a property is unknown.
static class JexlException.Return
          Thrown to return a value.
static class JexlException.Tokenization
          Thrown when tokenization fails.
static class JexlException.Variable
          Thrown when a variable is unknown.
 
Constructor Summary
JexlException(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.
 
Method Summary
static String annotationError(JexlNode node, String annotation)
          Generates a message for an annotation error.
 JexlException clean()
          Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.
protected  String detailedMessage()
          Accesses detailed message.
 JexlInfo getInfo()
          Gets the specific information for this exception.
static JexlInfo getInfo(JexlNode node, JexlInfo info)
          Gets the most specific information attached to a node.
 String getMessage()
          Detailed info message about this error.
static String methodError(JexlNode node, String method)
          Generates a message for a unsolvable method error.
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)
          Generates a message for an unsolvable property error.
static String variableError(JexlNode node, String variable, boolean undef)
          Generates a message for a variable error.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JexlException

public JexlException(JexlNode node,
                     String msg)
Creates a new JexlException.

Parameters:
node - the node causing the error
msg - the error message

JexlException

public JexlException(JexlNode node,
                     String msg,
                     Throwable cause)
Creates a new JexlException.

Parameters:
node - the node causing the error
msg - the error message
cause - the exception causing the error

JexlException

public JexlException(JexlInfo jinfo,
                     String msg,
                     Throwable cause)
Creates a new JexlException.

Parameters:
jinfo - the debugging information associated
msg - the error message
cause - the exception causing the error
Method Detail

getInfo

public JexlInfo getInfo()
Gets the specific information for this exception.

Returns:
the information

getInfo

public static JexlInfo getInfo(JexlNode node,
                               JexlInfo info)
Gets the most specific information attached to a node.

Parameters:
node - the node
info - the information
Returns:
the information or null

clean

public JexlException clean()
Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.

Returns:
this exception

detailedMessage

protected String detailedMessage()
Accesses detailed message.

Returns:
the message

parserError

protected String parserError(String prefix,
                             String expr)
Formats an error message from the parser.

Parameters:
prefix - the prefix to the message
expr - the expression in error
Returns:
the formatted message

variableError

public static String variableError(JexlNode node,
                                   String variable,
                                   boolean undef)
Generates a message for a variable error.

Parameters:
node - the node where the error occurred
variable - the variable
undef - whether the variable is null or undefined
Returns:
the error message

propertyError

public static String propertyError(JexlNode node,
                                   String var)
Generates a message for an unsolvable property error.

Parameters:
node - the node where the error occurred
var - the variable
Returns:
the error message

methodError

public static String methodError(JexlNode node,
                                 String method)
Generates a message for a unsolvable method error.

Parameters:
node - the node where the error occurred
method - the method name
Returns:
the error message

operatorError

public static String operatorError(JexlNode node,
                                   String symbol)
Generates a message for an operator error.

Parameters:
node - the node where the error occurred
symbol - the operator name
Returns:
the error message

annotationError

public static String annotationError(JexlNode node,
                                     String annotation)
Generates a message for an annotation error.

Parameters:
node - the node where the error occurred
annotation - the annotation name
Returns:
the error message
Since:
3.1

getMessage

public 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 (@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 class Throwable
Returns:
this error as a string


Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.