Mike Hummel created KARAF-2913:
----------------------------------

             Summary: JAAS JDBCBackingEngine has the wrong condition to iterate 
results, no users are returned
                 Key: KARAF-2913
                 URL: https://issues.apache.org/jira/browse/KARAF-2913
             Project: Karaf
          Issue Type: Bug
          Components: karaf-security
    Affects Versions: 3.0.0
            Reporter: Mike Hummel


In the library org.apache.karaf.jaas.modules in
JDBCBackingEngine in line 195 is the following code:

                while (!usersResultSet.next()) {

this should be

                while (usersResultSet.next()) {

to iterate the results of the query.

An empty USERS table causes the following error - as estimated:

java.sql.SQLException: Illegal operation on empty result set.
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
        at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:841)
        at 
com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5650)
        at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5570)
        at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5610)
        at 
org.apache.karaf.jaas.modules.jdbc.JDBCBackingEngine.listUsers(JDBCBackingEngine.java:196)
        at 
org.apache.karaf.jaas.command.ListUsersCommand.doExecute(ListUsersCommand.java:59)
        at 
org.apache.karaf.jaas.command.ListUsersCommand.doExecute(ListUsersCommand.java:54)
        at 
org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)
...

You have the same issue in line 245:
                while (!rolesResultSet.next()) {





--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to