[
https://issues.apache.org/jira/browse/JEXL-459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henri Biestro updated JEXL-459:
-------------------------------
Description:
Currently empty/size function swallows all exceptions ; contrarily to other
operators, even arguments evaluation is caught and a default behavior always
applies. Having at least a log would be pretty helpful to debug.
{code:java}
@Override
protected Object visit(final ASTEmptyFunction node, final Object data) {
try {
final Object value = node.jjtGetChild(0).jjtAccept(this, data);
return operators.empty(node, value);
} catch (final JexlException xany) {
return true;
}
} {code}
I'd like to have ability to log information about such exceptions. For example
expression
{code:java}
empty('aaa'.substring(400,500)) {code}
returns true, but it is very costly operation.
Please add something like
{code:java}
if (isSilent() && logger.isWarnEnabled()) {
logger.warn(xany.getMessage(), xany.getCause());
} {code}
or any other way of logging problems in expressions.
similar problem is with size - which also ignores all exceptions
{code:java}
@Override
protected Object visit(final ASTSizeFunction node, final Object data) {
try {
final Object val = node.jjtGetChild(0).jjtAccept(this, data);
return operators.size(node, val);
} catch (final JexlException xany) {
return 0;
}
} {code}
was:
Currently empty function swallows all exceptions
{code:java}
@Override
protected Object visit(final ASTEmptyFunction node, final Object data) {
try {
final Object value = node.jjtGetChild(0).jjtAccept(this, data);
return operators.empty(node, value);
} catch (final JexlException xany) {
return true;
}
} {code}
I'd like to have ability to log information about such exceptions. For example
expression
{code:java}
empty('aaa'.substring(400,500)) {code}
returns true, but it is very costly operation.
Please add something like
{code:java}
if (isSilent() && logger.isWarnEnabled()) {
logger.warn(xany.getMessage(), xany.getCause());
} {code}
or any other way of logging problems in expressions.
similar problem is with size - which also ignores all exceptions
{code:java}
@Override
protected Object visit(final ASTSizeFunction node, final Object data) {
try {
final Object val = node.jjtGetChild(0).jjtAccept(this, data);
return operators.size(node, val);
} catch (final JexlException xany) {
return 0;
}
} {code}
> Empty/size functions swallow all exceptions with no trace
> ---------------------------------------------------------
>
> Key: JEXL-459
> URL: https://issues.apache.org/jira/browse/JEXL-459
> Project: Commons JEXL
> Issue Type: Wish
> Affects Versions: 3.6.2
> Reporter: Mirek Hankus
> Assignee: Henri Biestro
> Priority: Major
>
> Currently empty/size function swallows all exceptions ; contrarily to other
> operators, even arguments evaluation is caught and a default behavior always
> applies. Having at least a log would be pretty helpful to debug.
>
> {code:java}
> @Override
> protected Object visit(final ASTEmptyFunction node, final Object data) {
> try {
> final Object value = node.jjtGetChild(0).jjtAccept(this, data);
> return operators.empty(node, value);
> } catch (final JexlException xany) {
> return true;
> }
> } {code}
> I'd like to have ability to log information about such exceptions. For
> example expression
> {code:java}
> empty('aaa'.substring(400,500)) {code}
> returns true, but it is very costly operation.
> Please add something like
> {code:java}
> if (isSilent() && logger.isWarnEnabled()) {
> logger.warn(xany.getMessage(), xany.getCause());
> } {code}
> or any other way of logging problems in expressions.
>
> similar problem is with size - which also ignores all exceptions
> {code:java}
> @Override
> protected Object visit(final ASTSizeFunction node, final Object data) {
> try {
> final Object val = node.jjtGetChild(0).jjtAccept(this, data);
> return operators.size(node, val);
> } catch (final JexlException xany) {
> return 0;
> }
> } {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)