List:Commits« Previous MessageNext Message »
From:mmatthews Date:May 25 2007 10:39pm
Subject:Connector/J commit: r6439 - in branches: branch_5_0/connector-j branch_5_0/connector-j/src/com/mysql/jdbc branch_5_1/connector-j branch_5_1/connector-...
View as plain text  
Modified:
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java
   branches/branch_5_1/connector-j/CHANGES
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java
Log:
Give more information in EOFExceptions thrown out of MysqlIO (how many bytes the driver
expected to read, how many it actually read, say that communications with the server were
unexpectedly lost).

Removed a couple of extra byte[] allocations when reading the packet header for split
packets (we can reuse the existing buffer for these).


Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2007-05-25 20:16:06 UTC (rev 6438)
+++ branches/branch_5_0/connector-j/CHANGES	2007-05-25 20:39:18 UTC (rev 6439)
@@ -57,7 +57,11 @@
 		"tcpTrafficClass" - Should the driver set traffic class or 
 		                    type-of-service fields? See the documentation 
 		                    for java.net.Socket.setTrafficClass() for more 
-		                    information.		                    
+		                    information.
+	- Give more information in EOFExceptions thrown out of MysqlIO (how many
+	  bytes the driver expected to read, how many it actually read, say that
+	  communications with the server were unexpectedly lost).
+	  	                    
 05-15-07 - Version 5.0.6
 
 	- Fixed BUG#25545 - Client options not sent correctly when using SSL,

Modified:
branches/branch_5_0/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties
===================================================================
---
branches/branch_5_0/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2007-05-25
20:16:06 UTC (rev 6438)
+++
branches/branch_5_0/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2007-05-25
20:39:18 UTC (rev 6439)
@@ -347,6 +347,7 @@
 MysqlIO.99=\ of 
 MysqlIO.100=\ in binary-encoded result set.
 MysqlIO.102=, underlying cause: 
+MysqlIO.EOF=Can not read response from server. Expected to read {0} bytes, read {1} bytes
before connection was unexpectedly lost.
 NotImplemented.0=Feature not implemented
 PreparedStatement.0=SQL String can not be NULL
 PreparedStatement.1=SQL String can not be NULL

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java	2007-05-25 20:16:06
UTC (rev 6438)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java	2007-05-25 20:39:18
UTC (rev 6439)
@@ -1994,7 +1994,8 @@
             int count = in.read(b, off + n, len - n);
 
             if (count < 0) {
-                throw new EOFException();
+            	 throw new EOFException(Messages.getString("MysqlIO.EOF", 
+                 		new Object[] {new Integer(len), new Integer(n)}));
             }
 
             n += count;
@@ -2014,7 +2015,8 @@
     		long count = in.skip(len - n);
     		
     		if (count < 0) {
-    			throw new EOFException();
+    			 throw new EOFException(Messages.getString("MysqlIO.EOF", 
+                 		new Object[] {new Long(len), new Long(n)}));
     		}
     		
     		n += count;
@@ -2493,7 +2495,7 @@
     			isMultiPacket = true;
     			
     			lengthRead = readFully(this.mysqlInput,
-    					this.packetHeaderBuf = new byte[4], 0, 4);
+    					this.packetHeaderBuf, 0, 4);
     			
     			if (lengthRead < 4) {
     				forceClose();
@@ -2510,7 +2512,7 @@
     			while (true) {
     				if (!firstMultiPkt) {
     					lengthRead = readFully(this.mysqlInput,
-    							this.packetHeaderBuf = new byte[4], 0, 4);
+    							this.packetHeaderBuf, 0, 4);
     					
     					if (lengthRead < 4) {
     						forceClose();

Modified: branches/branch_5_1/connector-j/CHANGES
===================================================================
--- branches/branch_5_1/connector-j/CHANGES	2007-05-25 20:16:06 UTC (rev 6438)
+++ branches/branch_5_1/connector-j/CHANGES	2007-05-25 20:39:18 UTC (rev 6439)
@@ -152,7 +152,12 @@
 		"tcpTrafficClass" - Should the driver set traffic class or 
 		                    type-of-service fields? See the documentation 
 		                    for java.net.Socket.setTrafficClass() for more 
-		                    information.      	       
+		                    information.  
+
+	- Give more information in EOFExceptions thrown out of MysqlIO (how many
+	  bytes the driver expected to read, how many it actually read, say that
+	  communications with the server were unexpectedly lost).
+    
 05-15-07 - Version 5.0.6
 
 	- Fixed BUG#25545 - Client options not sent correctly when using SSL,

Modified:
branches/branch_5_1/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties
===================================================================
---
branches/branch_5_1/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2007-05-25
20:16:06 UTC (rev 6438)
+++
branches/branch_5_1/connector-j/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2007-05-25
20:39:18 UTC (rev 6439)
@@ -345,6 +345,7 @@
 MysqlIO.99=\ of 
 MysqlIO.100=\ in binary-encoded result set.
 MysqlIO.102=, underlying cause: 
+MysqlIO.EOF=Can not read response from server. Expected to read {0} bytes, read {1} bytes
before connection was unexpectedly lost.
 NotImplemented.0=Feature not implemented
 PreparedStatement.0=SQL String can not be NULL
 PreparedStatement.1=SQL String can not be NULL

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java	2007-05-25 20:16:06
UTC (rev 6438)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java	2007-05-25 20:39:18
UTC (rev 6439)
@@ -1954,8 +1954,16 @@
 					|| (!executeTopLevelOnly);
 
 			if (shouldExecute) {
+				String sqlToInterceptor = sql;
+				
+				if (interceptedStatement instanceof PreparedStatement) {
+					sqlToInterceptor = ((PreparedStatement) interceptedStatement)
+							.asSql();
+				}
+				
 				ResultSetInternalMethods interceptedResultSet = interceptor
-						.preProcess(sql, interceptedStatement, this.connection);
+						.preProcess(sqlToInterceptor, interceptedStatement,
+								this.connection);
 
 				if (interceptedResultSet != null) {
 					previousResultSet = interceptedResultSet;
@@ -1980,8 +1988,15 @@
 					|| (!executeTopLevelOnly);
 
 			if (shouldExecute) {
+				String sqlToInterceptor = sql;
+				
+				if (interceptedStatement instanceof PreparedStatement) {
+					sqlToInterceptor = ((PreparedStatement) interceptedStatement)
+							.asSql();
+				}
+				
 				ResultSetInternalMethods interceptedResultSet = interceptor
-						.postProcess(sql, interceptedStatement,
+						.postProcess(sqlToInterceptor, interceptedStatement,
 								originalResultSet, this.connection);
 
 				if (interceptedResultSet != null) {
@@ -2110,7 +2125,8 @@
             int count = in.read(b, off + n, len - n);
 
             if (count < 0) {
-                throw new EOFException();
+                throw new EOFException(Messages.getString("MysqlIO.EOF", 
+                		new Object[] {new Integer(len), new Integer(n)}));
             }
 
             n += count;
@@ -2130,7 +2146,8 @@
     		long count = in.skip(len - n);
     		
     		if (count < 0) {
-    			throw new EOFException();
+    			throw new EOFException(Messages.getString("MysqlIO.EOF", 
+                		new Object[] {new Long(len), new Long(n)}));
     		}
     		
     		n += count;

Thread
Connector/J commit: r6439 - in branches: branch_5_0/connector-j branch_5_0/connector-j/src/com/mysql/jdbc branch_5_1/connector-j branch_5_1/connector-...mmatthews25 May