[OPENAM-14565] AM Upgrade NPE when unable to read operational attrs from directory Created: 07/Mar/19  Updated: 11/Apr/19  Resolved: 11/Apr/19

Status: Resolved
Project: OpenAM
Component/s: upgrade
Affects Version/s:, 7.0.0
Fix Version/s: 6.5.2, 7.0.0

Type: Bug Priority: Major
Reporter: Lawrence Yarham Assignee: Lawrence Yarham
Resolution: Fixed Votes: 0
Labels: EDISON
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Target Version/s:
Sprint: AM Sustaining Sprint 60, AM Sustaining Sprint 61, AM Sustaining Sprint 62
Story Points: 3
Needs QA verification:
Functional tests:
Are the reproduction steps defined?:
Yes and I used the same an in the description


Bug description

When performing an AM upgrade (e.g. 6.5.0 to and using DJ 6.5.0 with am-config production profile), the upgrade wizard fails to enable the Upgrade link on the first page.  Reviewing the amUpgrade logs reveals a NullPointerException...

ERROR: Unable to read directory schema, the schema won't be upgraded
No Results Returned: The entry ou=am-config does not include a subschemaSubentry attribute
at org.forgerock.opendj.ldap.LdapException.newLdapException(LdapException.java:246)


ERROR: An error occurred while initializing upgrade steps


        at org.forgerock.openam.upgrade.DirectoryContentUpgrader$UpgradeCTSToMultiValue.isUpgradeNecessary(DirectoryContentUpgrader.java:369)

        at org.forgerock.openam.upgrade.DirectoryContentUpgrader.<init>(DirectoryContentUpgrader.java:162)

This is related to OPENAM-14333, but focussed at making the AM upgrade provide a more graceful failure/warning when it does not have read permission for operational attributes in the directory.

How to reproduce the issue

As per OPENAM-14333.

Expected behaviour
Upgrade should proceed successfully or a warning/error should be provided that better indicates the nature of the failure.
Current behaviour
The Upgrade link is greyed out and the amUpgrade logs provide the error information detailed above.

Work around


Code analysis

The DirectoryContentUpgrader, line 369 does not have a null guard check in place, causing the NPE.  There are other places also within the same class that could benefit.  However, need to consider/test what will happen if this initialization does not fail and directory schema upgrade is required.

Generated at Sun Sep 27 23:40:37 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.