You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2006/02/02 00:30:42 UTC

svn commit: r374203 - in /db/derby/code/trunk/java: build/org/apache/derbyBuild/ client/org/apache/derby/client/am/ client/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/master/Derby...

Author: davidvc
Date: Wed Feb  1 15:30:33 2006
New Revision: 374203

URL: http://svn.apache.org/viewcvs?rev=374203&view=rev
Log:
DERBY-841: Internationalize message text from GetResourceBundleAction
to ParameterMetadata in org.apache.derby.client.am

Modified:
    db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
    db/derby/code/trunk/java/client/org/apache/derby/loc/clientmessages_en.properties
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java Wed Feb  1 15:30:33 2006
@@ -24,6 +24,7 @@
 import java.util.*;
 
 import org.apache.derby.iapi.services.i18n.MessageService;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class splitmessages {
 	/**
@@ -48,9 +49,8 @@
      */
     static void initClientMessageIds()
     {
-        // right now, no message ids that don't start with "XJ",
-        // so nothing to do here.  Once we have some that don't
-        // start with XJ, add here using clientMessageIds.add()
+        // Add message ids that don't start with XJ here
+        clientMessageIds.add(SQLState.NO_CURRENT_CONNECTION);
     }
 
 	public static void main(String[] args) throws Exception {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java Wed Feb  1 15:30:33 2006
@@ -20,6 +20,8 @@
 
 package org.apache.derby.client.am;
 
+import org.apache.derby.shared.common.reference.SQLState;
+
 public abstract class Lob implements UnitOfWorkListener {
     // The following flags specify the data type(s) a LOB instance currently contains
     public static final int STRING = 2;
@@ -84,7 +86,8 @@
     void checkForClosedConnection() throws SqlException {
         if (agent_.connection_.isClosedX()) {
             agent_.checkForDeferredExceptions();
-            throw new SqlException(agent_.logWriter_, "Lob method called after connection was closed");
+            throw new SqlException(agent_.logWriter_, 
+                new MessageId(SQLState.LOB_METHOD_ON_CLOSED_CONNECTION));
         } else {
             agent_.checkForDeferredExceptions();
         }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java Wed Feb  1 15:30:33 2006
@@ -23,6 +23,7 @@
 import java.sql.SQLException;
 
 import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class LogWriter {
     protected java.io.PrintWriter printWriter_;
@@ -1207,7 +1208,10 @@
                     new java.io.PrintWriter(new java.io.BufferedOutputStream(new java.io.FileOutputStream(fileCanonicalPath, fileAppend), 4096), true);
             return printWriter;
         } catch (java.io.IOException e) {
-            throw new SqlException(null, "Unable to open file " + fileName);
+            throw new SqlException(null, 
+                new MessageId(SQLState.UNABLE_TO_OPEN_FILE),
+                new Object[] { fileName, e.getMessage() },
+                e);
         }
     }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java Wed Feb  1 15:30:33 2006
@@ -19,6 +19,7 @@
 */
 
 package org.apache.derby.client.am;
+import org.apache.derby.shared.common.reference.SQLState;
 
 import java.sql.SQLException;
 
@@ -95,7 +96,8 @@
         try {
             if (physicalConnection_.isClosed()) // connection is closed or has become stale
             {
-                throw new SqlException(null, "Connection is stale."); // no call to trashConnection()
+                throw new SqlException(null, 
+                    new MessageId(SQLState.NO_CURRENT_CONNECTION)); // no call to trashConnection()
             } else {
                 ; // no call to recycleConnection()
             }
@@ -119,7 +121,9 @@
 
     private void checkForNullPhysicalConnection() throws SQLException {
         if (physicalConnection_ == null) {
-            throw new SqlException(null, " Attempt to use a closed connection. ").getSQLException();
+            SqlException se = new SqlException(null, 
+                new MessageId(SQLState.NO_CURRENT_CONNECTION));
+            throw se.getSQLException();
         }
     }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/loc/clientmessages_en.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/loc/clientmessages_en.properties?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/loc/clientmessages_en.properties (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/loc/clientmessages_en.properties Wed Feb  1 15:30:33 2006
@@ -46,6 +46,7 @@
 
 # 08 - Connection exceptions
 08003.C.1=getConnection() is not valid on a closed PooledConnection.
+08003.C.2=Lob method called after connection was closed
 
 # 0A - Feature not supported
 0AX01.S=JDBC method is not yet implemented.
@@ -58,6 +59,7 @@
 XN009.S=Invalid argument: parameter index {0} is not an OUT or INOUT parameter.
 XN010.S=Parameter 1 is the return clause of the stored procedure call. It can only be registered as an integer type.
 
+XN151.S=Unable to open file {0} : {1}
 
 
 

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java Wed Feb  1 15:30:33 2006
@@ -1467,6 +1467,7 @@
     // We use a suffix to distinguish them.  Because of the suffix
     // you *must* add a severity code
     String NOGETCONN_ON_CLOSED_POOLED_CONNECTION = "08003.C.1";
+    String LOB_METHOD_ON_CLOSED_CONNECTION = "08003.C.2";
     // system severity
     String SHUTDOWN_DATABASE = "08006.D";   
         
@@ -1511,6 +1512,8 @@
     String CALENDAR_IS_NULL                                         = "XN006.S";
     String PARAM_NOT_OUT_OR_INOUT                                   = "XN009.S";
     String RETURN_PARAM_MUST_BE_INT                                 = "XN010.S";
+    
+    String UNABLE_TO_OPEN_FILE = "XN151.S";
     
 	/*
 	** org.apache.derby.database.UserUtility

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out?rev=374203&r1=374202&r2=374203&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out Wed Feb  1 15:30:33 2006
@@ -740,12 +740,12 @@
 shortBlob length after commit is 26
 blobTest94 finished
 START: blobTest95
-EXPECTED SQLSTATE(null): Lob method called after connection was closed
-EXPECTED SQLSTATE(null): Lob method called after connection was closed
-EXPECTED SQLSTATE(null): Lob method called after connection was closed
-EXPECTED SQLSTATE(null): Lob method called after connection was closed
-EXPECTED SQLSTATE(null): Lob method called after connection was closed
-EXPECTED SQLSTATE(null): Lob method called after connection was closed
+EXPECTED SQLSTATE(08003): Lob method called after connection was closed
+EXPECTED SQLSTATE(08003): Lob method called after connection was closed
+EXPECTED SQLSTATE(08003): Lob method called after connection was closed
+EXPECTED SQLSTATE(08003): Lob method called after connection was closed
+EXPECTED SQLSTATE(08003): Lob method called after connection was closed
+EXPECTED SQLSTATE(08003): Lob method called after connection was closed
 blobTest95 finished
 START: blobTest96
 blobTest96 finished