Github user mtaylor commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/961#discussion_r96252766
  
    --- Diff: 
artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java
 ---
    @@ -61,74 +64,121 @@ public AbstractJDBCDriver(DataSource dataSource, 
SQLProvider provider) {
           this.sqlProvider = provider;
        }
     
    -   public void start() throws Exception {
    +   public void start() throws SQLException {
           connect();
           createSchema();
           prepareStatements();
        }
     
        public void stop() throws SQLException {
           if (sqlProvider.closeConnectionOnShutdown()) {
    -         connection.close();
    +         try {
    +            connection.close();
    +         } catch (SQLException e) {
    +            logger.error(JDBCUtils.appendSQLExceptionDetails(new 
StringBuilder(), e));
    +            throw e;
    +         }
           }
        }
     
        protected abstract void prepareStatements() throws SQLException;
     
        protected abstract void createSchema() throws SQLException;
     
    -   protected void createTable(String... schemaSqls) throws SQLException {
    +   protected final void createTable(String... schemaSqls) throws 
SQLException {
           createTableIfNotExists(connection, sqlProvider.getTableName(), 
schemaSqls);
        }
     
    -   protected void connect() throws Exception {
    +   private void connect() throws SQLException {
           if (dataSource != null) {
    -         connection = dataSource.getConnection();
    +         try {
    +            connection = dataSource.getConnection();
    +         } catch (SQLException e) {
    +            logger.error(JDBCUtils.appendSQLExceptionDetails(new 
StringBuilder(), e));
    +            throw e;
    --- End diff --
    
    Usually the database will throw an exception if a table already exists.  
This is not an error (the table will only be created the first time the servers 
starts).  However, this code change would log an error each time the server 
restarts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to