Default statement creator should work with 0 parameters specified. Bugzilla #321
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 19 May 2005 14:51:05 +0000 (14:51 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 19 May 2005 14:51:05 +0000 (14:51 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1537 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/attrresolv/provider/JDBCDataConnector.java

index 73f2ce8..d4097cc 100644 (file)
@@ -614,23 +614,17 @@ class DefaultStatementCreator implements JDBCStatementCreator {
        public void create(PreparedStatement preparedStatement, Principal principal, String requester, Dependencies depends)
                        throws JDBCStatementCreatorException {
 
+               log.debug("Creating prepared statement.  Substituting principal: (" + principal.getName() + ")");
+               // Tried using ParameterMetaData to determine param count, but it fails, so...
                try {
-                       log.debug("Creating prepared statement.  Substituting principal: (" + principal.getName() + ")");
-                       preparedStatement.setString(1, principal.getName());
-                       // Tried using ParameterMetaData to determine param count, but it fails, so...
-                       try {
-                               int i = 2;
-                               while (true) {
-                                       preparedStatement.setString(i++, principal.getName());
-                               }
-                       } catch (SQLException e) {
-                               // Ignore any additional exceptions, assume parameters simply don't exist.
+                       int i = 1;
+                       while (true) {
+                               preparedStatement.setString(i++, principal.getName());
                        }
                } catch (SQLException e) {
-                       log.error("Encountered an error while creating prepared statement: " + e);
-                       throw new JDBCStatementCreatorException("Encountered an error while creating prepared statement: "
-                                       + e.getMessage());
+                       // Ignore any additional exceptions, assume parameters simply don't exist.
                }
+
        }
 }