[
https://issues.apache.org/jira/browse/JXPATH-186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15029002#comment-15029002
]
Michele Vivoda commented on JXPATH-186:
---------------------------------------
Yes, where the exception is rethrown we can safely just catch {{Exception}}.
I put here the cases I found where no rethrow, this is
PropertyIterator#getNodePointer()
{noformat}
try {
return propertyNodePointer.getValuePointer();
}
catch (Throwable t) {
propertyNodePointer.handle(t);
NullPropertyPointer npp =
new NullPropertyPointer(
propertyNodePointer.getImmediateParentPointer());
npp.setPropertyName(propertyNodePointer.getPropertyName());
npp.setIndex(propertyNodePointer.getIndex());
return npp.getValuePointer();
}
{noformat}
This is in PropertyIterator#getLength
{noformat}
try {
length = propertyNodePointer.getLength(); // TBD: cache length
}
catch (Throwable t) {
propertyNodePointer.handle(t);
length = 0;
}
{noformat}
Something rarely seen in SimpleCharStream ;-)
{noformat}
catch (Throwable t)
{
throw new Error(t.getMessage());
}
{noformat}
> JXPath catches Throwable
> ------------------------
>
> Key: JXPATH-186
> URL: https://issues.apache.org/jira/browse/JXPATH-186
> Project: Commons JXPath
> Issue Type: Bug
> Reporter: Michele Vivoda
> Priority: Minor
>
> JXPath catches Throwable in 12 places, it could be a bad practice
> http://stackoverflow.com/a/16027430/1536382
> In most places it just rethrows but in a couple also does some logic, like in
> PropertyIterator where returns a NullPropertyPointer object.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)