From 910dbe05ecbb95d8cdf254ce399ee11a0fc3ac28 Mon Sep 17 00:00:00 2001 From: Marco Zanon Date: Thu, 22 Oct 2015 13:08:48 +0000 Subject: [PATCH] Renamed MConnectionSqlException to MSqlConnectionFailureException. --- .../macaco/logging/MLogDatabaseTable.java | 6 +++--- .../marcozanon/macaco/sql/MSqlConnection.java | 16 ++++++++-------- ....java => MSqlConnectionFailureException.java} | 10 +++++----- .../macaco/sql/MSqlConnectionGenerator.java | 2 +- .../macaco/sql/MSqlStatementResults.java | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) rename src/java/com/marcozanon/macaco/sql/{MConnectionSqlException.java => MSqlConnectionFailureException.java} (52%) diff --git a/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java b/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java index d4cb2a4..2922b41 100644 --- a/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java +++ b/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java @@ -6,8 +6,8 @@ package com.marcozanon.macaco.logging; -import com.marcozanon.macaco.sql.MConnectionSqlException; import com.marcozanon.macaco.sql.MSqlConnection; +import com.marcozanon.macaco.sql.MSqlConnectionFailureException; import com.marcozanon.macaco.sql.MSqlConnectionGenerator; import com.marcozanon.macaco.sql.MSqlTable; import com.marcozanon.macaco.sql.MStatementSqlException; @@ -54,7 +54,7 @@ public class MLogDatabaseTable extends MLogTarget { try { this.getSqlConnectionReference().close(); } - catch (MConnectionSqlException exception) { + catch (MSqlConnectionFailureException exception) { throw new MLoggingException("Could not close Sql connection.", exception); } } @@ -115,7 +115,7 @@ public class MLogDatabaseTable extends MLogTarget { p.put(this.getLogDatabaseField(), timestamp + separator + message); (new MSqlTable(this.getSqlConnectionReference(), this.getLogDatabaseTable(), this.getLogDatabaseTablePrimaryKey())).setRecord(p, null); } - catch (MConnectionSqlException exception) { + catch (MSqlConnectionFailureException exception) { throw new MLoggingException("Could not write to database table.", exception); } catch (MStatementSqlException exception) { diff --git a/src/java/com/marcozanon/macaco/sql/MSqlConnection.java b/src/java/com/marcozanon/macaco/sql/MSqlConnection.java index 44ee453..a780454 100644 --- a/src/java/com/marcozanon/macaco/sql/MSqlConnection.java +++ b/src/java/com/marcozanon/macaco/sql/MSqlConnection.java @@ -33,7 +33,7 @@ public class MSqlConnection extends MObject { /* */ - public MSqlConnection(String driver, String url, String username, String password) throws MConnectionSqlException { + public MSqlConnection(String driver, String url, String username, String password) throws MSqlConnectionFailureException { super(); // if (MText.isBlank(driver)) { @@ -58,36 +58,36 @@ public class MSqlConnection extends MObject { Class.forName(this.getDriver()).newInstance(); } catch (ClassNotFoundException exception) { - throw new MConnectionSqlException("Could not load driver.", exception); + throw new MSqlConnectionFailureException("Could not load driver.", exception); } catch (IllegalAccessException exception) { - throw new MConnectionSqlException("Could not load driver.", exception); + throw new MSqlConnectionFailureException("Could not load driver.", exception); } catch (InstantiationException exception) { - throw new MConnectionSqlException("Could not load driver.", exception); + throw new MSqlConnectionFailureException("Could not load driver.", exception); } // establish connection try { this.connection = DriverManager.getConnection(this.getUrl(), this.getUsername(), this.getPassword()); } catch (SQLException exception) { - throw new MConnectionSqlException("Could not get connection.", exception); + throw new MSqlConnectionFailureException("Could not get connection.", exception); } // set SQL mode try { this.getConnectionReference().createStatement().executeUpdate("SET SQL_MODE='ANSI'"); } catch (SQLException exception) { - throw new MConnectionSqlException("Could not set SQL mode to ANSI.", exception); + throw new MSqlConnectionFailureException("Could not set SQL mode to ANSI.", exception); } } - public void close() throws MConnectionSqlException { + public void close() throws MSqlConnectionFailureException { try { this.getConnectionReference().close(); } catch (SQLException exception) { - throw new MConnectionSqlException("Could not close connection.", exception); + throw new MSqlConnectionFailureException("Could not close connection.", exception); } } diff --git a/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java b/src/java/com/marcozanon/macaco/sql/MSqlConnectionFailureException.java similarity index 52% rename from src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java rename to src/java/com/marcozanon/macaco/sql/MSqlConnectionFailureException.java index 6f7f33a..fd0636b 100644 --- a/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java +++ b/src/java/com/marcozanon/macaco/sql/MSqlConnectionFailureException.java @@ -7,23 +7,23 @@ package com.marcozanon.macaco.sql; @SuppressWarnings("serial") -public class MConnectionSqlException extends MSqlException { +public class MSqlConnectionFailureException extends MSqlException { /* */ - public MConnectionSqlException() { + public MSqlConnectionFailureException() { super(); } - public MConnectionSqlException(String message) { + public MSqlConnectionFailureException(String message) { super(message); } - public MConnectionSqlException(Throwable error) { + public MSqlConnectionFailureException(Throwable error) { super(error); } - public MConnectionSqlException(String message, Throwable error) { + public MSqlConnectionFailureException(String message, Throwable error) { super(message, error); } diff --git a/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java b/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java index e141ebc..574d1f1 100644 --- a/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java +++ b/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java @@ -66,7 +66,7 @@ public class MSqlConnectionGenerator extends MObject { /* Generator */ - public MSqlConnection getConnection() throws MConnectionSqlException { + public MSqlConnection getConnection() throws MSqlConnectionFailureException { return new MSqlConnection(this.getDriver(), this.getUrl(), this.getUsername(), this.getPassword()); } diff --git a/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java b/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java index 0cd1180..84e943a 100644 --- a/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java +++ b/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java @@ -67,7 +67,7 @@ public class MSqlStatementResults extends MObject { } } - public void close() throws MConnectionSqlException { + public void close() throws MSqlConnectionFailureException { try { if (null != this.getResultSetReference()) { this.getResultSetReference().close(); @@ -75,7 +75,7 @@ public class MSqlStatementResults extends MObject { this.getPreparedStatementReference().close(); } catch (SQLException exception) { - throw new MConnectionSqlException("Could not close statement and/or result set references.", exception); + throw new MSqlConnectionFailureException("Could not close statement and/or result set references.", exception); } } -- 2.30.2