Modified:
branches/branch_5_1/connector-j/src/com/mysql/jdbc/ResultSet.java
Log:
Fixups for number parsing for JDK-6.0 and beyond.
Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/ResultSet.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/ResultSet.java 2006-03-11 01:18:02 UTC (rev 5052)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/ResultSet.java 2006-03-11 02:01:51 UTC (rev 5053)
@@ -1537,6 +1537,16 @@
return (byte) convertToZeroWithEmptyCheck();
}
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ stringVal = stringVal.trim();
+
try {
int decimalIndex = stringVal.indexOf(".");
@@ -1916,7 +1926,19 @@
this.wasNullFlag = true;
return null;
- } else if (stringVal.equals("0") || stringVal.equals("0000-00-00")
+ }
+
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ stringVal = stringVal.trim();
+
+ if (stringVal.equals("0") || stringVal.equals("0000-00-00")
|| stringVal.equals("0000-00-00 00:00:00")
|| stringVal.equals("00000000000000")
|| stringVal.equals("0")) {
@@ -2452,6 +2474,16 @@
if ((val.indexOf("e") == -1) && (val.indexOf("E") == -1)
&& (val.indexOf(".") == -1)) {
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ val = val.trim();
+
int valueAsInt = Integer.parseInt(val);
if (this.connection.getJdbcCompliantTruncation()) {
@@ -5721,7 +5753,19 @@
this.wasNullFlag = true;
return null;
- } else if (timeAsString.equals("0")
+ }
+
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ timeAsString = timeAsString.trim();
+
+ if (timeAsString.equals("0")
|| timeAsString.equals("0000-00-00")
|| timeAsString.equals("0000-00-00 00:00:00")
|| timeAsString.equals("00000000000000")) {
@@ -5961,7 +6005,17 @@
return null;
}
+
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+ timestampValue = timestampValue.trim();
+
int length = timestampValue.length();
Calendar sessionCalendar = this.connection.getUseJDBCCompliantTimezoneShift() ?
@@ -6728,6 +6782,16 @@
if (valueAsBytes != null) {
intValue = StringUtils.getInt(valueAsBytes);
} else {
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ valueAsString = valueAsString.trim();
+
intValue = Integer.parseInt(valueAsString);
}
@@ -6780,6 +6844,16 @@
if (valueAsBytes != null) {
longValue = StringUtils.getLong(valueAsBytes);
} else {
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ valueAsString = valueAsString.trim();
+
longValue = Long.parseLong(valueAsString);
}
@@ -6834,6 +6908,16 @@
if (valueAsBytes != null) {
shortValue = StringUtils.getShort(valueAsBytes);
} else {
+ //
+ // JDK-6 doesn't like trailing whitespace
+ //
+ // Note this isn't a performance issue, other
+ // than the iteration over the string, as String.trim()
+ // will return a new string only if whitespace is present
+ //
+
+ valueAsString = valueAsString.trim();
+
shortValue = Short.parseShort(valueAsString);
}
| Thread |
|---|
| • Connector/J commit: r5053 - branches/branch_5_1/connector-j/src/com/mysql/jdbc | mmatthews | 11 Mar |