List:Commits« Previous MessageNext Message »
From:mmatthews Date:December 13 2007 5:20pm
Subject:Connector/J commit: r6698 - in trunk: . .externalToolBuilders src/com/mysql/jdbc src/testsuite
View as plain text  
Modified:
   trunk/
   trunk/.externalToolBuilders/Ant_Builder (for JDBC-4.0 Implementation).launch
   trunk/src/com/mysql/jdbc/ConnectionImpl.java
   trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties
   trunk/src/com/mysql/jdbc/ResultSetImpl.java
   trunk/src/com/mysql/jdbc/ResultSetRow.java
   trunk/src/com/mysql/jdbc/TimeUtil.java
   trunk/src/testsuite/BaseTestCase.java
Log:
Merged revisions 6585-6586,6593-6597,6599-6602,6605,6607-6609,6612,6614-6617,6619-6620,6623-6627,6632,6636-6638,6641,6649,6658-6659,6663,6665-6673,6676,6681-6682,6684,6686,6688,6690-6691,6693-6697 via svnmerge from 
svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_1

.......
  r6694 | mmatthews | 2007-12-12 13:23:30 -0600 (Wed, 12 Dec 2007) | 1 line
  
  Use nested exceptions for causation relationships, externalized some error messages.
.......
  r6695 | mmatthews | 2007-12-12 13:24:30 -0600 (Wed, 12 Dec 2007) | 1 line
  
  Remove negation of legacy date code flag. Fixed an NPE.
.......
  r6696 | mmatthews | 2007-12-12 13:25:19 -0600 (Wed, 12 Dec 2007) | 1 line
  
  More robust implementation of getConnectionWithProps(String) that handles embedded '=' better.
.......
  r6697 | mmatthews | 2007-12-12 13:26:29 -0600 (Wed, 12 Dec 2007) | 1 line
  
  Fixed VM config.
.......



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6692
   + /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6697

Modified: trunk/.externalToolBuilders/Ant_Builder (for JDBC-4.0 Implementation).launch
===================================================================
--- trunk/.externalToolBuilders/Ant_Builder (for JDBC-4.0 Implementation).launch	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/.externalToolBuilders/Ant_Builder (for JDBC-4.0 Implementation).launch	2007-12-13 17:20:34 UTC (rev 6698)
@@ -3,7 +3,7 @@
 <booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
 <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/connector-j-trunk/build.xml"/>
+<listEntry value="/connector-j-5-1/build.xml"/>
 </listAttribute>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
 <listEntry value="1"/>
@@ -12,11 +12,11 @@
 <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
 <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.5.0-sun-1.5.0.13"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="connector-j-trunk"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/connector-j-trunk/build.xml}"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="connector-j-5-1"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/connector-j-5-1/build.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value=""/>
 <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
 <stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
 </launchConfiguration>

Modified: trunk/src/com/mysql/jdbc/ConnectionImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionImpl.java	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/src/com/mysql/jdbc/ConnectionImpl.java	2007-12-13 17:20:34 UTC (rev 6698)
@@ -760,15 +760,12 @@
 				mesg.append("Unable to connect to database.");
 			}
 
-			mesg.append("Underlying exception: \n\n");
-			mesg.append(ex.getClass().getName());
-
-			if (!getParanoid()) {
-				mesg.append(Util.stackTraceToString(ex));
-			}
-
-			throw SQLError.createSQLException(mesg.toString(),
+			SQLException sqlEx = SQLError.createSQLException(mesg.toString(),
 					SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE);
+			
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 
@@ -2113,14 +2110,12 @@
 				
 				if (!connectionGood) {
 					// We've really failed!
-					throw SQLError.createSQLException(
-							"Could not create connection to database server due to underlying exception: '"
-									+ connectionNotEstablishedBecause
-									+ "'."
-									+ (getParanoid() ? ""
-											: Util
-													.stackTraceToString(connectionNotEstablishedBecause)),
+					SQLException chainedEx = SQLError.createSQLException(
+							Messages.getString("Connection.UnableToConnect"),
 							SQLError.SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE);
+					chainedEx.initCause(connectionNotEstablishedBecause);
+					
+					throw chainedEx;
 				}
 			} else {
 				double timeout = getInitialTimeout();
@@ -2253,16 +2248,13 @@
 
 				if (!connectionGood) {
 					// We've really failed!
-					throw SQLError.createSQLException(
-							"Server connection failure during transaction. Due to underlying exception: '"
-									+ connectionException
-									+ "'."
-									+ (getParanoid() ? ""
-											: Util
-													.stackTraceToString(connectionException))
-									+ "\nAttempted reconnect "
-									+ getMaxReconnects() + " times. Giving up.",
+					SQLException chainedEx = SQLError.createSQLException(
+							Messages.getString("Connection.UnableToConnectWithRetries",
+									new Object[] {new Integer(getMaxReconnects())}),
 							SQLError.SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE);
+					chainedEx.initCause(connectionException);
+					
+					throw chainedEx;
 				}
 			}
 
@@ -2581,19 +2573,12 @@
 					cleanup(ex);
 				}
 
-				String exceptionType = ex.getClass().getName();
-				String exceptionMessage = ex.getMessage();
-
-				if (!getParanoid()) {
-					exceptionMessage += "\n\nNested Stack Trace:\n";
-					exceptionMessage += Util.stackTraceToString(ex);
-				}
-
-				throw new java.sql.SQLException(
-						"Error during query: Unexpected Exception: "
-								+ exceptionType + " message given: "
-								+ exceptionMessage,
+				SQLException sqlEx = SQLError.createSQLException(
+						Messages.getString("Connection.UnexpectedException"),
 						SQLError.SQL_STATE_GENERAL_ERROR);
+				sqlEx.initCause(ex);
+				
+				throw sqlEx;
 			} finally {
 				if (getMaintainTimeStats()) {
 					this.lastQueryFinishedTime = System.currentTimeMillis();
@@ -5264,8 +5249,13 @@
 		try {
 			this.io.sendCommand(MysqlDefs.SHUTDOWN, null, null, false, null);
 		} catch (Exception ex) {
-			throw SQLError.createSQLException("Unhandled exception '" + ex.toString()
-					+ "'", SQLError.SQL_STATE_GENERAL_ERROR);
+			SQLException sqlEx = SQLError.createSQLException(
+					Messages.getString("Connection.UnhandledExceptionDuringShutdown"),
+					SQLError.SQL_STATE_GENERAL_ERROR);
+			
+			sqlEx.initCause(ex);
+			
+			throw sqlEx;
 		}
 	}
 

Modified: trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties
===================================================================
--- trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2007-12-13 17:20:34 UTC (rev 6698)
@@ -422,6 +422,12 @@
 InvalidLoadBalanceStrategy=Invalid load balancing strategy '{0}'.
 Connection.Connection.BadValueInServerVariables=Invalid value '{1}' for server variable named '{0}', falling back to sane default of '{2}'.
 
+Connection.UnableToConnect=Could not create connection to database server.
+Connection.UnableToConnectWithRetries=Could not create connection to database server. \
+Attempted reconnect {0} times. Giving up.
+Connection.UnexpectedException=Unexpected exception encountered during query.
+Connection.UnhandledExceptionDuringShutdown=Unexpected exception during server shutdown.
+
 #
 # ConnectionProperty Categories
 #

Modified: trunk/src/com/mysql/jdbc/ResultSetImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetImpl.java	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/src/com/mysql/jdbc/ResultSetImpl.java	2007-12-13 17:20:34 UTC (rev 6698)
@@ -416,7 +416,7 @@
 			this.serverTimeZoneTz = this.connection.getServerTimezoneTZ();
 		}
 		
-		useLegacyDatetimeCode = !this.connection.getUseLegacyDatetimeCode();
+		useLegacyDatetimeCode = this.connection.getUseLegacyDatetimeCode();
 	}
 
 	/**
@@ -488,7 +488,7 @@
 		if (this.fields != null) {
 			initializeWithMetadata();
 		} // else called by Connection.initializeResultsMetadataFromCache() when cached
-		useLegacyDatetimeCode = !this.connection.getUseLegacyDatetimeCode();
+		useLegacyDatetimeCode = this.connection.getUseLegacyDatetimeCode();
 	}
 
 	public void initializeWithMetadata() throws SQLException {
@@ -1002,7 +1002,7 @@
 		boolean useGmtMillis = this.connection.getUseGmtMillisForDatetimes();
 		
 		return TimeUtil.fastDateCreate(useGmtMillis,
-				useGmtMillis ? getGmtCalendar() : null,
+				useGmtMillis ? getGmtCalendar() : cal,
 				cal, year, month, day);
 	}
 
@@ -2322,10 +2322,14 @@
 		} catch (SQLException sqlEx) {
 			throw sqlEx; // don't re-wrap
 		} catch (Exception e) {
-			throw SQLError.createSQLException(Messages.getString(
+			SQLException sqlEx = SQLError.createSQLException(Messages.getString(
 					"ResultSet.Bad_format_for_Date", new Object[] { stringVal,
 							Constants.integerValueOf(columnIndex) }),
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
+			
+			sqlEx.initCause(e);
+			
+			throw sqlEx;
 		}
 	}
 	

Modified: trunk/src/com/mysql/jdbc/ResultSetRow.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetRow.java	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/src/com/mysql/jdbc/ResultSetRow.java	2007-12-13 17:20:34 UTC (rev 6698)
@@ -287,11 +287,14 @@
 		} catch (SQLException sqlEx) {
 			throw sqlEx; // don't re-wrap
 		} catch (Exception e) {
-			throw SQLError.createSQLException(Messages.getString(
+			SQLException sqlEx = SQLError.createSQLException(Messages.getString(
 					"ResultSet.Bad_format_for_Date", new Object[] {
 							new String(dateAsBytes),
 							Constants.integerValueOf(columnIndex + 1) }),
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
+			sqlEx.initCause(e);
+			
+			throw sqlEx;
 		}
 	}
 

Modified: trunk/src/com/mysql/jdbc/TimeUtil.java
===================================================================
--- trunk/src/com/mysql/jdbc/TimeUtil.java	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/src/com/mysql/jdbc/TimeUtil.java	2007-12-13 17:20:34 UTC (rev 6698)
@@ -1141,7 +1141,7 @@
 	final static Timestamp fastTimestampCreate(TimeZone tz, int year,
  			int month, int day, int hour, int minute, int seconds,
  			int secondsPart) {
-		Calendar cal = new GregorianCalendar(tz);
+		Calendar cal = (tz == null) ? new GregorianCalendar() : new GregorianCalendar(tz);
 		cal.clear();
 		
 		// why-oh-why is this different than java.util.date,

Modified: trunk/src/testsuite/BaseTestCase.java
===================================================================
--- trunk/src/testsuite/BaseTestCase.java	2007-12-12 19:26:29 UTC (rev 6697)
+++ trunk/src/testsuite/BaseTestCase.java	2007-12-13 17:20:34 UTC (rev 6698)
@@ -217,7 +217,18 @@
 			while (iter.hasNext()) {
 				String kvp = (String)iter.next();
 				List splitUp = StringUtils.split(kvp, "=", false);
-				props.setProperty(splitUp.get(0).toString().trim(), splitUp.get(1).toString());
+				StringBuffer value = new StringBuffer();
+				
+				for (int i = 1; i < splitUp.size(); i++) {
+					if (i != 1) {
+						value.append("=");
+					}
+					
+					value.append(splitUp.get(i));
+					
+				}
+				
+				props.setProperty(splitUp.get(0).toString().trim(), value.toString());
 			}
 		}
 		

Thread
Connector/J commit: r6698 - in trunk: . .externalToolBuilders src/com/mysql/jdbc src/testsuitemmatthews13 Dec