Skip to content

Commit b62652a

Browse files
committed
Reduced "getParameterType call not supported" log message to single line
Issue: SPR-10185 (cherry picked from commit 41f041e)
1 parent fce02d9 commit b62652a

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ public static int javaTypeToSqlParameterType(Class javaType) {
120120
* @param inValue the value to set
121121
* @throws SQLException if thrown by PreparedStatement methods
122122
*/
123-
public static void setParameterValue(
124-
PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue)
123+
public static void setParameterValue(PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue)
125124
throws SQLException {
126125

127126
setParameterValueInternal(ps, paramIndex, param.getSqlType(), param.getTypeName(), param.getScale(), inValue);
@@ -137,8 +136,7 @@ public static void setParameterValue(
137136
* @throws SQLException if thrown by PreparedStatement methods
138137
* @see SqlTypeValue
139138
*/
140-
public static void setParameterValue(
141-
PreparedStatement ps, int paramIndex, int sqlType, Object inValue)
139+
public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, Object inValue)
142140
throws SQLException {
143141

144142
setParameterValueInternal(ps, paramIndex, sqlType, null, null, inValue);
@@ -156,9 +154,8 @@ public static void setParameterValue(
156154
* @throws SQLException if thrown by PreparedStatement methods
157155
* @see SqlTypeValue
158156
*/
159-
public static void setParameterValue(
160-
PreparedStatement ps, int paramIndex, int sqlType, String typeName, Object inValue)
161-
throws SQLException {
157+
public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName,
158+
Object inValue) throws SQLException {
162159

163160
setParameterValueInternal(ps, paramIndex, sqlType, typeName, null, inValue);
164161
}
@@ -177,9 +174,8 @@ public static void setParameterValue(
177174
* @throws SQLException if thrown by PreparedStatement methods
178175
* @see SqlTypeValue
179176
*/
180-
private static void setParameterValueInternal(
181-
PreparedStatement ps, int paramIndex, int sqlType, String typeName, Integer scale, Object inValue)
182-
throws SQLException {
177+
private static void setParameterValueInternal(PreparedStatement ps, int paramIndex, int sqlType,
178+
String typeName, Integer scale, Object inValue) throws SQLException {
183179

184180
String typeNameToUse = typeName;
185181
int sqlTypeToUse = sqlType;
@@ -190,8 +186,7 @@ private static void setParameterValueInternal(
190186
SqlParameterValue parameterValue = (SqlParameterValue) inValue;
191187
if (logger.isDebugEnabled()) {
192188
logger.debug("Overriding type info with runtime info from SqlParameterValue: column index " + paramIndex +
193-
", SQL type " + parameterValue.getSqlType() +
194-
", Type name " + parameterValue.getTypeName());
189+
", SQL type " + parameterValue.getSqlType() + ", type name " + parameterValue.getTypeName());
195190
}
196191
if (parameterValue.getSqlType() != SqlTypeValue.TYPE_UNKNOWN) {
197192
sqlTypeToUse = parameterValue.getSqlType();
@@ -221,19 +216,18 @@ private static void setParameterValueInternal(
221216
* Set the specified PreparedStatement parameter to null,
222217
* respecting database-specific peculiarities.
223218
*/
224-
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName)
225-
throws SQLException {
226-
219+
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException {
227220
if (sqlType == SqlTypeValue.TYPE_UNKNOWN) {
228221
boolean useSetObject = false;
229222
sqlType = Types.NULL;
230223
try {
231224
sqlType = ps.getParameterMetaData().getParameterType(paramIndex);
232225
}
233226
catch (Throwable ex) {
234-
logger.debug("JDBC 3.0 getParameterType call not supported", ex);
235-
// JDBC driver not compliant with JDBC 3.0
236-
// -> proceed with database-specific checks
227+
if (logger.isDebugEnabled()) {
228+
logger.debug("JDBC 3.0 getParameterType call not supported - using fallback method instead: " + ex);
229+
}
230+
// JDBC driver not compliant with JDBC 3.0 -> proceed with database-specific checks
237231
try {
238232
DatabaseMetaData dbmd = ps.getConnection().getMetaData();
239233
String databaseProductName = dbmd.getDatabaseProductName();

0 commit comments

Comments
 (0)