rbeckman-nextgen / test-mc3

0 stars 0 forks source link

NPE in startup error-handler when certain errors occur #4259

Open rbeckman-nextgen opened 4 years ago

rbeckman-nextgen commented 4 years ago

After an upgrade, I saw this in the mirth.log file:

ERROR 2019-04-11 17:59:19,326 [Main Server Thread] Server: Exception in thread "Main Server Thread" java.lang.NullPointerException ERROR 2019-04-11 17:59:19,328 [Main Server Thread] Server: at com.mirth.connect.server.Mirth.startup(Mirth.java:225) ERROR 2019-04-11 17:59:19,334 [Main Server Thread] Server: at com.mirth.connect.server.Mirth.run(Mirth.java:154)

The error occurs when the db connection pool fails to start, but there is no "root cause" exception. The code is here:

    } catch (Exception e) {
        // the getCause is needed since the wrapper exception is from the connection pool
        logger.error("Error establishing connection to database, aborting startup. " + e.getCause().getMessage());
        System.exit(0);
    } finally {

If e.getCause() returns null, an NPE will be thrown and the original exception will be lost.

Imported Issue. Original Details: Jira Issue Key: MIRTH-4403 Reporter: cschultz@chadis.com Created: 2019-04-11T11:38:43.000-0700