Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16804

NullPointerException when using try-with-resources and MainConfigurationProperties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.11.0
    • 3.11.1, 3.12.0
    • camel-main
    • None
    • Unknown

    Description

      When using try-with-resources with MainConfigurationProperties, MainConfigurationProperties::close might be invoked twice leading to NullPointerException on shutdown:

      ...
      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
      

      I.e. the Camel's shutdown will invoke MainConfigurationProperties::close, but also the try-with-resources bit if used like:

      try (MainConfigurationProperties configure = main.configure()) {
          configure.addRoutesBuilder(Route.class);
          main.run(args);
      } catch (final Exception e) {
          throw new RuntimeException(e);
      }
      

      Attachments

        Activity

          People

            zregvart Zoran Regvart
            zregvart Zoran Regvart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: