From: Marco Zanon Date: Thu, 22 Oct 2015 13:08:48 +0000 (+0000) Subject: Renamed MConnectionSqlException to MSqlConnectionFailureException. X-Git-Tag: SVN-to-Git~96 X-Git-Url: https://gitweb.marcozanon.com/?a=commitdiff_plain;h=49e455dc7ad87852569c9de7c32f85abc7ccf1b4;p=Macaco Renamed MConnectionSqlException to MSqlConnectionFailureException. --- diff --git a/4.x/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java b/4.x/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java index d4cb2a4..2922b41 100644 --- a/4.x/src/java/com/marcozanon/macaco/logging/MLogDatabaseTable.java +++ b/4.x/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/4.x/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java b/4.x/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java deleted file mode 100644 index 6f7f33a..0000000 --- a/4.x/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Macaco - * Copyright (c) 2009-2015 Marco Zanon . - * Released under MIT license (see LICENSE for details). - */ - -package com.marcozanon.macaco.sql; - -@SuppressWarnings("serial") -public class MConnectionSqlException extends MSqlException { - - /* */ - - public MConnectionSqlException() { - super(); - } - - public MConnectionSqlException(String message) { - super(message); - } - - public MConnectionSqlException(Throwable error) { - super(error); - } - - public MConnectionSqlException(String message, Throwable error) { - super(message, error); - } - -} diff --git a/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnection.java b/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnection.java index 44ee453..a780454 100644 --- a/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnection.java +++ b/4.x/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/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionFailureException.java b/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionFailureException.java new file mode 100644 index 0000000..fd0636b --- /dev/null +++ b/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionFailureException.java @@ -0,0 +1,30 @@ +/** + * Macaco + * Copyright (c) 2009-2015 Marco Zanon . + * Released under MIT license (see LICENSE for details). + */ + +package com.marcozanon.macaco.sql; + +@SuppressWarnings("serial") +public class MSqlConnectionFailureException extends MSqlException { + + /* */ + + public MSqlConnectionFailureException() { + super(); + } + + public MSqlConnectionFailureException(String message) { + super(message); + } + + public MSqlConnectionFailureException(Throwable error) { + super(error); + } + + public MSqlConnectionFailureException(String message, Throwable error) { + super(message, error); + } + +} diff --git a/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java b/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java index e141ebc..574d1f1 100644 --- a/4.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java +++ b/4.x/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/4.x/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java b/4.x/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java index 0cd1180..84e943a 100644 --- a/4.x/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java +++ b/4.x/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); } }