List:Commits« Previous MessageNext Message »
From:mmatthews Date:December 21 2007 2:46am
Subject:Connector/J commit: r6703 - in branches/branch_5_1: . src/com/mysql/jdbc src/com/mysql/jdbc/exceptions/jdbc4
View as plain text  
Modified:
   branches/branch_5_1/CHANGES
   branches/branch_5_1/src/com/mysql/jdbc/Blob.java
   branches/branch_5_1/src/com/mysql/jdbc/CommunicationsException.java
   branches/branch_5_1/src/com/mysql/jdbc/ConnectionPropertiesImpl.java
   branches/branch_5_1/src/com/mysql/jdbc/ExportControlled.java
   branches/branch_5_1/src/com/mysql/jdbc/Messages.java
   branches/branch_5_1/src/com/mysql/jdbc/MysqlIO.java
   branches/branch_5_1/src/com/mysql/jdbc/NonRegisteringDriver.java
   branches/branch_5_1/src/com/mysql/jdbc/PreparedStatement.java
   branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java
   branches/branch_5_1/src/com/mysql/jdbc/ResultSetRow.java
   branches/branch_5_1/src/com/mysql/jdbc/RowDataDynamic.java
   branches/branch_5_1/src/com/mysql/jdbc/ServerPreparedStatement.java
   branches/branch_5_1/src/com/mysql/jdbc/UpdatableResultSet.java
   branches/branch_5_1/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java
Log:
For any SQLException caused by another Throwable, besides dumping the message or stack
      trace as a string into the message, set the underlying Throwable as the cause for
      the SQLException, making it accessible via getCause().

Modified: branches/branch_5_1/CHANGES
===================================================================
--- branches/branch_5_1/CHANGES	2007-12-19 14:54:25 UTC (rev 6702)
+++ branches/branch_5_1/CHANGES	2007-12-21 01:46:30 UTC (rev 6703)
@@ -96,6 +96,10 @@
       conditions where one thread that has created a connection "shares" it with other
       threads if the connection is reconnected due to auto-reconnect functionality.
       
+    - For any SQLException caused by another Throwable, besides dumping the message or
stack
+      trace as a string into the message, set the underlying Throwable as the cause for
+      the SQLException, making it accessible via getCause().
+      
 10-09-07 - Version 5.1.5
 
     - Released instead of 5.1.4 to pickup patch for BUG#31053

Modified: branches/branch_5_1/src/com/mysql/jdbc/Blob.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/Blob.java	2007-12-19 14:54:25 UTC (rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/Blob.java	2007-12-21 01:46:30 UTC (rev 6703)
@@ -238,8 +238,11 @@
 		try {
 			bytesOut.write(bytes, offset, length);
 		} catch (IOException ioEx) {
-			throw SQLError.createSQLException(Messages.getString("Blob.1"), //$NON-NLS-1$
+			SQLException sqlEx = SQLError.createSQLException(Messages.getString("Blob.1"),
//$NON-NLS-1$
 					SQLError.SQL_STATE_GENERAL_ERROR);
+			sqlEx.initCause(ioEx);
+			
+			throw sqlEx;
 		} finally {
 			try {
 				bytesOut.close();

Modified: branches/branch_5_1/src/com/mysql/jdbc/CommunicationsException.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/CommunicationsException.java	2007-12-19
14:54:25 UTC (rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/CommunicationsException.java	2007-12-21
01:46:30 UTC (rev 6703)
@@ -50,6 +50,10 @@
 
 		this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
 				lastPacketSentTimeMs, underlyingException, this.streamingResultSetInPlay);
+		
+		if (underlyingException != null) {
+			initCause(underlyingException);
+		}
 	}
 
 	

Modified: branches/branch_5_1/src/com/mysql/jdbc/ConnectionPropertiesImpl.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ConnectionPropertiesImpl.java	2007-12-19
14:54:25 UTC (rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/ConnectionPropertiesImpl.java	2007-12-21
01:46:30 UTC (rev 6703)
@@ -656,7 +656,10 @@
 				}
 			}
 		} catch (Exception ex) {
-			throw new RuntimeException(ex.toString());
+			RuntimeException rtEx = new RuntimeException();
+			rtEx.initCause(ex);
+			
+			throw rtEx;
 		}
 	}
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/ExportControlled.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ExportControlled.java	2007-12-19 14:54:25 UTC
(rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/ExportControlled.java	2007-12-21 01:46:30 UTC
(rev 6703)
@@ -180,9 +180,12 @@
 						+ " does not appear to be a valid URL.", SQL_STATE_BAD_SSL_PARAMS, 0,
 						false);
 			} catch (IOException ioe) {
-				throw SQLError.createSQLException("Cannot open "
+				SQLException sqlEx = SQLError.createSQLException("Cannot open "
 						+ clientCertificateKeyStoreUrl + " ["
 						+ ioe.getMessage() + "]", SQL_STATE_BAD_SSL_PARAMS, 0, false);
+				sqlEx.initCause(ioe);
+				
+				throw sqlEx;
 			}
 		}
 
@@ -216,9 +219,13 @@
 						+ " does not appear to be a valid URL.", SQL_STATE_BAD_SSL_PARAMS, 0,
 						false);
 			} catch (IOException ioe) {
-				throw SQLError.createSQLException("Cannot open "
+				SQLException sqlEx = SQLError.createSQLException("Cannot open "
 						+ trustCertificateKeyStoreUrl + " [" + ioe.getMessage()
 						+ "]", SQL_STATE_BAD_SSL_PARAMS, 0, false);
+				
+				sqlEx.initCause(ioe);
+				
+				throw sqlEx;
 			}
 		}
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/Messages.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/Messages.java	2007-12-19 14:54:25 UTC (rev
6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/Messages.java	2007-12-21 01:46:30 UTC (rev
6703)
@@ -57,9 +57,12 @@
 			try {
 				temp = ResourceBundle.getBundle(BUNDLE_NAME);
 			} catch (Throwable t2) {
-				throw new RuntimeException(
+				RuntimeException rt = new RuntimeException(
 						"Can't load resource bundle due to underlying exception "
 								+ t.toString());
+				rt.initCause(t2);
+				
+				throw rt;
 			}
 		} finally {
 			RESOURCE_BUNDLE = temp;

Modified: branches/branch_5_1/src/com/mysql/jdbc/MysqlIO.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/MysqlIO.java	2007-12-19 14:54:25 UTC (rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/MysqlIO.java	2007-12-21 01:46:30 UTC (rev 6703)
@@ -2522,9 +2522,11 @@
                 info = resultPacket.readString();
             }
         } catch (Exception ex) {
-            throw SQLError.createSQLException(SQLError.get(
-                    SQLError.SQL_STATE_GENERAL_ERROR) + ": " //$NON-NLS-1$
-                 +ex.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR, -1);
+            SQLException sqlEx = SQLError.createSQLException(SQLError.get(
+                    SQLError.SQL_STATE_GENERAL_ERROR), SQLError.SQL_STATE_GENERAL_ERROR,
-1);
+            sqlEx.initCause(ex);
+            
+            throw sqlEx;
         }
 
         ResultSetInternalMethods updateRs =
com.mysql.jdbc.ResultSetImpl.getInstance(updateCount,
@@ -2638,12 +2640,14 @@
             return (SocketFactory) (Class.forName(this.socketFactoryClassName)
                                          .newInstance());
         } catch (Exception ex) {
-            throw SQLError.createSQLException(Messages.getString("MysqlIO.76")
//$NON-NLS-1$
+            SQLException sqlEx =
SQLError.createSQLException(Messages.getString("MysqlIO.76") //$NON-NLS-1$
                  +this.socketFactoryClassName +
-                Messages.getString("MysqlIO.77") + ex.toString() //$NON-NLS-1$
-                 +(this.connection.getParanoid() ? "" //$NON-NLS-1$
-                                                 : Util.stackTraceToString(ex)),
+                Messages.getString("MysqlIO.77"),
                 SQLError.SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE);
+            
+            sqlEx.initCause(ex);
+            
+            throw sqlEx;
         }
     }
 
@@ -3280,8 +3284,11 @@
                 try {
                     fileIn.close();
                 } catch (Exception ex) {
-                    throw SQLError.createSQLException(Messages.getString("MysqlIO.65"),
//$NON-NLS-1$
+                    SQLException sqlEx =
SQLError.createSQLException(Messages.getString("MysqlIO.65"), //$NON-NLS-1$
                         SQLError.SQL_STATE_GENERAL_ERROR);
+                    sqlEx.initCause(ex);
+                    
+                    throw sqlEx;
                 }
 
                 fileIn = null;

Modified: branches/branch_5_1/src/com/mysql/jdbc/NonRegisteringDriver.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/NonRegisteringDriver.java	2007-12-19 14:54:25
UTC (rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/NonRegisteringDriver.java	2007-12-21 01:46:30
UTC (rev 6703)
@@ -288,11 +288,15 @@
 			// them un-changed.
 			throw sqlEx;
 		} catch (Exception ex) {
-			throw SQLError.createSQLException(Messages
+			SQLException sqlEx = SQLError.createSQLException(Messages
 					.getString("NonRegisteringDriver.17") //$NON-NLS-1$
 					+ ex.toString()
 					+ Messages.getString("NonRegisteringDriver.18"), //$NON-NLS-1$
 					SQLError.SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE);
+			
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 
@@ -718,12 +722,15 @@
 					}
 					configProps.load(configAsStream);
 				} catch (IOException ioEx) {
-					throw SQLError.createSQLException(
+					SQLException sqlEx = SQLError.createSQLException(
 							"Unable to load configuration template '"
 									+ configName
 									+ "' due to underlying IOException: "
 									+ ioEx,
 							SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
+					sqlEx.initCause(ioEx);
+					
+					throw sqlEx;
 				}
 			}
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/PreparedStatement.java	2007-12-19 14:54:25 UTC
(rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/PreparedStatement.java	2007-12-21 01:46:30 UTC
(rev 6703)
@@ -2595,9 +2595,12 @@
 	private final int readblock(InputStream i, byte[] b) throws SQLException {
 		try {
 			return i.read(b);
-		} catch (Throwable E) {
-			throw SQLError.createSQLException(Messages.getString("PreparedStatement.56")
//$NON-NLS-1$
-					+ E.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR);
+		} catch (Throwable ex) {
+			SQLException sqlEx =
SQLError.createSQLException(Messages.getString("PreparedStatement.56") //$NON-NLS-1$
+					+ ex.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR);
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 
@@ -2611,9 +2614,12 @@
 			}
 
 			return i.read(b, 0, lengthToRead);
-		} catch (Throwable E) {
-			throw SQLError.createSQLException(Messages.getString("PreparedStatement.55")
//$NON-NLS-1$
-					+ E.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR);
+		} catch (Throwable ex) {
+			SQLException sqlEx =
SQLError.createSQLException(Messages.getString("PreparedStatement.56") //$NON-NLS-1$
+					+ ex.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR);
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 
@@ -3793,13 +3799,17 @@
 					throw (SQLException) ex;
 				}
 
-				throw SQLError.createSQLException(
+				SQLException sqlEx = SQLError.createSQLException(
 						Messages.getString("PreparedStatement.17") //$NON-NLS-1$
 								+ parameterObj.getClass().toString()
 								+ Messages.getString("PreparedStatement.18") //$NON-NLS-1$
 								+ ex.getClass().getName()
 								+ Messages.getString("PreparedStatement.19") + ex.getMessage(), //$NON-NLS-1$
 						SQLError.SQL_STATE_GENERAL_ERROR);
+				
+				sqlEx.initCause(ex);
+				
+				throw sqlEx;
 			}
 		}
 	}
@@ -3907,9 +3917,12 @@
 			setBinaryStream(parameterIndex, bytesIn, buf.length);
 			this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] =
Types.JAVA_OBJECT;
 		} catch (Exception ex) {
-			throw SQLError.createSQLException(Messages.getString("PreparedStatement.54")
//$NON-NLS-1$
+			SQLException sqlEx =
SQLError.createSQLException(Messages.getString("PreparedStatement.54") //$NON-NLS-1$
 					+ ex.getClass().getName(),
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java	2007-12-19 14:54:25 UTC (rev
6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java	2007-12-21 01:46:30 UTC (rev
6703)
@@ -5882,8 +5882,11 @@
 						tz, rollForward);
 			}
 		} catch (Exception ex) {
-			throw SQLError.createSQLException(ex.toString(),
+			SQLException sqlEx = SQLError.createSQLException(ex.toString(),
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 	
@@ -6292,9 +6295,12 @@
 				}
 			}
 		} catch (Exception e) {
-			throw new java.sql.SQLException("Cannot convert value '"
+			SQLException sqlEx = SQLError.createSQLException("Cannot convert value '"
 					+ timestampValue + "' from column " + columnIndex
 					+ " to TIMESTAMP.", SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+			sqlEx.initCause(e);
+			
+			throw sqlEx;
 		}
 		
 	}
@@ -6572,9 +6578,12 @@
 				}
 			}
 		} catch (Exception e) {
-			throw new java.sql.SQLException("Cannot convert value '"
+			SQLException sqlEx = SQLError.createSQLException("Cannot convert value '"
 					+ new String(timestampAsBytes) + "' from column " + columnIndex
 					+ " to TIMESTAMP.", SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+			sqlEx.initCause(e);
+			
+			throw sqlEx;
 		}	
 	}
 	

Modified: branches/branch_5_1/src/com/mysql/jdbc/ResultSetRow.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ResultSetRow.java	2007-12-19 14:54:25 UTC (rev
6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/ResultSetRow.java	2007-12-21 01:46:30 UTC (rev
6703)
@@ -967,8 +967,11 @@
 						rollForward);
 			}
 		} catch (Exception ex) {
-			throw SQLError.createSQLException(ex.toString(),
+			SQLException sqlEx = SQLError.createSQLException(ex.toString(),
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 
@@ -1315,10 +1318,13 @@
 				}
 			}
 		} catch (Exception e) {
-			throw new java.sql.SQLException("Cannot convert value '"
+			SQLException sqlEx = SQLError.createSQLException("Cannot convert value '"
 					+ getString(columnIndex, "ISO8859_1", conn)
 					+ "' from column " + (columnIndex + 1) + " to TIMESTAMP.",
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+			sqlEx.initCause(e);
+			
+			throw sqlEx;
 		}
 	}
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/RowDataDynamic.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/RowDataDynamic.java	2007-12-19 14:54:25 UTC
(rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/RowDataDynamic.java	2007-12-21 01:46:30 UTC
(rev 6703)
@@ -436,10 +436,13 @@
 			exceptionMessage += Messages.getString("RowDataDynamic.7"); //$NON-NLS-1$
 			exceptionMessage += Util.stackTraceToString(ex);
 
-			throw new java.sql.SQLException(
+			SQLException sqlEx = SQLError.createSQLException(
 					Messages.getString("RowDataDynamic.8") //$NON-NLS-1$
 							+ exceptionType
 							+ Messages.getString("RowDataDynamic.9") + exceptionMessage,
SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ServerPreparedStatement.java	2007-12-19
14:54:25 UTC (rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/ServerPreparedStatement.java	2007-12-21
01:46:30 UTC (rev 6703)
@@ -428,8 +428,11 @@
 		} catch (Exception ex) {
 			realClose(false, true);
 
-			throw SQLError.createSQLException(ex.toString(),
+			SQLException sqlEx = SQLError.createSQLException(ex.toString(),
 					SQLError.SQL_STATE_GENERAL_ERROR);
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 		
 		setResultSetType(resultSetType);
@@ -873,6 +876,8 @@
 						.toString());
 			}
 
+			sqlEx.initCause(ex);
+			
 			throw sqlEx;
 		}
 	}
@@ -1095,6 +1100,7 @@
 		} catch (Exception ex) {
 			this.invalidationException = SQLError.createSQLException(ex.toString(),
 					SQLError.SQL_STATE_GENERAL_ERROR);
+			this.invalidationException.initCause(ex);
 		}
 
 		if (this.invalidationException != null) {
@@ -1683,8 +1689,11 @@
 			} catch (SQLException sqlEx) {
 				throw sqlEx;
 			} catch (Exception ex) {
-				throw SQLError.createSQLException(ex.toString(),
+				SQLException sqlEx = SQLError.createSQLException(ex.toString(),
 						SQLError.SQL_STATE_GENERAL_ERROR);
+				sqlEx.initCause(ex);
+				
+				throw sqlEx;
 			} finally {
 				mysql.clearInputStream();
 			}
@@ -2590,9 +2599,12 @@
 						null);
 			}
 		} catch (IOException ioEx) {
-			throw SQLError.createSQLException(Messages
+			SQLException sqlEx = SQLError.createSQLException(Messages
 					.getString("ServerPreparedStatement.24") //$NON-NLS-1$
 					+ ioEx.toString(), SQLError.SQL_STATE_GENERAL_ERROR);
+			sqlEx.initCause(ioEx);
+			
+			throw sqlEx;
 		} finally {
 			if (this.connection.getAutoClosePStmtStreams()) {
 				if (inStream != null) {
@@ -2657,9 +2669,12 @@
 						null);
 			}
 		} catch (IOException ioEx) {
-			throw SQLError.createSQLException(Messages
+			SQLException sqlEx = SQLError.createSQLException(Messages
 					.getString("ServerPreparedStatement.25") //$NON-NLS-1$
 					+ ioEx.toString(), SQLError.SQL_STATE_GENERAL_ERROR);
+			sqlEx.initCause(ioEx);
+			
+			throw sqlEx;
 		} finally {
 			if (this.connection.getAutoClosePStmtStreams()) {
 				if (inStream != null) {

Modified: branches/branch_5_1/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/UpdatableResultSet.java	2007-12-19 14:54:25 UTC
(rev 6702)
+++ branches/branch_5_1/src/com/mysql/jdbc/UpdatableResultSet.java	2007-12-21 01:46:30 UTC
(rev 6703)
@@ -24,15 +24,8 @@
  */
 package com.mysql.jdbc;
 
-import com.mysql.jdbc.profiler.ProfilerEventHandlerFactory;
-import com.mysql.jdbc.profiler.ProfilerEvent;
-
-import java.io.InputStream;
-import java.io.Reader;
 import java.math.BigDecimal;
-
 import java.sql.SQLException;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -40,6 +33,9 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import com.mysql.jdbc.profiler.ProfilerEvent;
+import com.mysql.jdbc.profiler.ProfilerEventHandlerFactory;
+
 /**
  * A result set that is updatable.
  *
@@ -617,7 +613,7 @@
 
 		for (int i = 0; i < this.fields.length; i++) {
 		    StringBuffer tableNameBuffer = new StringBuffer();
-		    Map columnNameToIndex = null;
+		    Map updColumnNameToIndex = null;
 
 		    // FIXME: What about no table?
 		    if (this.fields[i].getOriginalTableName() != null) {
@@ -650,7 +646,7 @@
 
 	            columnIndicesToTable.put(new Integer(i), fqTableName);
 
-	            columnNameToIndex = getColumnsToIndexMapForTableAndDB(databaseName,
tableOnlyName);
+	            updColumnNameToIndex = getColumnsToIndexMapForTableAndDB(databaseName,
tableOnlyName);
 	        } else {
 	            String tableOnlyName = this.fields[i].getTableName();
 
@@ -672,7 +668,7 @@
 
                     columnIndicesToTable.put(new Integer(i), fqTableName);
 
-                    columnNameToIndex = getColumnsToIndexMapForTableAndDB(this.catalog,
tableOnlyName);
+                    updColumnNameToIndex =
getColumnsToIndexMapForTableAndDB(this.catalog, tableOnlyName);
 	            }
 	        }
 
@@ -687,8 +683,8 @@
 				columnName = this.fields[i].getName();
 			}
 
-			if (columnNameToIndex != null && columnName != null) {
-			    columnNameToIndex.put(columnName, new Integer(i));
+			if (updColumnNameToIndex != null && columnName != null) {
+			    updColumnNameToIndex.put(columnName, new Integer(i));
 			}
 
 			String originalTableName = this.fields[i].getOriginalTableName();

Modified:
branches/branch_5_1/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java
===================================================================
---
branches/branch_5_1/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java	2007-12-19
14:54:25 UTC (rev 6702)
+++
branches/branch_5_1/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java	2007-12-21
01:46:30 UTC (rev 6703)
@@ -55,6 +55,10 @@
 
 		this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
 				lastPacketSentTimeMs, underlyingException, this.streamingResultSetInPlay);
+		
+		if (underlyingException != null) {
+			initCause(underlyingException);
+		}
 	}
 
 	/*

Thread
Connector/J commit: r6703 - in branches/branch_5_1: . src/com/mysql/jdbc src/com/mysql/jdbc/exceptions/jdbc4mmatthews21 Dec