From b62652aca1f332a685c52888ebf7fa5fc656b35e Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 14 Oct 2013 23:31:53 +0200 Subject: [PATCH] Reduced "getParameterType call not supported" log message to single line Issue: SPR-10185 (cherry picked from commit 41f041e) --- .../jdbc/core/StatementCreatorUtils.java | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java index a1fbc4d520..62eb086861 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java @@ -120,8 +120,7 @@ public abstract class StatementCreatorUtils { * @param inValue the value to set * @throws SQLException if thrown by PreparedStatement methods */ - public static void setParameterValue( - PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue) + public static void setParameterValue(PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue) throws SQLException { setParameterValueInternal(ps, paramIndex, param.getSqlType(), param.getTypeName(), param.getScale(), inValue); @@ -137,8 +136,7 @@ public abstract class StatementCreatorUtils { * @throws SQLException if thrown by PreparedStatement methods * @see SqlTypeValue */ - public static void setParameterValue( - PreparedStatement ps, int paramIndex, int sqlType, Object inValue) + public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, Object inValue) throws SQLException { setParameterValueInternal(ps, paramIndex, sqlType, null, null, inValue); @@ -156,9 +154,8 @@ public abstract class StatementCreatorUtils { * @throws SQLException if thrown by PreparedStatement methods * @see SqlTypeValue */ - public static void setParameterValue( - PreparedStatement ps, int paramIndex, int sqlType, String typeName, Object inValue) - throws SQLException { + public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName, + Object inValue) throws SQLException { setParameterValueInternal(ps, paramIndex, sqlType, typeName, null, inValue); } @@ -177,9 +174,8 @@ public abstract class StatementCreatorUtils { * @throws SQLException if thrown by PreparedStatement methods * @see SqlTypeValue */ - private static void setParameterValueInternal( - PreparedStatement ps, int paramIndex, int sqlType, String typeName, Integer scale, Object inValue) - throws SQLException { + private static void setParameterValueInternal(PreparedStatement ps, int paramIndex, int sqlType, + String typeName, Integer scale, Object inValue) throws SQLException { String typeNameToUse = typeName; int sqlTypeToUse = sqlType; @@ -190,8 +186,7 @@ public abstract class StatementCreatorUtils { SqlParameterValue parameterValue = (SqlParameterValue) inValue; if (logger.isDebugEnabled()) { logger.debug("Overriding type info with runtime info from SqlParameterValue: column index " + paramIndex + - ", SQL type " + parameterValue.getSqlType() + - ", Type name " + parameterValue.getTypeName()); + ", SQL type " + parameterValue.getSqlType() + ", type name " + parameterValue.getTypeName()); } if (parameterValue.getSqlType() != SqlTypeValue.TYPE_UNKNOWN) { sqlTypeToUse = parameterValue.getSqlType(); @@ -221,9 +216,7 @@ public abstract class StatementCreatorUtils { * Set the specified PreparedStatement parameter to null, * respecting database-specific peculiarities. */ - private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) - throws SQLException { - + private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException { if (sqlType == SqlTypeValue.TYPE_UNKNOWN) { boolean useSetObject = false; sqlType = Types.NULL; @@ -231,9 +224,10 @@ public abstract class StatementCreatorUtils { sqlType = ps.getParameterMetaData().getParameterType(paramIndex); } catch (Throwable ex) { - logger.debug("JDBC 3.0 getParameterType call not supported", ex); - // JDBC driver not compliant with JDBC 3.0 - // -> proceed with database-specific checks + if (logger.isDebugEnabled()) { + logger.debug("JDBC 3.0 getParameterType call not supported - using fallback method instead: " + ex); + } + // JDBC driver not compliant with JDBC 3.0 -> proceed with database-specific checks try { DatabaseMetaData dbmd = ps.getConnection().getMetaData(); String databaseProductName = dbmd.getDatabaseProductName(); -- GitLab