You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Zoran Regvart (Jira)" <ji...@apache.org> on 2021/07/15 11:55:00 UTC
[jira] [Resolved] (CAMEL-16804) NullPointerException when using
try-with-resources and MainConfigurationProperties
[ https://issues.apache.org/jira/browse/CAMEL-16804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zoran Regvart resolved CAMEL-16804.
-----------------------------------
Resolution: Fixed
> NullPointerException when using try-with-resources and MainConfigurationProperties
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-16804
> URL: https://issues.apache.org/jira/browse/CAMEL-16804
> Project: Camel
> Issue Type: Bug
> Components: camel-main
> Affects Versions: 3.11.0
> Reporter: Zoran Regvart
> Assignee: Zoran Regvart
> Priority: Minor
> Fix For: 3.11.1, 3.12.0
>
>
> When using try-with-resources with {{MainConfigurationProperties}}, {{MainConfigurationProperties::close}} might be invoked twice leading to {{NullPointerException}} on shutdown:
> {code}
> ...
> Caused by: java.lang.NullPointerException
> at all//org.apache.camel.main.MainConfigurationProperties.close(MainConfigurationProperties.java:88)
> at all//io.github.zregvart.dbzcamel.dbtodb.App.main(App.java:26)
> ... 4 more
> {code}
> I.e. the Camel's shutdown will invoke {{MainConfigurationProperties::close}}, but also the try-with-resources bit if used like:
> {code}
> try (MainConfigurationProperties configure = main.configure()) {
> configure.addRoutesBuilder(Route.class);
> main.run(args);
> } catch (final Exception e) {
> throw new RuntimeException(e);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)