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/05/25 22:26:27 UTC

svn commit: r409459 - in /db/derby/code/trunk: java/build/org/apache/derbyBuild/ java/client/org/apache/derby/client/net/ java/engine/org/apache/derby/loc/ java/shared/org/apache/derby/shared/common/reference/ java/testing/org/apache/derbyTesting/funct...

Author: davidvc
Date: Thu May 25 13:26:26 2006
New Revision: 409459

URL: http://svn.apache.org/viewvc?rev=409459&view=rev
Log:
DERBY-849: Internationalize Reply to Typdef in org.apache.derby.client.net
Also migrated some network exceptions from SQL State 08006 to 58009,
to be in line with DRDA spec.


Modified:
    db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_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/resultsetStream.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SuicideOfStreaming.java
    db/derby/code/trunk/tools/testing/i18nTestGenerator/clientPrologue.txt
    db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient1.sed
    db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient2.sed

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java?rev=409459&r1=409458&r2=409459&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 Thu May 25 13:26:26 2006
@@ -115,6 +115,7 @@
         clientMessageIds.add(SQLState.NET_SQLCDTA_INVALID_FOR_PKGID);
         clientMessageIds.add(SQLState.NET_PGNAMCSN_INVALID_AT_SQLAM);
         clientMessageIds.add(SQLState.NET_VCM_VCS_LENGTHS_INVALID);
+        clientMessageIds.add(SQLState.LANG_STRING_TOO_LONG);
     }
 
 	public static void main(String[] args) throws Exception {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java Thu May 25 13:26:26 2006
@@ -31,6 +31,7 @@
 import org.apache.derby.client.am.ClientMessageId;
 
 import org.apache.derby.shared.common.reference.SQLState;
+import org.apache.derby.shared.common.reference.MessageId;
 
 public class Reply {
     protected org.apache.derby.client.am.Agent agent_;
@@ -157,7 +158,7 @@
     // from the underlying stream.  This method will keep trying to
     // read bytes until it has obtained at least the minimum number.
     // Now returns the total bytes read for decryption, use to return void.
-    protected int fill(int minimumBytesNeeded) throws org.apache.derby.client.am.DisconnectException {
+    protected int fill(int minimumBytesNeeded) throws DisconnectException {
         // make sure that there is enough space in the buffer to hold
         // the minimum number of bytes needed.
         ensureSpaceInBufferForFill(minimumBytesNeeded);
@@ -203,7 +204,7 @@
     // Make sure a certain amount of Layer A data is in the buffer.
     // The data will be in the buffer after this method is called.
     // Now returns the total bytes read for decryption, use to return void.
-    protected final int ensureALayerDataInBuffer(int desiredDataSize) throws org.apache.derby.client.am.DisconnectException {
+    protected final int ensureALayerDataInBuffer(int desiredDataSize) throws DisconnectException {
         int totalBytesRead = 0;
         // calulate the the number of bytes in the buffer.
         int avail = count_ - pos_;
@@ -215,7 +216,7 @@
         return totalBytesRead;
     }
 
-    protected final void ensureBLayerDataInBuffer(int desiredDataSize) throws org.apache.derby.client.am.DisconnectException {
+    protected final void ensureBLayerDataInBuffer(int desiredDataSize) throws DisconnectException {
         if (dssIsContinued_ && (desiredDataSize > dssLength_)) {
             int continueDssHeaderCount =
                     (((desiredDataSize - dssLength_) / 32767) + 1);
@@ -233,7 +234,7 @@
     // big stuff returned from the server (qrydta's for example) by
     // copying out the data into some other storage.  any extended dss header
     // info will be removed in the copying process.
-    private final void compressBLayerData(int continueDssHeaderCount) throws org.apache.derby.client.am.DisconnectException {
+    private final void compressBLayerData(int continueDssHeaderCount) throws DisconnectException {
         int tempPos = 0;
 
         // jump to the last continuation header.
@@ -309,7 +310,7 @@
         dssLength_ = dssLength_ + newDssLength;
     }
 
-    protected final void readDssHeader() throws org.apache.derby.client.am.DisconnectException {
+    protected final void readDssHeader() throws DisconnectException {
         int correlationID = 0;
         int nextCorrelationID = 0;
         ensureALayerDataInBuffer(6);
@@ -397,7 +398,7 @@
     }
 
 
-    private final void decryptData(int gdsFormatter, int oldDssLength) throws org.apache.derby.client.am.DisconnectException {
+    private final void decryptData(int gdsFormatter, int oldDssLength) throws DisconnectException {
         boolean readHeader;
 
         if (dssLength_ == 32761) {
@@ -572,7 +573,7 @@
     }
 
 
-    final int readUnsignedShort() throws org.apache.derby.client.am.DisconnectException {
+    final int readUnsignedShort() throws DisconnectException {
         // should we be checking dss lengths and ddmScalarLengths here
         // if yes, i am not sure this is the correct place if we should be checking
         ensureBLayerDataInBuffer(2);
@@ -581,7 +582,7 @@
                 ((buffer_[pos_++] & 0xff) << 0);
     }
 
-    final short readShort() throws org.apache.derby.client.am.DisconnectException {
+    final short readShort() throws DisconnectException {
         // should we be checking dss lengths and ddmScalarLengths here
         ensureBLayerDataInBuffer(2);
         adjustLengths(2);
@@ -592,7 +593,7 @@
         return s;
     }
 
-    final int readInt() throws org.apache.derby.client.am.DisconnectException {
+    final int readInt() throws DisconnectException {
         // should we be checking dss lengths and ddmScalarLengths here
         ensureBLayerDataInBuffer(4);
         adjustLengths(4);
@@ -602,7 +603,7 @@
         return i;
     }
 
-    final void readIntArray(int[] array) throws org.apache.derby.client.am.DisconnectException {
+    final void readIntArray(int[] array) throws DisconnectException {
         ensureBLayerDataInBuffer(array.length * 4);
         adjustLengths(array.length * 4);
 
@@ -613,7 +614,7 @@
     }
 
 
-    final long readLong() throws org.apache.derby.client.am.DisconnectException {
+    final long readLong() throws DisconnectException {
         // should we be checking dss lengths and ddmScalarLengths here
         ensureBLayerDataInBuffer(8);
         adjustLengths(8);
@@ -625,7 +626,7 @@
     }
 
 
-    final int[] readUnsignedShortList() throws org.apache.derby.client.am.DisconnectException {
+    final int[] readUnsignedShortList() throws DisconnectException {
         int len = ddmScalarLen_;
         ensureBLayerDataInBuffer(len);
         adjustLengths(len);
@@ -641,25 +642,25 @@
         return list;
     }
 
-    final int readUnsignedByte() throws org.apache.derby.client.am.DisconnectException {
+    final int readUnsignedByte() throws DisconnectException {
         ensureBLayerDataInBuffer(1);
         adjustLengths(1);
         return (buffer_[pos_++] & 0xff);
     }
 
-    final byte readByte() throws org.apache.derby.client.am.DisconnectException {
+    final byte readByte() throws DisconnectException {
         ensureBLayerDataInBuffer(1);
         adjustLengths(1);
         return (byte) (buffer_[pos_++] & 0xff);
     }
 
-    final boolean readBoolean() throws org.apache.derby.client.am.DisconnectException {
+    final boolean readBoolean() throws DisconnectException {
         ensureBLayerDataInBuffer(1);
         adjustLengths(1);
         return buffer_[pos_++] != 0;
     }
 
-    final String readString(int length) throws org.apache.derby.client.am.DisconnectException {
+    final String readString(int length) throws DisconnectException {
         ensureBLayerDataInBuffer(length);
         adjustLengths(length);
 
@@ -668,7 +669,7 @@
         return result;
     }
 
-    final String readString(int length, String encoding) throws org.apache.derby.client.am.DisconnectException {
+    final String readString(int length, String encoding) throws DisconnectException {
         ensureBLayerDataInBuffer(length);
         adjustLengths(length);
         String s = null;
@@ -676,16 +677,17 @@
         try {
             s = new String(buffer_, pos_, length, encoding);
         } catch (java.io.UnsupportedEncodingException e) {
-            agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(e,
-                    agent_,
-                    "encoding not supported!!"));
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_,
+                    new ClientMessageId(SQLState.NET_ENCODING_NOT_SUPPORTED), 
+                    e));
         }
 
         pos_ += length;
         return s;
     }
 
-    final String readString() throws org.apache.derby.client.am.DisconnectException {
+    final String readString() throws DisconnectException {
         int len = ddmScalarLen_;
         ensureBLayerDataInBuffer(len);
         adjustLengths(len);
@@ -694,7 +696,7 @@
         return result;
     }
 
-    final byte[] readBytes(int length) throws org.apache.derby.client.am.DisconnectException {
+    final byte[] readBytes(int length) throws DisconnectException {
         ensureBLayerDataInBuffer(length);
         adjustLengths(length);
 
@@ -704,7 +706,7 @@
         return b;
     }
 
-    final byte[] readBytes() throws org.apache.derby.client.am.DisconnectException {
+    final byte[] readBytes() throws DisconnectException {
         int len = ddmScalarLen_;
         ensureBLayerDataInBuffer(len);
         adjustLengths(len);
@@ -715,7 +717,7 @@
         return b;
     }
 
-    final byte[] readLDBytes() throws org.apache.derby.client.am.DisconnectException {
+    final byte[] readLDBytes() throws DisconnectException {
         ensureBLayerDataInBuffer(2);
         int len = ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0);
 
@@ -733,13 +735,13 @@
         return b;
     }
 
-    final void skipBytes(int length) throws org.apache.derby.client.am.DisconnectException {
+    final void skipBytes(int length) throws DisconnectException {
         ensureBLayerDataInBuffer(length);
         adjustLengths(length);
         pos_ += length;
     }
 
-    final void skipBytes() throws org.apache.derby.client.am.DisconnectException {
+    final void skipBytes() throws DisconnectException {
         int len = ddmScalarLen_;
         ensureBLayerDataInBuffer(len);
         adjustLengths(len);
@@ -748,7 +750,7 @@
 
     // This will be the new and improved getData that handles all QRYDTA/EXTDTA
     // Returns the stream so that the caller can cache it
-    final ByteArrayOutputStream getData(ByteArrayOutputStream existingBuffer) throws org.apache.derby.client.am.DisconnectException {
+    final ByteArrayOutputStream getData(ByteArrayOutputStream existingBuffer) throws DisconnectException {
         boolean readHeader;
         int copySize;
         ByteArrayOutputStream baos;
@@ -800,7 +802,7 @@
     // post:   dssIsContinued_ is set to true if the continuation bit is on, false otherwise
     //         dssLength_ is set to DssConstants.MAX_DSS_LEN - 2 (don't count the header for the next read)
     // helper method for getEXTDTAData
-    protected final void readDSSContinuationHeader() throws org.apache.derby.client.am.DisconnectException {
+    protected final void readDSSContinuationHeader() throws DisconnectException {
         ensureALayerDataInBuffer(2);
 
         dssLength_ =
@@ -942,13 +944,13 @@
     //      The command or statement cannot be processed.  The current
     //          transaction is rolled back and the application is disconnected
     //          from the remote database.
-    final void doSyntaxrmSemantics(int syntaxErrorCode) throws org.apache.derby.client.am.DisconnectException {
-        agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(agent_,
-                "Execution failed due to a distribution protocol error " +
-                "that caused deallocation of the conversation.  " +
-                "A PROTOCOL Data Stream Syntax Error was detected.  Reason: " +
-                "0x" + Integer.toHexString(syntaxErrorCode),
-                SqlState._58009));
+    final void doSyntaxrmSemantics(int syntaxErrorCode) throws DisconnectException {
+        agent_.accumulateChainBreakingReadExceptionAndThrow(
+            new DisconnectException(agent_,
+                new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED),
+                SqlException.getMessageUtil().getTextMessage(
+                    MessageId.CONN_DRDA_DATASTREAM_SYNTAX_ERROR,
+                    new Integer(syntaxErrorCode))));
     }
 
 
@@ -987,7 +989,7 @@
         topDdmCollectionStack_--;
     }
 
-    protected final int peekCodePoint() throws org.apache.derby.client.am.DisconnectException {
+    protected final int peekCodePoint() throws DisconnectException {
         if (topDdmCollectionStack_ != EMPTY_STACK) {
             if (ddmCollectionLenStack_[topDdmCollectionStack_] == 0) {
                 return END_OF_COLLECTION;
@@ -1022,7 +1024,7 @@
     }
 
     // Read out the 2-byte length without moving the pos_ pointer.
-    protected final int peekLength() throws org.apache.derby.client.am.DisconnectException {
+    protected final int peekLength() throws DisconnectException {
         ensureBLayerDataInBuffer(2);
         return (((buffer_[pos_] & 0xff) << 8) +
                 ((buffer_[pos_ + 1] & 0xff) << 0));
@@ -1030,14 +1032,14 @@
 
     // Read "length" number of bytes from the buffer into the byte array b starting from offset
     // "offset".  The current offset in the buffer does not change.
-    protected final int peekFastBytes(byte[] b, int offset, int length) throws org.apache.derby.client.am.DisconnectException {
+    protected final int peekFastBytes(byte[] b, int offset, int length) throws DisconnectException {
         for (int i = 0; i < length; i++) {
             b[offset + i] = buffer_[pos_ + i];
         }
         return offset + length;
     }
 
-    protected final void parseLengthAndMatchCodePoint(int expectedCodePoint) throws org.apache.derby.client.am.DisconnectException {
+    protected final void parseLengthAndMatchCodePoint(int expectedCodePoint) throws DisconnectException {
         int actualCodePoint = 0;
         if (peekedCodePoint_ == END_OF_COLLECTION) {
             actualCodePoint = readLengthAndCodePoint();
@@ -1056,17 +1058,22 @@
         }
 
         if (actualCodePoint != expectedCodePoint) {
-            zThrowSyntaxError("actual code point, " + actualCodePoint +
-                    " does not match expected code point, " + expectedCodePoint);
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_, 
+                    new ClientMessageId(SQLState.NET_NOT_EXPECTED_CODEPOINT), 
+                    new Integer(actualCodePoint), 
+                    new Integer(expectedCodePoint)));
         }
     }
 
-    protected final int readLengthAndCodePoint() throws org.apache.derby.client.am.DisconnectException {
+    protected final int readLengthAndCodePoint() throws DisconnectException {
         if (topDdmCollectionStack_ != EMPTY_STACK) {
             if (ddmCollectionLenStack_[topDdmCollectionStack_] == 0) {
                 return END_OF_COLLECTION;
             } else if (ddmCollectionLenStack_[topDdmCollectionStack_] < 4) {
-                zThrowSyntaxError("ddm collection contains less than 4 bytes of data");
+                agent_.accumulateChainBreakingReadExceptionAndThrow(
+                    new DisconnectException(agent_, 
+                    new ClientMessageId(SQLState.NET_DDM_COLLECTION_TOO_SMALL)));
             }
         }
 
@@ -1094,7 +1101,7 @@
         return codePoint;
     }
 
-    private final void readExtendedLength() throws org.apache.derby.client.am.DisconnectException {
+    private final void readExtendedLength() throws DisconnectException {
         int numberOfExtendedLenBytes = (ddmScalarLen_ - 0x8000); // fix scroll problem was - 4
         int adjustSize = 0;
         switch (numberOfExtendedLenBytes) {
@@ -1135,31 +1142,33 @@
         dssLength_ -= length;
     }
 
-    protected final void startSameIdChainParse() throws org.apache.derby.client.am.DisconnectException {
+    protected final void startSameIdChainParse() throws DisconnectException {
         readDssHeader();
         netAgent_.clearSvrcod();
     }
 
-    protected final void endOfSameIdChainData() throws org.apache.derby.client.am.DisconnectException {
+    protected final void endOfSameIdChainData() throws DisconnectException {
         netAgent_.targetTypdef_ = netAgent_.originalTargetTypdef_;
         netAgent_.targetSqlam_ = netAgent_.orignalTargetSqlam_;
 
         if (this.topDdmCollectionStack_ != Reply.EMPTY_STACK) {
-            zThrowSyntaxError("collection stack not empty at end of same id chain parse");
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_, 
+                new ClientMessageId(SQLState.NET_COLLECTION_STACK_NOT_EMPTY)));
         }
         if (this.dssLength_ != 0) {
-            zThrowSyntaxError("dss length not 0 at end of same id chain parse");
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_, 
+                new ClientMessageId(SQLState.NET_DSS_NOT_ZERO)));
         }
         if (dssIsChainedWithSameID_ == true) {
-            zThrowSyntaxError("dss chained with same id at end of same id chain parse");
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_, 
+                new ClientMessageId(SQLState.NET_DSS_CHAINED_WITH_SAME_ID)));
         }
     }
-
-    private final void zThrowSyntaxError(String error) throws org.apache.derby.client.am.DisconnectException {
-        agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(agent_, error));
-    }
-
-    protected final int peekTotalColumnCount(int tripletLength) throws org.apache.derby.client.am.DisconnectException {
+    
+    protected final int peekTotalColumnCount(int tripletLength) throws DisconnectException {
         int columnCount = 0;
         int offset = 0;
         int tripletType = FdocaConstants.CPT_TRIPLET_TYPE;
@@ -1177,7 +1186,7 @@
         return columnCount;
     }
 
-    private final void peekExtendedLength() throws org.apache.derby.client.am.DisconnectException {
+    private final void peekExtendedLength() throws DisconnectException {
         peekedNumOfExtendedLenBytes_ = (peekedLength_ - 0x8004);
         switch (peekedNumOfExtendedLenBytes_) {
         case 4:
@@ -1208,71 +1217,72 @@
         }
     }
 
-    final int readFastUnsignedByte() throws org.apache.derby.client.am.DisconnectException {
+    final int readFastUnsignedByte() throws DisconnectException {
         return (buffer_[pos_++] & 0xff);
     }
 
-    final short readFastShort() throws org.apache.derby.client.am.DisconnectException {
+    final short readFastShort() throws DisconnectException {
         short s = SignedBinary.getShort(buffer_, pos_);
         pos_ += 2;
         return s;
     }
 
-    final int readFastUnsignedShort() throws org.apache.derby.client.am.DisconnectException {
+    final int readFastUnsignedShort() throws DisconnectException {
         return ((buffer_[pos_++] & 0xff) << 8) +
                 ((buffer_[pos_++] & 0xff) << 0);
     }
 
-    final int readFastInt() throws org.apache.derby.client.am.DisconnectException {
+    final int readFastInt() throws DisconnectException {
         int i = SignedBinary.getInt(buffer_, pos_);
         pos_ += 4;
         return i;
     }
 
-    final String readFastString(int length) throws org.apache.derby.client.am.DisconnectException {
+    final String readFastString(int length) throws DisconnectException {
         String result = ccsidManager_.convertToUCS2(buffer_, pos_, length);
         pos_ += length;
         return result;
     }
 
-    final byte[] readFastBytes(int length) throws org.apache.derby.client.am.DisconnectException {
+    final byte[] readFastBytes(int length) throws DisconnectException {
         byte[] b = new byte[length];
         System.arraycopy(buffer_, pos_, b, 0, length);
         pos_ += length;
         return b;
     }
 
-    protected final int peekFastLength() throws org.apache.derby.client.am.DisconnectException {
+    protected final int peekFastLength() throws DisconnectException {
         return (((buffer_[pos_] & 0xff) << 8) +
                 ((buffer_[pos_ + 1] & 0xff) << 0));
     }
 
-    final void skipFastBytes(int length) throws org.apache.derby.client.am.DisconnectException {
+    final void skipFastBytes(int length) throws DisconnectException {
         pos_ += length;
     }
 
-    final void readFastIntArray(int[] array) throws org.apache.derby.client.am.DisconnectException {
+    final void readFastIntArray(int[] array) throws DisconnectException {
         for (int i = 0; i < array.length; i++) {
             array[i] = SignedBinary.getInt(buffer_, pos_);
             pos_ += 4;
         }
     }
 
-    final String readFastString(int length, String encoding) throws org.apache.derby.client.am.DisconnectException {
+    final String readFastString(int length, String encoding) throws DisconnectException {
         String s = null;
 
         try {
             s = new String(buffer_, pos_, length, encoding);
         } catch (java.io.UnsupportedEncodingException e) {
-            agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(e,
-                    agent_,
-                    "encoding not supported!!"));
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_,
+                    new ClientMessageId(SQLState.NET_ENCODING_NOT_SUPPORTED),
+                    e));
         }
         pos_ += length;
         return s;
     }
 
-    final byte[] readFastLDBytes() throws org.apache.derby.client.am.DisconnectException {
+    final byte[] readFastLDBytes() throws DisconnectException {
         int len = ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0);
         if (len == 0) {
             return null;
@@ -1284,13 +1294,13 @@
         return b;
     }
 
-    final long readFastLong() throws org.apache.derby.client.am.DisconnectException {
+    final long readFastLong() throws DisconnectException {
         long l = SignedBinary.getLong(buffer_, pos_);
         pos_ += 8;
         return l;
     }
 
-    final byte readFastByte() throws org.apache.derby.client.am.DisconnectException {
+    final byte readFastByte() throws DisconnectException {
         return (byte) (buffer_[pos_++] & 0xff);
     }
 
@@ -1309,7 +1319,7 @@
 
     // The only difference between this method and the original getData() method is this method
     // is not doing an ensureALayerDataInBuffer
-    final ByteArrayOutputStream getFastData(ByteArrayOutputStream existingBuffer) throws org.apache.derby.client.am.DisconnectException {
+    final ByteArrayOutputStream getFastData(ByteArrayOutputStream existingBuffer) throws DisconnectException {
         boolean readHeader;
         int copySize;
         ByteArrayOutputStream baos;
@@ -1358,18 +1368,21 @@
 
     // This method is only used to match the codePoint for those class instance variables
     // that are embedded in other reply messages.
-    final protected void matchCodePoint(int expectedCodePoint) throws org.apache.derby.client.am.DisconnectException {
+    final protected void matchCodePoint(int expectedCodePoint) throws DisconnectException {
         int actualCodePoint = 0;
         actualCodePoint = peekedCodePoint_;
         pos_ += 4;
         if (actualCodePoint != expectedCodePoint) {
-            zThrowSyntaxError("actual code point, " + actualCodePoint +
-                    " does not match expected code point, " + expectedCodePoint);
+            agent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(agent_, 
+                    new ClientMessageId(SQLState.NET_NOT_EXPECTED_CODEPOINT), 
+                    new Integer(actualCodePoint), 
+                    new Integer(expectedCodePoint)));
         }
     }
 
 
-    protected final int peekNumOfColumns() throws org.apache.derby.client.am.DisconnectException {
+    protected final int peekNumOfColumns() throws DisconnectException {
         // skip the 4-byte LLCP and any extended length bytes + 1-byte null sqlcagrp null indicator
         int offset = (4 + peekedNumOfExtendedLenBytes_ + 1);
 
@@ -1385,7 +1398,7 @@
         return (nullInd == CodePoint.NULLDATA);
     }
 
-    private final int skipSQLDHROW(int offset) throws org.apache.derby.client.am.DisconnectException {
+    private final int skipSQLDHROW(int offset) throws DisconnectException {
         int sqldhrowgrpNullInd = buffer_[pos_ + offset++] & 0xff;
         if (sqldhrowgrpNullInd == CodePoint.NULLDATA) {
             return offset;

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java Thu May 25 13:26:26 2006
@@ -264,10 +264,8 @@
                     padScalarStreamForError(leftToRead, bytesToRead);
                     // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
                     netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                            "Encountered an IOException reading InputStream, parameter #" +
-                            parameterIndex +
-                            ".  Remaining data has been padded with 0x0. Message: " +
-                            e.getMessage()));
+                        new ClientMessageId(SQLState.NET_IOEXCEPTION_ON_READ),
+                        new Integer(parameterIndex), e.getMessage(), e));
                     return;
                 }
                 if (bytesRead == -1) {
@@ -281,10 +279,10 @@
                     //pad it with 0 and encrypt and send it to the server because it takes too much time
                     //can't just throw a SQLException either because some of the data PRPSQLSTT etc have already
                     //been sent to the server, and server is waiting for EXTDTA, server hangs for this.
-                    netAgent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(netAgent_,
-                            "End of Stream prematurely reached while reading InputStream, parameter #" +
-                            parameterIndex +
-                            ". "));
+                    netAgent_.accumulateChainBreakingReadExceptionAndThrow(
+                        new DisconnectException(netAgent_,
+                            new ClientMessageId(SQLState.NET_PREMATURE_EOS_DISCONNECT),
+                            new Integer(parameterIndex)));
                     return;
 
                     /*netAgent_.accumulateReadException(
@@ -305,16 +303,19 @@
             try {
                 if (in.read() != -1) {
                     // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                    netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                            "The specified size of the InputStream, parameter #" +
-                            parameterIndex +
-                            ", is less than the actual InputStream length"));
+                    netAgent_.accumulateReadException(new SqlException(
+                        netAgent_.logWriter_,
+                        new ClientMessageId(SQLState.NET_INPUTSTREAM_LENGTH_TOO_SMALL),
+                        new Integer(parameterIndex)));
                 }
             } catch (java.io.IOException e) {
-                netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                        "Encountered error in stream length verification for InputStream, parameter #" +
-                        parameterIndex +
-                        ".  Message: " + e.getMessage()));
+                netAgent_.accumulateReadException(new SqlException(
+                    netAgent_.logWriter_,
+                    new ClientMessageId(
+                        SQLState.NET_IOEXCEPTION_ON_STREAMLEN_VERIFICATION),
+                    new Integer(parameterIndex), 
+                    e.getMessage(), 
+                    e));
             }
 
             byte[] newClearedBytes = new byte[clearedBytes.length +
@@ -393,17 +394,21 @@
                     } catch (java.io.IOException e) {
                         padScalarStreamForError(leftToRead, bytesToRead);
                         // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                        netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                                "Encountered an IOException reading InputStream, parameter #" + parameterIndex +
-                                ".  Remaining data has been padded with 0x0. Message: " + e.getMessage()));
+                        netAgent_.accumulateReadException(new SqlException(
+                            netAgent_.logWriter_,
+                            new ClientMessageId(SQLState.NET_IOEXCEPTION_ON_READ),
+                            new Integer(parameterIndex),
+                            e.getMessage(),
+                            e));
+
                         return;
                     }
                     if (bytesRead == -1) {
                         padScalarStreamForError(leftToRead, bytesToRead);
                         // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
                         netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                                "End of Stream prematurely reached while reading InputStream, parameter #" + parameterIndex +
-                                ".  Remaining data has been padded with 0x0."));
+                            new ClientMessageId(SQLState.NET_PREMATURE_EOS),
+                            new Integer(parameterIndex)));
                         return;
                     } else {
                         bytesToRead -= bytesRead;
@@ -420,13 +425,17 @@
                 if (in.read() != -1) {
                     // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
                     netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                            "The specified size of the InputStream, parameter #" + parameterIndex +
-                            ", is less than the actual InputStream length"));
+                        new ClientMessageId(SQLState.NET_INPUTSTREAM_LENGTH_TOO_SMALL),
+                        new Integer(parameterIndex)));
                 }
             } catch (java.io.IOException e) {
-                netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                        "Encountered error in stream length verification for InputStream, parameter #" + parameterIndex +
-                        ".  Message: " + e.getMessage()));
+                netAgent_.accumulateReadException(new SqlException(
+                    netAgent_.logWriter_,
+                    new ClientMessageId(
+                        SQLState.NET_IOEXCEPTION_ON_STREAMLEN_VERIFICATION),
+                    new Integer(parameterIndex),
+                    e.getMessage(),
+                    e));
             }
 
         }
@@ -488,20 +497,24 @@
                         } catch (java.io.IOException e) {
                             padScalarStreamForError(leftToRead, bytesToRead);
                             // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                            netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                                    "Encountered an IOException reading Reader, parameter #" +
-                                    parameterIndex +
-                                    ".  Remaining data has been padded with 0x0. Message: " +
-                                    e.getMessage()));
+                            netAgent_.accumulateReadException(new SqlException(
+                                netAgent_.logWriter_,
+                                new ClientMessageId(
+                                    SQLState.NET_IOEXCEPTION_ON_READ),
+                                new Integer(parameterIndex),
+                                e.getMessage(),
+                                e));
+
                             return;
                         }
                         if (charsRead == -1) {
                             padScalarStreamForError(leftToRead, bytesToRead);
                             // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                            netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                                    "End of Stream prematurely reached while reading Reader, parameter #" +
-                                    parameterIndex +
-                                    ".  Remaining data has been padded with 0x0."));
+                            netAgent_.accumulateReadException(new SqlException(
+                                netAgent_.logWriter_,
+                                new ClientMessageId(SQLState.NET_PREMATURE_EOS),
+                                new Integer(parameterIndex)));
+
                             return;
                         }
                         // set first half-char in buffer and save the other half for later
@@ -518,21 +531,25 @@
                         } catch (java.io.IOException e) {
                             padScalarStreamForError(leftToRead, bytesToRead);
                             // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                            netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_, e,
-                                    "Encountered an IOException reading Reader, parameter #" +
-                                    parameterIndex +
-                                    ".  Remaining data has been padded with 0x0. Message: " +
-                                    e.getMessage()));
+                            netAgent_.accumulateReadException(new SqlException(
+                                netAgent_.logWriter_,
+                                new ClientMessageId(
+                                    SQLState.NET_IOEXCEPTION_ON_READ),
+                                new Integer(parameterIndex),
+                                e.getMessage(),
+                                e));
+
                             return;
                         }
 
                         if (charsRead == -1) {
                             padScalarStreamForError(leftToRead, bytesToRead);
                             // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                            netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                                    "End of Stream prematurely reached while reading Reader, parameter #" +
-                                    parameterIndex +
-                                    ".  Remaining data has been padded with 0x0."));
+                            netAgent_.accumulateReadException(new SqlException(
+                                netAgent_.logWriter_,
+                                new ClientMessageId(SQLState.NET_PREMATURE_EOS),
+                                new Integer(parameterIndex)));
+
                             return;
                         }
                         for (int i = 0; i < charsRead; i++) {
@@ -551,15 +568,19 @@
             // check to make sure that the specified length wasn't too small
             try {
                 if (r.read() != -1) {
-                    netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                            "The specified size of the Reader, parameter #" +
-                            parameterIndex +
-                            ", is less than the actual InputStream length"));
+                    netAgent_.accumulateReadException(new SqlException(
+                        netAgent_.logWriter_,
+                        new ClientMessageId(SQLState.NET_READER_LENGTH_TOO_SMALL),
+                        new Integer(parameterIndex)));
                 }
             } catch (java.io.IOException e) {
-                netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_, e,
-                        "Encountered error in stream length verification for Reader, parameter #" +
-                        parameterIndex + ".  Message: " + e.getMessage()));
+                netAgent_.accumulateReadException(new SqlException(
+                    netAgent_.logWriter_,
+                    new ClientMessageId(
+                        SQLState.NET_IOEXCEPTION_ON_STREAMLEN_VERIFICATION),
+                    new Integer(parameterIndex),
+                    e.getMessage(),
+                    e));
             }
         } else {  //data stream encryption
 
@@ -586,21 +607,24 @@
                 } catch (java.io.IOException e) {
                     padScalarStreamForError(leftToRead, bytesToRead);
                     // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                    netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_, e,
-                            "Encountered an IOException reading Reader, parameter #" +
-                            parameterIndex +
-                            ".  Remaining data has been padded with 0x0. Message: " +
-                            e.getMessage()));
+                    netAgent_.accumulateReadException(new SqlException(
+                        netAgent_.logWriter_, 
+                        new ClientMessageId(SQLState.NET_IOEXCEPTION_ON_READ),
+                        new Integer(parameterIndex),
+                        e.getMessage(),
+                        e));
+
                     return;
                 }
 
                 if (charsRead == -1) {
                     padScalarStreamForError(leftToRead, bytesToRead);
                     // set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
-                    netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                            "End of Stream prematurely reached while reading Reader, parameter #" +
-                            parameterIndex +
-                            ".  Remaining data has been padded with 0x0."));
+                    netAgent_.accumulateReadException(new SqlException(
+                        netAgent_.logWriter_,
+                        new ClientMessageId(SQLState.NET_PREMATURE_EOS),
+                        new Integer(parameterIndex)));
+
                     return;
                 }
                 for (int i = 0; i < charsRead; i++) {
@@ -615,15 +639,19 @@
             // check to make sure that the specified length wasn't too small
             try {
                 if (r.read() != -1) {
-                    netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
-                            "The specified size of the Reader, parameter #" +
-                            parameterIndex +
-                            ", is less than the actual InputStream length"));
+                    netAgent_.accumulateReadException(new SqlException(
+                        netAgent_.logWriter_,
+                        new ClientMessageId(SQLState.NET_READER_LENGTH_TOO_SMALL),
+                        new Integer(parameterIndex)));
                 }
             } catch (java.io.IOException e) {
-                netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_, e,
-                        "Encountered error in stream length verification for Reader, parameter #" +
-                        parameterIndex + ".  Message: " + e.getMessage()));
+                netAgent_.accumulateReadException(new SqlException(
+                    netAgent_.logWriter_, 
+                    new ClientMessageId(
+                        SQLState.NET_IOEXCEPTION_ON_STREAMLEN_VERIFICATION),
+                    new Integer(parameterIndex),
+                    e.getMessage(),
+                    e));
             }
 
             byte[] newClearedBytes = new byte[clearedBytes.length +
@@ -1561,12 +1589,15 @@
         byte[] b;
         try {
             b = s.getBytes(encoding);
-        } catch (java.io.UnsupportedEncodingException e) {
-            throw new SqlException(netAgent_.logWriter_, e,
-                    "Unsupported encoding " + e.getMessage() + ". See attached Throwable.");
+        } catch (UnsupportedEncodingException e) {
+            throw new SqlException(netAgent_.logWriter_,  
+                    new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),
+                    "String", "byte", e);
         }
         if (b.length > 0x7FFF) {
-            throw new SqlException(netAgent_.logWriter_, "string exceed maximum length 32767");
+            throw new SqlException(netAgent_.logWriter_, 
+                new ClientMessageId(SQLState.LANG_STRING_TOO_LONG),
+                "32767");
         }
         ensureLength(offset_ + b.length + 2);
         writeLDBytesX(b.length, b);

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java Thu May 25 13:26:26 2006
@@ -25,6 +25,8 @@
 import org.apache.derby.client.am.Cursor;
 import org.apache.derby.client.am.DisconnectException;
 import org.apache.derby.client.am.SignedBinary;
+import org.apache.derby.client.am.ClientMessageId;
+import org.apache.derby.shared.common.reference.SQLState;
 
 //
 //  General Notes
@@ -1078,8 +1080,9 @@
         }
 
         if (sda == null) {
-            netAgent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(netAgent_,
-                    "Invalid FDOCA LID"));
+            netAgent_.accumulateChainBreakingReadExceptionAndThrow(
+                new DisconnectException(netAgent_,
+                    new ClientMessageId(SQLState.NET_INVALID_FDOCA_ID)));
         }
 
         // 2. Set Null indicator based on PROTOCOL Type.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties Thu May 25 13:26:26 2006
@@ -263,10 +263,29 @@
 2D521.S.1=setAutoCommit(true) invalid during global transaction.
 2D521.S.2=COMMIT or ROLLBACK invalid for application execution environment. 
 24501.S=The identified cursor is not open.
-# 58009 is a generic message
+# 58009.C is a generic message
 # MAKE SURE YOU INTERNATIONALIZE THE REASON STRING AS WELL - Use the JXXX 
 # codes below.  Add constants for the JXXX codes in reference.MessageId.java
 58009.C=A network protocol error was encountered and the connection has been terminated: {0}
+58009.C.2=SocketException: ''{0}''
+58009.C.3=A communications error has been detected: {0}.
+58009.C.4=An error occurred during a deferred connect reset and the connection has been terminated.  See chained exceptions for details.
+58009.C.5=Insufficient data while reading from the network - expected a minimum of {0} bytes and received only {1} bytes.  The connection has been terminated.
+58009.C.6=Attempt to fully materialize lob data that is too large for the JVM.  The connection has been terminated.
+58009.C.7=Network protocol exception: scldta length, {0}, is invalid for rdbcolid.  The connection has been terminated.
+58009.C.8=Network protocol exception: scldta length, {0}, is invalid for pkgid.  The connection has been terminated.
+58009.C.9=Network protocol exception: PKGNAMCSN length, {0}, is invalid at SQLAM {1}.  The connection has been terminated.
+58009.C.10=Network protocol exception: only one of the VCM, VCS length can be greater than 0.  The connection has been terminated.
+58009.C.11=The connection was terminated because the encoding is not supported.
+58009.C.12=Network protocol exception: actual code point, {0}, does not match expected code point, {1}.  The connection has been terminated.
+58009.C.13=Network protocol exception: DDM collection contains less than 4 bytes of data.  The connection has been terminated.
+58009.C.14=Network protocol exception: collection stack not empty at end of same id chain parse.  The connection has been terminated.
+58009.C.15=Network protocol exception: DSS length not 0 at end of same id chain parse.  The connection has been terminated.
+58009.C.16=Network protocol exception: DSS chained with same id at end of same id chain parse.  The connection has been terminated.
+58009.C.17=Network protocol exception: end of stream prematurely reached while reading InputStream, parameter #{0}.  The connection has been terminated.
+58009.C.18=Network protocol exceptoin: invalid FDOCA LID.  The connection has been terminated.
+
+
 58010.C=A network protocol error was encountered.  A connection could not be established because the manager {0} at level {1} is not supported by the server. 
 58014.C=The DDM command 0x{0} is not supported.  The connection has been terminated.
 58015.C=The DDM object 0x{0} is not supported.  The connection has been terminated.
@@ -412,6 +431,7 @@
 22019=Invalid escape sequence, ''{0}''. The escape string must be exactly one character. It cannot be a null or more than one character.
 22025=Escape character must be followed by escape character, '_', or '%'. It cannot be followed by any other character or be at the end of the pattern.
 22027=The built-in TRIM() function only supports a single trim character.  The LTRIM() and RTRIM() built-in functions support multiple trim characters.
+22028=The string exceeds the maximum length of {0}.
 22501=An ESCAPE clause of NULL returns undefined results and is not allowed.
 2200L=XMLPARSE operand is not an XML document; see next exception for details.
 23502=Column ''{0}''  cannot accept a NULL value.
@@ -1232,9 +1252,11 @@
 XN011.S=Procedure name length {0} is not within the valid range of 1 to {1}.
 XN012.S=On {0} platforms, XA supports version {1} and above, this is version {2}
 XN013.S=Invalid scroll orientation.
-
-
-
+XN014.S=Network protocol error: encountered an IOException, parameter #{0}.  Remaining data has been padded with 0x0. Message: {1}.
+XN015.S=Network protocol error: the specified size of the InputStream, parameter #{0}, is less than the actual InputStream length.
+XN016.S=Network protocol error: encountered error in stream length verification, parameter #{0}.  Message: {1}.
+XN017.S=Network protocol error: end of stream prematurely reached, parameter #{0}.  Remaining data has been padded with 0x0.
+XN018.S=Network protocol error: the specified size of the Reader, parameter #{0}, is less than the actual InputStream length.
 
 # 0A - SQLState class indicating feature not supported
 0A000.S=Feature not implemented: {0}.
@@ -1437,7 +1459,7 @@
 J128=the cursor is not open
 J129=an Open Query command was issued for a query which was already open
 J130=A PROTOCOL Invalid FDOCA Description Error was detected
-J140=A PROTOCOL Data Stream Syntax Error was detected.  Reason: 0x{0}.
+J131=A PROTOCOL Data Stream Syntax Error was detected.  Reason: 0x{0}.
 
 
 # Authentication

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=409459&r1=409458&r2=409459&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 Thu May 25 13:26:26 2006
@@ -690,6 +690,7 @@
 	String LANG_INVALID_ESCAPE_CHARACTER                               = "22019";
 	String LANG_INVALID_ESCAPE_SEQUENCE                                = "22025";
 	String LANG_INVALID_TRIM_SET                                       = "22027";
+    String LANG_STRING_TOO_LONG                                        = "22028";
 	String LANG_ESCAPE_IS_NULL                                  	   = "22501";
 
 
@@ -1526,6 +1527,11 @@
     String NET_PROCEDURE_NAME_LENGTH_OUT_OF_RANGE                   = "XN011.S";
     String NET_WRONG_XA_VERSION                                     = "XN012.S";
     String NET_INVALID_SCROLL_ORIENTATION                           = "XN013.S";
+    String NET_IOEXCEPTION_ON_READ                                  = "XN014.S";
+    String NET_INPUTSTREAM_LENGTH_TOO_SMALL                         = "XN015.S";
+    String NET_IOEXCEPTION_ON_STREAMLEN_VERIFICATION                = "XN016.S";
+    String NET_PREMATURE_EOS                                        = "XN017.S";
+    String NET_READER_LENGTH_TOO_SMALL                              = "XN018.S";
     
     // Used by server for scrollable updatable insensitive result sets
     // to transmit updated state to client. Internal, not seen by user.
@@ -1571,20 +1577,6 @@
     
     // 08006 means connection exception - connection failure
     String CONNECTION_FAILED_ON_RESET                           = "08006.C.1";
-    // Use this version of SOCKET_EXCEPTION any time *except* when trying to
-    // establish a connection, as the SQLState is different.  When trying
-    // to establish a connection, use CONNECT_SOCKET_EXCEPTION.
-    String SOCKET_EXCEPTION                                     = "08006.C.2";
-    String COMMUNICATION_ERROR                                  = "08006.C.3";
-    String CONNECTION_FAILED_ON_DEFERRED_RESET                  = "08006.C.4";
-    String NET_INSUFFICIENT_DATA                                = "08006.C.5";
-    String NET_LOB_DATA_TOO_LARGE_FOR_JVM                       = "08006.C.6";
-    String NET_SQLCDTA_INVALID_FOR_RDBCOLID                     = "08006.C.7";
-    String NET_SQLCDTA_INVALID_FOR_PKGID                        = "08006.C.8";
-    String NET_PGNAMCSN_INVALID_AT_SQLAM                        = "08006.C.9";
-    String NET_VCM_VCS_LENGTHS_INVALID                          = "08006.C.10";
-    String NET_ENCODING_NOT_SUPPORTED                           = "08006.C.11";
-
 
     
     // 08001 is specifically about the SQL client not being able to establish
@@ -1654,7 +1646,38 @@
     String DRDA_NO_AUTOCOMMIT_UNDER_XA                              = "2D521.S.1";
     String DRDA_INVALID_XA_STATE_ON_COMMIT_OR_ROLLBACK              = "2D521.S.2"; 
     String DRDA_CURSOR_NOT_OPEN                                     = "24501.S";
+
+    // 58009 means connection is terminated.  This can be caused by any number
+    // of reasons, so this SQL State has a lot of instances.
+    // 
+    // NOTE: if the disconnection is not caused by DRDA-level error, you should
+    // use SQL State 08006.  The way I determined this is if the error occurs
+    // in the 'client.net' package, use 58009.  If it occurs in the 'client.am'
+    // or any other client package, use 08006.  It's really not at all clear
+    // from the specs when you should use one SQL state or the other, but that's
+    // the approach I chose (David Van Couvering).
     String DRDA_CONNECTION_TERMINATED                               = "58009.C";
+    // Use this version of SOCKET_EXCEPTION any time *except* when trying to
+    // establish a connection, as the SQLState is different.  When trying
+    // to establish a connection, use CONNECT_SOCKET_EXCEPTION.
+    String SOCKET_EXCEPTION                                         = "58009.C.2";
+    String COMMUNICATION_ERROR                                      = "58009.C.3";
+    String CONNECTION_FAILED_ON_DEFERRED_RESET                      = "58009.C.4";
+    String NET_INSUFFICIENT_DATA                                    = "58009.C.5";
+    String NET_LOB_DATA_TOO_LARGE_FOR_JVM                           = "58009.C.6";
+    String NET_SQLCDTA_INVALID_FOR_RDBCOLID                         = "58009.C.7";
+    String NET_SQLCDTA_INVALID_FOR_PKGID                            = "58009.C.8";
+    String NET_PGNAMCSN_INVALID_AT_SQLAM                            = "58009.C.9";
+    String NET_VCM_VCS_LENGTHS_INVALID                              = "58009.C.10";
+    String NET_ENCODING_NOT_SUPPORTED                               = "58009.C.11";
+    String NET_NOT_EXPECTED_CODEPOINT                               = "58009.C.12";
+    String NET_DDM_COLLECTION_TOO_SMALL                             = "58009.C.13";
+    String NET_COLLECTION_STACK_NOT_EMPTY                           = "58009.C.14";
+    String NET_DSS_NOT_ZERO                                         = "58009.C.15";
+    String NET_DSS_CHAINED_WITH_SAME_ID                             = "58009.C.16";
+    String NET_PREMATURE_EOS_DISCONNECT                             = "58009.C.17";
+    String NET_INVALID_FDOCA_ID                                     = "58009.C.18";
+
     String DRDA_MGRLVLRM                                            = "58010.C";
     String DRDA_DDM_COMMAND_NOT_SUPPORTED                           = "58014.C";
     String DRDA_DDM_OBJECT_NOT_SUPPORTED                            = "58015.C";

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultsetStream.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultsetStream.out?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultsetStream.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultsetStream.out Thu May 25 13:26:26 2006
@@ -9,8 +9,8 @@
 getColumnCount(): 1
 len=56
 number of reads=56
-EXPECTED SQLSTATE(null): End of Stream prematurely reached while reading InputStream, parameter #2.  Remaining data has been padded with 0x0.
-EXPECTED SQLSTATE(null): The specified size of the InputStream, parameter #2, is less than the actual InputStream length
+EXPECTED SQLSTATE(XN017): Network protocol error: end of stream prematurely reached, parameter #2.  Remaining data has been padded with 0x0.
+EXPECTED SQLSTATE(XN015): Network protocol error: the specified size of the InputStream, parameter #2, is less than the actual InputStream length.
 Test of getAsciiStream
 U+0041U+0042U+0043U+0044U+0045U+0046U+0047U+00c0U+00c1U+00c2U+00c3U+00c4U+00c5U+00ffU+003fU+003fU+003fU+003fU+003fU+003f
 U+0041U+0042U+0043U+0044U+0045U+0046U+0047U+00c0U+00c1U+00c2U+00c3U+00c4U+00c5U+00ffU+0100U+3042U+3044U+3046U+3048U+304a

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SuicideOfStreaming.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SuicideOfStreaming.java?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SuicideOfStreaming.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SuicideOfStreaming.java Thu May 25 13:26:26 2006
@@ -252,7 +252,7 @@
 
     private static boolean examineExpectedInDerbyNetClient( SQLException sqlex ) {
 	return 
-	    sqlex.getSQLState().equals("08006") && 
+	    sqlex.getSQLState().equals("58009") && 
 	    sqlex.getErrorCode() == SqlCode.disconnectError.getCode();
     }
 

Modified: db/derby/code/trunk/tools/testing/i18nTestGenerator/clientPrologue.txt
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/testing/i18nTestGenerator/clientPrologue.txt?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/tools/testing/i18nTestGenerator/clientPrologue.txt (original)
+++ db/derby/code/trunk/tools/testing/i18nTestGenerator/clientPrologue.txt Thu May 25 13:26:26 2006
@@ -2,6 +2,7 @@
 
 import org.apache.derby.client.am.ClientMessageId; 
 import org.apache.derby.client.am.SqlException; 
+import org.apache.derby.client.am.DisconnectException; 
 import org.apache.derby.shared.common.reference.SQLState; 
 import org.apache.derby.client.am.SqlCode;
 import org.apache.derby.shared.common.i18n.MessageUtil;

Modified: db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient1.sed
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient1.sed?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient1.sed (original)
+++ db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient1.sed Thu May 25 13:26:26 2006
@@ -6,3 +6,6 @@
 # Catch situation where the ClientMessageId parameter is on the next line
 /new ClientMessageId[^;]*$/,/);/p
 
+# This is a wrapper used in net/Reply.java that we need to test
+/zThrowSyntaxError[^;]*$/,/);/p
+

Modified: db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient2.sed
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient2.sed?rev=409459&r1=409458&r2=409459&view=diff
==============================================================================
--- db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient2.sed (original)
+++ db/derby/code/trunk/tools/testing/i18nTestGenerator/genClient2.sed Thu May 25 13:26:26 2006
@@ -4,9 +4,9 @@
     try { \
        testException = new SqlException(null,
 
-# For those expressions that start with "new SqlException", pre-append
+# For those expressions that start with "new <something>Exception", pre-append
 # a try block
-/new[[:space:]]*SqlException/i\
+/new[[:space:]]*[a-zA-Z]*Exception/i\
     try {
 
 # At the end of each statement, check and print out an error
@@ -91,6 +91,9 @@
 s/[[:space:]]platform/ "string"/g
 s/parsePKGNAMCT"))/parsePKGNAMCT")/
 s/[[:space:]]identifier/ "string"/g
+s/[[:space:]]arg2))/ "arg2")/g
+s/[[:space:]]arg1/ "string"/g
+s/agent_/ null/g