DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7080>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7080

Interbase JDBCRealm - Bug # 5564 - Have a safe fix.

           Summary: Interbase JDBCRealm - Bug # 5564 - Have a safe fix.
           Product: Tomcat 4
           Version: 4.0.3 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


On inspecting the code to JDBCReam.java, I made the following change to the method 
credentials().  The short of it is that the string should be tested to
see if null.  If it is null 
then the setNull() method should be called on prepared statement. Not calling the 
setNull() 
method can cause PreparedStatement setString() to fail for other JDBC drivers too.

    
protected PreparedStatement credentials(Connection dbConnection,
                                            String username)
        
throws SQLException {

        if (preparedCredentials == null) {
            StringBuffer sb = new 
StringBuffer("SELECT ");
            sb.append(userCredCol);
            sb.append(" FROM ");
            
sb.append(userTable);
            sb.append(" WHERE ");
            sb.append(userNameCol);
            sb.append(" = 
?");
            preparedCredentials =
                dbConnection.prepareStatement(sb.toString());
        }

          
if ( username == null )
            preparedCredentials.setNull(1,java.sql.Types.VARCHAR);
        
else
          preparedCredentials.setString(1, username);
        return (preparedCredentials);

    
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to