db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r953049 - in /db/derby/code/trunk/java: client/org/apache/derby/client/net/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 09 Jun 2010 15:49:59 GMT
Author: kmarsden
Date: Wed Jun  9 15:49:58 2010
New Revision: 953049

URL: http://svn.apache.org/viewvc?rev=953049&view=rev
Log:
DERBY-4009 Accommodate length delimited DRDA strings where character length does not equal
byte length

patch to include length checking for remaining commands.

contributed by Tiago Espina (tiago dot derby at yahoo dot co dot )

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java?rev=953049&r1=953048&r2=953049&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
(original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
Wed Jun  9 15:49:58 2010
@@ -433,16 +433,19 @@ public class NetConnectionRequest extend
         int extnamTruncateLength = Math.min(extnam.length(),
                 NetConfiguration.EXTNAM_MAXSIZE);
 
-        writeScalarString(CodePoint.EXTNAM,
-                extnam.substring(0, extnamTruncateLength));
+        // Writing the truncated string as to preserve previous behavior
+        writeScalarString(CodePoint.EXTNAM, extnam.substring(0, extnamTruncateLength), 0,
+                NetConfiguration.EXTNAM_MAXSIZE, SQLState.NET_EXTNAM_TOO_LONG);
     }
 
     // Server Name is the name of the DDM server.
     private void buildSRVNAM(String srvnam) throws SqlException {
         int srvnamTruncateLength = Math.min(srvnam.length(),
                 NetConfiguration.SRVNAM_MAXSIZE);
-        writeScalarString(CodePoint.SRVNAM,
-                srvnam.substring(0, srvnamTruncateLength));
+        
+        // Writing the truncated string as to preserve previous behavior
+        writeScalarString(CodePoint.SRVNAM,srvnam.substring(0, srvnamTruncateLength),
+                0, NetConfiguration.SRVNAM_MAXSIZE,SQLState.NET_SRVNAM_TOO_LONG);
     }
 
     // Server Product Release Level String specifies the product

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=953049&r1=953048&r2=953049&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Wed Jun  9 15:49:58
2010
@@ -258,6 +258,16 @@ Guide.
                 <name>08001.C.12</name>
                 <text>A connection could not be established because the password has
a length of zero or is larger than the maximum allowed by the network protocol.</text>
             </msg>
+			
+			<msg>
+                <name>08001.C.13</name>
+                <text>A connection could not be established because the external name
(EXTNAM) has a length of zero or is larger than the maximum allowed by the network protocol.</text>
+            </msg>
+			
+			<msg>
+                <name>08001.C.14</name>
+                <text>A connection could not be established because the server name
(SRVNAM) has a length of zero or is larger than the maximum allowed by the network protocol.</text>
+            </msg>
 
             <msg>
                 <name>08001.C.1</name>

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=953049&r1=953048&r2=953049&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 Jun  9 15:49:58 2010
@@ -1702,8 +1702,9 @@ public interface SQLState {
     String NET_SECTKN_TOO_LONG                                  = "08001.C.10";
     String NET_USERID_TOO_LONG                                  = "08001.C.11";
     String NET_PASSWORD_TOO_LONG                                = "08001.C.12";
-
-        
+    String NET_EXTNAM_TOO_LONG                                  = "08001.C.13";
+    String NET_SRVNAM_TOO_LONG                                  = "08001.C.14";    
+    
     // database severity
     String SHUTDOWN_DATABASE = "08006.D";  
     String DROP_DATABASE = "08006.D.1";

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java?rev=953049&r1=953048&r2=953049&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
Wed Jun  9 15:49:58 2010
@@ -95,6 +95,8 @@ public final class ErrorCodeTest extends
         		{"08001","A connection could not be established because the security token is larger
than the maximum allowed by the network protocol.","40000"},
         		{"08001","A connection could not be established because the user id has a length
of zero or is larger than the maximum allowed by the network protocol.","40000"},
         		{"08001","A connection could not be established because the password has a length
of zero or is larger than the maximum allowed by the network protocol.","40000"},
+        		{"08001","A connection could not be established because the external name (EXTNAM)
has a length of zero or is larger than the maximum allowed by the network protocol.","40000"},
+        		{"08001","A connection could not be established because the server name (SRVNAM)
has a length of zero or is larger than the maximum allowed by the network protocol.","40000"},
         		{"08001","Required Derby DataSource property {0} not set.","40000"},
         		{"08001","{0} : Error connecting to server {1} on port {2} with message {3}.","40000"},
         		{"08001","SocketException: '{0}'","40000"},



Mime
View raw message