[
https://issues.apache.org/jira/browse/UNOMI-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Serge Huber resolved UNOMI-109.
-------------------------------
Resolution: Fixed
Fixed by capturing the result in a Boolean object and then checking if it is
null to return a false value instead.
> NPE when an exception is caught in the ElasticSearch persistence
> implementation
> -------------------------------------------------------------------------------
>
> Key: UNOMI-109
> URL: https://issues.apache.org/jira/browse/UNOMI-109
> Project: Apache Unomi
> Issue Type: Bug
> Components: core
> Affects Versions: 1.2.0-incubating
> Reporter: Serge Huber
> Fix For: 1.2.0-incubating
>
>
> When using the InClassLoaderExecute with a Boolean type, when an exception is
> caught we return null. If we let an automatic cast to boolean happen it will
> generate a NPE.
> For example:
> {code}
> public boolean save(final Item item, final boolean useBatching) {
> Boolean result = new InClassLoaderExecute<Boolean>() {
> protected Boolean execute(Object... args) throws Exception {
> try {
> ... }
> }.catchingExecuteInClassLoader(true);
> }
> {code}
> If an exception occurs in the execute method it will be caught by the
> catchingExecuteInClassLoader method and null will be return by the method.
> But as we try to convert this to a scalar boolean type this will generate an
> NPE.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)