Modified:
branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java
branches/branch_5_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
Log:
Fixed NPE when generating parameter map for a callable statement with no parameters.
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java 2006-04-03 00:03:14 UTC (rev 5119)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java 2006-04-03 15:11:21 UTC (rev 5120)
@@ -230,6 +230,10 @@
}
public int getParameterCount() throws SQLException {
+ if (this.parameterList == null) {
+ return 0;
+ }
+
return this.parameterList.size();
}
@@ -387,7 +391,8 @@
// provide a map from the specified placeholders to the actual
// parameter numbers
- if (this.parameterCount != this.paramInfo.getParameterCount()) {
+ if (this.paramInfo != null &&
+ this.parameterCount != this.paramInfo.getParameterCount()) {
this.placeholderToParameterIndexMap = new int[this.parameterCount];
int startPos = StringUtils.indexOfIgnoreCase(this.originalSql,
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2006-04-03 00:03:14 UTC (rev 5119)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2006-04-03 15:11:21 UTC (rev 5120)
@@ -389,7 +389,8 @@
// provide a map from the specified placeholders to the actual
// parameter numbers
- if (this.parameterCount != this.paramInfo.getParameterCount()) {
+ if (this.paramInfo != null &&
+ this.parameterCount != this.paramInfo.getParameterCount()) {
this.placeholderToParameterIndexMap = new int[this.parameterCount];
int startPos = StringUtils.indexOfIgnoreCase(this.originalSql,
Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/CallableStatement.java 2006-04-03 00:03:14 UTC (rev 5119)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/CallableStatement.java 2006-04-03 15:11:21 UTC (rev 5120)
@@ -241,6 +241,10 @@
}
public int getParameterCount() throws SQLException {
+ if (this.parameterList == null) {
+ return 0;
+ }
+
return this.parameterList.size();
}
@@ -406,7 +410,8 @@
// provide a map from the specified placeholders to the actual
// parameter numbers
- if (this.parameterCount != this.paramInfo.getParameterCount()) {
+ if (this.paramInfo != null &&
+ this.parameterCount != this.paramInfo.getParameterCount()) {
this.placeholderToParameterIndexMap = new int[this.parameterCount];
int startPos = StringUtils.indexOfIgnoreCase(this.originalSql,
| Thread |
|---|
| • Connector/J commit: r5120 - in branches: branch_3_1/connector-j/src/com/mysql/jdbc branch_5_0/connector-j/src/com/mysql/jdbc branch_5_1/connector-j/sr... | mmatthews | 3 Apr |