Index: java/engine/org/apache/derby/impl/jdbc/RawToBinaryFormatStream.java =================================================================== --- java/engine/org/apache/derby/impl/jdbc/RawToBinaryFormatStream.java (revision 290333) +++ java/engine/org/apache/derby/impl/jdbc/RawToBinaryFormatStream.java (working copy) @@ -79,7 +79,7 @@ int remainingBytes = clearLimit(); if (remainingBytes > 0) - throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INSUFFICIENT_DATA)); + throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INEXACT_LENGTH_DATA)); // if we had a limit try reading one more byte. // JDBC 3.0 states the stream muct have the correct number of characters in it. @@ -93,7 +93,7 @@ c = -1; } if (c >= 0) - throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INSUFFICIENT_DATA)); + throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INEXACT_LENGTH_DATA)); } } Index: java/engine/org/apache/derby/impl/jdbc/ReaderToUTF8Stream.java =================================================================== --- java/engine/org/apache/derby/impl/jdbc/ReaderToUTF8Stream.java (revision 290333) +++ java/engine/org/apache/derby/impl/jdbc/ReaderToUTF8Stream.java (working copy) @@ -160,7 +160,7 @@ int remainingBytes = reader.clearLimit(); if (remainingBytes > 0) - throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INSUFFICIENT_DATA)); + throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INEXACT_LENGTH_DATA)); // if we had a limit try reading one more character. // JDBC 3.0 states the stream muct have the correct number of characters in it. @@ -174,7 +174,7 @@ c = -1; } if (c >= 0) - throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INSUFFICIENT_DATA)); + throw new IOException(MessageService.getTextMessage(SQLState.SET_STREAM_INEXACT_LENGTH_DATA)); } // can put the correct length into the stream. Index: java/engine/org/apache/derby/iapi/reference/SQLState.java =================================================================== --- java/engine/org/apache/derby/iapi/reference/SQLState.java (revision 290333) +++ java/engine/org/apache/derby/iapi/reference/SQLState.java (working copy) @@ -1360,7 +1360,7 @@ String TYPE_MISMATCH = "XJ020.S"; String INVALID_JDBCTYPE = "XJ021.S"; String SET_STREAM_FAILURE = "XJ022.S"; - String SET_STREAM_INSUFFICIENT_DATA = "XJ023.S"; + String SET_STREAM_INEXACT_LENGTH_DATA = "XJ023.S"; String SET_UNICODE_INVALID_LENGTH = "XJ024.S"; String NEGATIVE_STREAM_LENGTH = "XJ025.S"; String NO_AUTO_COMMIT_ON = "XJ030.S"; Index: java/engine/org/apache/derby/loc/messages_en.properties =================================================================== --- java/engine/org/apache/derby/loc/messages_en.properties (revision 290333) +++ java/engine/org/apache/derby/loc/messages_en.properties (working copy) @@ -1063,7 +1063,7 @@ XJ018.S=Column name cannot be null. XJ020.S=Object type not convertible to TYPE ''{0}'', invalid java.sql.Types value, or object was null. XJ022.S=Unable to set stream: ''{0}''. -XJ023.S=Input stream held less data than requested length. +XJ023.S=Input stream did not have exact amount of data as the requested length. XJ025.S=Input stream cannot have negative length. XJ030.S=Cannot set AUTOCOMMIT ON when in a nested connection. XJ042.S=''{0}'' is not a valid value for property ''{1}''. Index: java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/characterStreams.java =================================================================== --- java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/characterStreams.java (revision 290333) +++ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/characterStreams.java (working copy) @@ -83,6 +83,21 @@ System.out.println("Test characterStreams finished"); } + + + private static void expectedException(SQLException sqle) { + + while (sqle != null) { + String sqlState = sqle.getSQLState(); + if (sqlState == null) { + sqlState = ""; + } + System.out.println("EXPECTED SQL Exception: (" + sqlState + ") " + + sqle.getMessage()); + + sqle = sqle.getNextException(); + } + } static void setStreams(Connection conn) throws Exception { ResultSet rs; @@ -227,7 +242,8 @@ ps.executeUpdate(); System.out.println("FAIL - MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - ACCEPTED"); } catch (SQLException sqle) { - System.out.println("MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED " + sqle.toString()); + System.out.println("MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED "); + expectedException(sqle); } // more bytes than the stream contains @@ -238,7 +254,8 @@ ps.executeUpdate(); System.out.println("FAIL - LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - ACCEPTED"); } catch (SQLException sqle) { - System.out.println("LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED " + sqle.toString()); + System.out.println("LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED "); + expectedException(sqle); } // null @@ -263,7 +280,8 @@ ps.executeUpdate(); System.out.println("FAIL - MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - ACCEPTED"); } catch (SQLException sqle) { - System.out.println("MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED " + sqle.toString()); + System.out.println("MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED "); + expectedException(sqle); } // more bytes than the stream contains, @@ -273,7 +291,8 @@ ps.executeUpdate(); System.out.println("FAIL - LESS CHARACTERS IN READER THAN SPECIFIED LENGTH - ACCEPTED"); } catch (SQLException sqle) { - System.out.println("LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED " + sqle.toString()); + System.out.println("LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED "); + expectedException(sqle); } // null Index: java/testing/org/apache/derbyTesting/functionTests/master/characterStreams.out =================================================================== --- java/testing/org/apache/derbyTesting/functionTests/master/characterStreams.out (revision 290333) +++ java/testing/org/apache/derbyTesting/functionTests/master/characterStreams.out (working copy) @@ -2,9 +2,13 @@ Test setAsciiStream into CHAR CORRECT NUMBER OF BYTES IN STREAM MORE BYTES IN STREAM THAN PASSED IN VALUE -MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. LESS BYTES IN STREAM THAN PASSED IN VALUE -LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. NULL ASCII STREAM ID |C |CLEN |VC |VCLEN |LVC |LVCLEN ----------------------------------------------------------------------------------------------------------------------------- @@ -22,9 +26,13 @@ Test setAsciiStream into VARCHAR CORRECT NUMBER OF BYTES IN STREAM MORE BYTES IN STREAM THAN PASSED IN VALUE -MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. LESS BYTES IN STREAM THAN PASSED IN VALUE -LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. NULL ASCII STREAM ID |C |CLEN |VC |VCLEN |LVC |LVCLEN ----------------------------------------------------------------------------------------------------------------------------- @@ -42,9 +50,13 @@ Test setAsciiStream into LONG VARCHAR CORRECT NUMBER OF BYTES IN STREAM MORE BYTES IN STREAM THAN PASSED IN VALUE -MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +MORE BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. LESS BYTES IN STREAM THAN PASSED IN VALUE -LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +LESS BYTES IN ASCII STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. NULL ASCII STREAM ID |C |CLEN |VC |VCLEN |LVC |LVCLEN ----------------------------------------------------------------------------------------------------------------------------- @@ -60,24 +72,36 @@ 9,,,Lieberman ran with Gore 12,,, Test setCharacterStream into CHAR -MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. -LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. +LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. ID |C |CLEN |VC |VCLEN |LVC |LVCLEN ----------------------------------------------------------------------------------------------------------------------------- 13 |A Mississippi Republican |24 |NULL |NULL |NULL |NULL 14 |Lott has apologized |19 |NULL |NULL |NULL |NULL 17 |NULL |NULL |NULL |NULL |NULL |NULL Test setCharacterStream into VARCHAR -MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. -LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. +LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. ID |C |CLEN |VC |VCLEN |LVC |LVCLEN ----------------------------------------------------------------------------------------------------------------------------- 18 |NULL |NULL |A Mississippi Republican |24 |NULL |NULL 19 |NULL |NULL |Lott has apologized |19 |NULL |NULL 22 |NULL |NULL |NULL |NULL |NULL |NULL Test setCharacterStream into LONG VARCHAR -MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. -LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED SQL Exception: An IOException was thrown when reading a 'java.sql.String' from an InputStream. +MORE CHARACTERS IN READER THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. +LESS CHARACTERS IN READER STREAM THAN SPECIFIED LENGTH - REJECTED +EXPECTED SQL Exception: (XCL30) An IOException was thrown when reading a 'java.sql.String' from an InputStream. +EXPECTED SQL Exception: (XJ001) Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. ID |C |CLEN |VC |VCLEN |LVC |LVCLEN ----------------------------------------------------------------------------------------------------------------------------- 23 |NULL |NULL |NULL |NULL |A Mississippi Republican |24 Index: java/testing/org/apache/derbyTesting/functionTests/master/resultsetStream.out =================================================================== --- java/testing/org/apache/derbyTesting/functionTests/master/resultsetStream.out (revision 290333) +++ java/testing/org/apache/derbyTesting/functionTests/master/resultsetStream.out (working copy) @@ -10,7 +10,7 @@ len=56 number of reads=56 EXPECTED SQLSTATE(XSDA4): An unexpected exception was thrown -EXPECTED SQLSTATE(XJ001): Java exception: 'Input stream held less data than requested length.: java.io.IOException'. +EXPECTED SQLSTATE(XJ001): Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. EXPECTED SQLSTATE(XSDA4): An unexpected exception was thrown -EXPECTED SQLSTATE(XJ001): Java exception: 'Input stream held less data than requested length.: java.io.IOException'. +EXPECTED SQLSTATE(XJ001): Java exception: 'Input stream did not have exact amount of data as the requested length.: java.io.IOException'. Test resultsetStream finished