Zoran Regvart created CAMEL-16804: ------------------------------------- Summary: 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 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)