Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD637D06E for ; Tue, 25 Jun 2013 12:36:56 +0000 (UTC) Received: (qmail 16972 invoked by uid 500); 25 Jun 2013 12:36:56 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 16910 invoked by uid 500); 25 Jun 2013 12:36:55 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 16892 invoked by uid 99); 25 Jun 2013 12:36:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 12:36:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 12:36:50 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AB4DB2388980; Tue, 25 Jun 2013 12:36:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1496449 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc: ConnectionChild.java EmbedConnection.java Date: Tue, 25 Jun 2013 12:36:30 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130625123630.AB4DB2388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Tue Jun 25 12:36:30 2013 New Revision: 1496449 URL: http://svn.apache.org/r1496449 Log: DERBY-6262: Simplify message-generating methods using varargs Use varargs in EmbedConnection.newSQLException() and ConnectionChild.newSQLException(). Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java?rev=1496449&r1=1496448&r2=1496449&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java Tue Jun 25 12:36:30 2013 @@ -145,15 +145,9 @@ abstract class ConnectionChild { return cal; } - SQLException newSQLException(String messageId) { - return localConn.newSQLException(messageId); - } - SQLException newSQLException(String messageId, Object arg1) { - return localConn.newSQLException(messageId, arg1); - } - SQLException newSQLException(String messageId, Object arg1, Object arg2) { - return localConn.newSQLException(messageId, arg1, arg2); - } + static SQLException newSQLException(String messageId, Object... args) { + return EmbedConnection.newSQLException(messageId, args); + } protected static void restoreIntrFlagIfSeen( boolean pushStack, EmbedConnection ec) { Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1496449&r1=1496448&r2=1496449&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Tue Jun 25 12:36:30 2013 @@ -137,7 +137,7 @@ public class EmbedConnection implements * like the VM dying could occur. Simpler just to throw a static. */ public static final SQLException NO_MEM = - Util.generateCsSQLException(SQLState.LOGIN_FAILED, "java.lang.OutOfMemoryError"); + newSQLException(SQLState.LOGIN_FAILED, "java.lang.OutOfMemoryError"); /** * Low memory state object for connection requests. @@ -2311,8 +2311,8 @@ public class EmbedConnection implements public final void setTypeMap(java.util.Map map) throws SQLException { checkIfClosed(); if( map == null) - throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,"map", - "java.sql.Connection.setTypeMap"); + throw newSQLException(SQLState.INVALID_API_PARAMETER, map, "map", + "java.sql.Connection.setTypeMap"); if(!(map.isEmpty())) throw Util.notImplemented(); } @@ -2704,15 +2704,15 @@ public class EmbedConnection implements factory.checkSystemPrivileges(user, dp); } catch (AccessControlException ace) { - throw Util.generateCsSQLException( + throw newSQLException( SQLState.AUTH_DATABASE_CREATE_MISSING_PERMISSION, user, dbname, ace); } catch (IOException ioe) { - throw Util.generateCsSQLException( + throw newSQLException( SQLState.AUTH_DATABASE_CREATE_EXCEPTION, dbname, (Object)ioe); // overloaded method } catch (Exception e) { - throw Util.generateCsSQLException( + throw newSQLException( SQLState.AUTH_DATABASE_CREATE_EXCEPTION, dbname, (Object)e); // overloaded method } @@ -3150,8 +3150,8 @@ public class EmbedConnection implements case TransactionControl.UNSPECIFIED_ISOLATION_LEVEL: break; default: - throw Util.generateCsSQLException( - SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, new Integer(level)); + throw newSQLException( + SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, level); } synchronized(getConnectionSynchronization()) @@ -3183,18 +3183,9 @@ public class EmbedConnection implements } } - protected static SQLException newSQLException(String messageId) { - return Util.generateCsSQLException(messageId); - } - protected static SQLException newSQLException(String messageId, Object arg1) { - return Util.generateCsSQLException(messageId, arg1); - } - protected static SQLException newSQLException(String messageId, Object arg1, Object arg2) { - return Util.generateCsSQLException(messageId, arg1, arg2); - } - protected static SQLException newSQLException(String messageId, Object arg1, Object arg2, Object arg3) { - return Util.generateCsSQLException(messageId, arg1, arg2, arg3); - } + static SQLException newSQLException(String messageId, Object... args) { + return Util.generateCsSQLException(messageId, args); + } ///////////////////////////////////////////////////////////////////////// // @@ -3616,7 +3607,7 @@ public class EmbedConnection implements EmbedSavepoint lsv = (EmbedSavepoint) savepoint; // bug 4451 need to throw error for null Savepoint if (lsv == null) { - throw Util.generateCsSQLException( + throw newSQLException( SQLState.XACT_SAVEPOINT_NOT_FOUND, "null"); } @@ -3740,9 +3731,8 @@ public class EmbedConnection implements public boolean isValid(int timeout) throws SQLException { // Validate that the timeout has a legal value if (timeout < 0) { - throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER, - new Integer(timeout), "timeout", - "java.sql.Connection.isValid"); + throw newSQLException(SQLState.INVALID_API_PARAMETER, timeout, + "timeout", "java.sql.Connection.isValid"); } // Use the closed status for the connection to determine if the