Source:
private void connect() throws SQLException { if (connection == null) { if (dataSource != null) { try { connection = dataSource.getConnection(); if (logger.isTraceEnabled() && !(connection instanceof LoggingConnection)) { this.connection = new LoggingConnection(connection, logger); } } catch (SQLException e) { logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); throw e; } } else { try { if (jdbcDriverClass == null || jdbcDriverClass.isEmpty()) { throw new IllegalStateException("jdbcDriverClass is null or empty!"); } if (jdbcConnectionUrl == null || jdbcConnectionUrl.isEmpty()) { throw new IllegalStateException("jdbcConnectionUrl is null or empty!"); } final Driver dbDriver = getDriver(jdbcDriverClass); connection = dbDriver.connect(jdbcConnectionUrl, new Properties()); if (logger.isTraceEnabled()) { this.connection = new LoggingConnection(connection, logger); } if (connection == null) { throw new IllegalStateException("the driver: " + jdbcDriverClass + " isn't able to connect to the requested url: " + jdbcConnectionUrl); } } catch (SQLException e) { logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); ActiveMQJournalLogger.LOGGER.error("Unable to connect to database using URL: " + jdbcConnectionUrl); throw e; } } if (this.networkTimeoutMillis >= 0 && this.networkTimeoutExecutor == null) { logger.warn("Unable to set a network timeout on the JDBC connection: networkTimeoutExecutor is null"); } if (this.networkTimeoutMillis >= 0 && this.networkTimeoutExecutor != null) { try { connection.setNetworkTimeout(this.networkTimeoutExecutor, this.networkTimeoutMillis); } catch (SQLException e) { logger.warn(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); ActiveMQJournalLogger.LOGGER.warn("Unable to set a network timeout on the JDBC connection"); } catch (Throwable throwable) { logger.warn("Unable to set a network timeout on the JDBC connection", throwable); } } } }

Target:
private void connect() throws SQLException { if (connection == null) { if (dataSource != null) { try { connection = dataSource.getConnection(); if (logger.isTraceEnabled() && !(connection instanceof LoggingConnection)) { this.connection = new LoggingConnection(connection, logger); } } catch (SQLException e) { logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); throw e; } } else { try { if (jdbcDriverClass == null || jdbcDriverClass.isEmpty()) { throw new IllegalStateException("jdbcDriverClass is null or empty!"); } if (jdbcConnectionUrl == null || jdbcConnectionUrl.isEmpty()) { throw new IllegalStateException("jdbcConnectionUrl is null or empty!"); } final Driver dbDriver = getDriver(jdbcDriverClass); connection = dbDriver.connect(jdbcConnectionUrl, new Properties()); if (logger.isTraceEnabled() && !(connection instanceof LoggingConnection)) { this.connection = new LoggingConnection(connection, logger); } if (connection == null) { throw new IllegalStateException("the driver: " + jdbcDriverClass + " isn't able to connect to the requested url: " + jdbcConnectionUrl); } } catch (SQLException e) { logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); ActiveMQJournalLogger.LOGGER.error("Unable to connect to database using URL: " + jdbcConnectionUrl); throw e; } } if (this.networkTimeoutMillis >= 0 && this.networkTimeoutExecutor == null) { logger.warn("Unable to set a network timeout on the JDBC connection: networkTimeoutExecutor is null"); } if (this.networkTimeoutMillis >= 0 && this.networkTimeoutExecutor != null) { try { connection.setNetworkTimeout(this.networkTimeoutExecutor, this.networkTimeoutMillis); } catch (SQLException e) { logger.warn(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); ActiveMQJournalLogger.LOGGER.warn("Unable to set a network timeout on the JDBC connection"); } catch (Throwable throwable) { logger.warn("Unable to set a network timeout on the JDBC connection", throwable); } } } }