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

Update from 4.5 to 5.0 fails when processing authentication.json.patch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: OpenIDM 5.0.0
    • Fix Version/s: OpenIDM 5.0.0
    • Component/s: _Update
    • Labels:
    • Environment:
      OpenIDM version "5.0.0-SNAPSHOT" (revision: 0421867) using MySQL repo

      Description

      Steps to reproduce

      • install OpenIDM 4.5.0 with MySQL as a repo and start it
      • prepare a ZIP of OpenIDM 5.0.0-SNAPSHOT without conf/managed.json.patch (and with references to this file removed from the .checksums.csv file) so that we workaround the bug OPENIDM-6536.
      • copy custom OpenIDM 5.0.0-SNAPSHOT ZIP in openidm/bin/update
      • launch Update:
        ./cli.sh update  --acceptLicense  --user openidm-admin:openidm-admin  --url http://localhost:8080/openidm openidm-5.0.0-SNAPSHOT.zip
        

      The update fails with this error found in the log:

      FINEST: processing archive file: conf/authentication.json.patch
      Aug 31, 2016 11:58:28 AM org.forgerock.openidm.maintenance.upgrade.UpdateManagerImpl$UpdateThread run
      FINE: Failed to install update!
      org.forgerock.json.JsonException: String passed into parsing is not valid JSON
             	at org.forgerock.openidm.util.JsonUtil.parseStringified(JsonUtil.java:131)
             	at org.forgerock.openidm.maintenance.upgrade.UpdateManagerImpl$UpdateThread.applyConfigPatch(UpdateManagerImpl.java:1100)
             	at org.forgerock.openidm.maintenance.upgrade.UpdateManagerImpl$UpdateThread.run(UpdateManagerImpl.java:982)
      Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character (']' (code 93)): expected a value
       at [Source: [
          {
              "operation" : "transform",
              "field" : "/serverAuthContext/authModules",
              "value" : {
                  "script" : {
                      "type" : "text/javascript",
                      "source" : "content.map(function (a) { if (a.name === 'MANAGED_USER' && a.augmentSecurityContext === undefined) { a.augmentSecurityContext = { \"type\" : \"text/javascript\", \"source\" : \"require('auth/customAuthz').setProtectedAttributes(security)\" }; } return a; })"
                  }
              }
          },
      ]
      ; line: 12, column: 2]
             	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1581)
             	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:533)
             	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:462)
             	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:655)
             	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.mapArray(UntypedObjectDeserializer.java:584)
             	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserialize(UntypedObjectDeserializer.java:510)
             	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736)
             	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2726)
             	at org.forgerock.openidm.util.JsonUtil.parseStringified(JsonUtil.java:128)
             	... 2 more
      

      Here is what we find in authentication.json.patch:

      [
          {
              "operation" : "transform",
              "field" : "/serverAuthContext/authModules",
              "value" : {
                  "script" : {
                      "type" : "text/javascript",
                      "source" : "content.map(function (a) { if (a.name === 'MANAGED_USER' && a.augmentSecurityContext === undefined) { a.augmentSecurityContext = { \"type\" : \"text/javascript\", \"source\" : \"require('auth/customAuthz').setProtectedAttributes(security)\" }; } return a; })"
                  }
              }
          },
      ]
      

      => the problem is the extra comma at the end
      (I tested without the comma and it worked ok)

        Attachments

          Activity

            People

            Assignee:
            jake.feasel Jake Feasel
            Reporter:
            laurent.bristiel Laurent Bristiel [X] (Inactive)
            QA Assignee:
            Vojtěch Oczka Vojtěch Oczka
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: