Clear statement parameters before new call.
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / aa / attrresolv / provider / JDBCDataConnector.java
index b03d566..928a721 100644 (file)
@@ -320,6 +320,7 @@ public class JDBCDataConnector extends BaseDataConnector implements DataConnecto
                PreparedStatement preparedStatement = null;
                try {
                        preparedStatement = conn.prepareStatement(searchVal);
+            preparedStatement.clearParameters();
                        statementCreator.create(preparedStatement, principal, requester, depends);
                        rs = preparedStatement.executeQuery();
                        if (!rs.next()) {
@@ -649,8 +650,8 @@ class DependencyStatementCreator implements JDBCStatementCreator {
                        }
 
                } catch (Exception e) {
-                       log.error("Encountered an error while creating prepared statement: " + e);
-                       throw new JDBCStatementCreatorException(
+                       log.error("Encountered an error while creating prepared statement (principal=" + principal.getName() + "): " + e);
+                        throw new JDBCStatementCreatorException(
                                "Encountered an error while creating prepared statement: " + e.getMessage());
                }
        }