DISCLAIMER: This article is not applicable to IGI v5.2.3 or later!
Setting account defaults in IGI is rather like setting account defaults in IBM Security Identity Manager (ISIM). For those familiar with both products, you will recognise that the ISIM screens were copied/pasted into the IGI platform with very little alteration. (One difference, of course, is the ability to set enforcement on attributes, but dealing with that is one for another day!)
Provisioning a new account can be tricky to troubleshoot, however. It seems that the logging levels can be less than helpful in certain circumstances. Consider the dreaded java.lang.NullPointerException! This can be thrown by the provisioning engine when the account defaults code is problematic.
Consider that we have a need to set an attribute in a provisioning target to the value of ATTR2 on our identity record, but only when ATTR1 is set to Y. You might consider using the following code:
if (subject.getPropertyAsString("attr1") == "Y") {
return subject.getPropertyAsString("attr2");
}
The code looks great, but this code will throw our dreaded NPE in certain circumstances. Not only that, but our logs won't actually tell us which attribute and therefore which section of code is causing our NPE. Why does this happen?
Well, the provisioning engine MUST get an object returned from our code in ALL circumstances and the above code only returns a value if ATTR1 is set to Y. To avoid our NPE, we need to complete the code as such:
if (subject.getPropertyAsString("attr1") == "Y") {
return subject.getPropertyAsString("attr2");
} else {
return "";
}
The addition of a return statement within the ELSE clause will ensure we always return something. Our NullPointerException won't appear again...
No comments:
Post a Comment