Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-16784

Upgrade to 7 fails with NullPointerException in Saml2EntitySecretsStep

    XMLWordPrintable

    Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • 7.0.0
    • None
    • upgrade
    • AM Sustaining Sprint 78, AM Sustaining Sprint 79
    • 5

      Description

      Bug description

      Upgrade to AM 7 can not be performed

      How to reproduce the issue

      1. Configure AM 6.x with SAML entities
      2. Perform upgrade to 7
      Expected behaviour
      Upgrade should succeed
      
      Current behaviour
      Upgrade fails
      
      excerpt from amUpgrade debug log
      ...
      o.f.o.u.UpgradeServices: 2020-09-07 04:29:16,201: Thread[http-nio-8080-exec-3]: TransactionId[8f317adb-a6c5-4ebe-a5c0-c204d9d3f1ab-3]
      ERROR: An error occurred while initializing upgrade steps
      java.lang.NullPointerException: null
      [CONTINUED]	at org.forgerock.openam.upgrade.steps.secrets.Saml2EntitySecretsStep.addRoleCommands(Saml2EntitySecretsStep.java:211)
      [CONTINUED]	at org.forgerock.openam.upgrade.steps.secrets.Saml2EntitySecretsStep.lambda$addEntityCommands$5(Saml2EntitySecretsStep.java:202)
      [CONTINUED]	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      [CONTINUED]	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
      [CONTINUED]	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
      [CONTINUED]	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      [CONTINUED]	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      [CONTINUED]	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      [CONTINUED]	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      [CONTINUED]	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      [CONTINUED]	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
      [CONTINUED]	at org.forgerock.openam.upgrade.steps.secrets.Saml2EntitySecretsStep.addEntityCommands(Saml2EntitySecretsStep.java:202)
      [CONTINUED]	at org.forgerock.openam.upgrade.steps.secrets.Saml2EntitySecretsStep.readHostedEntitiesInRealm(Saml2EntitySecretsStep.java:189)
      [CONTINUED]	at org.forgerock.openam.upgrade.steps.secrets.Saml2EntitySecretsStep.initialize(Saml2EntitySecretsStep.java:128)
      [CONTINUED]	at org.forgerock.openam.upgrade.UpgradeServices.<init>(UpgradeServices.java:98)
      [CONTINUED]	at org.forgerock.openam.upgrade.UpgradeServices.getInstance(UpgradeServices.java:125)
      [CONTINUED]	at com.sun.identity.config.upgrade.Upgrade.<init>(Upgrade.java:45)
      ...
      

      Code analysis

      org.forgerock.openam.upgrade.steps.secrets.Saml2EntitySecretsStep.java
      ...
          private void addRoleCommands(RoleDescriptorType standardConfig,
                  JAXBElement<BaseConfigType> entityConfig, String realm) {
              List<AttributeType> extendedAttributes = entityConfig.getValue().getAttribute();
              Optional<Credential> credential = createCredentialFromRole(extendedAttributes);
      
              if (credential.isPresent()) {
                  // Add command to add the secret Id identifier to extended configuration
                  Consumer<String> identifierSetter = secretIdIdentifier ->
                          extendedAttributes.add(createAttribute("secretIdIdentifier", singletonList(secretIdIdentifier)));
                  credentialCommandMappings.computeIfAbsent(RealmScopedCredential.of(credential.get(), realm),
                          k -> new ArrayList<>()).add(identifierSetter);
                  entityRoleCount++;
              }
      ...
      

      It seems object for entityConfig is null.

        Attachments

          Issue Links

            Activity

              People

              lawrence.yarham Lawrence Yarham
              bthalmayr Bernhard Thalmayr
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: