Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-2913

JAAS JDBCBackingEngine has the wrong condition to iterate results, no users are returned

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 2.4.0, 3.0.2, 2.3.6, 4.0.0.M3
    • karaf
    • None

    Description

      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()) {

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            mhu Mike Hummel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: