Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-14051

NullPointerException on jdbc explicit tables with explicitMapping type NUMBER.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.0.0, 6.0.0.6, 6.5.0.4, 5.5.1.4
    • Fix Version/s: 7.0.0, 6.5.0.4
    • Component/s: None
    • Labels:
      None

      Description

      Reproduction using MySQL as repo:

      1) We add a "testnum" integer column to the managed user table:

      CREATE  TABLE IF NOT EXISTS `openidm`.`managed_user` (
          `objectid` VARCHAR(38) NOT NULL,
          `rev` VARCHAR(38) NOT NULL,
          `userName` VARCHAR(255),
          `password` VARCHAR(255),
          `testnum` INT,
          ...
      

      2) We declare the column in repo.jdbc.json (using the sample repo.jdbc-mysql-explicit-managed-user.json:

      "explicitMapping" : {
          "managed/user": {
              "table" : "managed_user",
              "objectToColumn": {
                  "_id": "objectid",
                  "_rev" : "rev",
                  "userName": "username",
                  "password": "password",
                  "testnum": {"column" : "effectiveroles", "type" : "NUMBER"},
                  (...)
      

      3) We create a new user with "testnum" not empty and get output as expected:

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"userName": "rsutter", "telephoneNumber": "6669876987", "givenName": "rick", "description": "Just another user", "testnum": 100, "sn": "sutter", "mail": "rick@example.com", "password": "Th3Password"}' --request POST "http://localhost:8080/openidm/managed/user?_action=create"
      
      {
          "_id": "06958be8-4ade-4b67-a477-ddb9b455466a",
          "_rev": "0",
          "userName": "rsutter",
          "testnum": 100,
          (...)
      }
      

      4) We create a new user with "testnum" left out and get a server error with an IDM stack trace:

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"userName": "rsutter2", "telephoneNumber": "6669876987", "givenName": "rick", "description": "Just another user", "sn": "sutter", "mail": "rick@example.com", "password": "Th3Password"}' --request POST "http://localhost:8080/openidm/managed/user?_action=create"
      
      {
          "code": 500,
          "reason": "Internal Server Error",
          "message": "Creating object failed with unexpected failure: null"
      }
      
      Caused by: java.lang.NullPointerException
      	at org.forgerock.openidm.repo.jdbc.impl.query.TracedPreparedStatement.setObject(TracedPreparedStatement.java:232)
      	at org.forgerock.openidm.repo.jdbc.impl.ExplicitTableHandler.populatePrepStatementColumns(ExplicitTableHandler.java:407)
      	at org.forgerock.openidm.repo.jdbc.impl.ExplicitTableHandler.create(ExplicitTableHandler.java:346)
      	at org.forgerock.openidm.repo.jdbc.impl.ExplicitTableHandler.create(ExplicitTableHandler.java:317)
      	at org.forgerock.openidm.repo.jdbc.impl.JDBCRepoService.lambda$handleCreate$5(JDBCRepoService.java:377)
      	... 212 more
      
      

       

       

        Attachments

          Activity

            People

            Assignee:
            brayden.roth-white Brayden Roth-White
            Reporter:
            brayden.roth-white Brayden Roth-White
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: