<html><body><div>This little script (inside the EdReadyRole attribute definition) to add a default value if a dependent attribute did not assign value:<br></div><div><br></div><div><pre style="border:1px solid rgb(206,206,206);background-color:rgb(244,244,244);padding:10px;border-radius:2px;margin-top:0px;margin-bottom:0px">if (typeof EdReadyEntitlement != “undefined” && EdReadyEntitlement != null && EdReadyEntitlement.getValues().size !=0)<br>      {value = EdReadyEntitlement.getValues().get(0);<br>      EdReadyRole.addValue(value);}<br>    else<br>     {EdReadyRole.addValue(“Student”);}</pre></div><div><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)"><br></span></div><div dir="ltr"><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248);font-size:13px">triggers this error if the attribute EdReadyEntitlement is in fact empty:</span></div><div dir="ltr"><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)"><br></span></div><div dir="ltr"><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)"><pre class="c-mrkdwn__pre" style="box-sizing:inherit;margin-top:4px;margin-bottom:4px;padding:8px;font-size:12px;line-height:1.50001;font-variant-ligatures:none;word-break:normal;border:1px solid var(--saf-0);border-radius:4px;background:rgba(var(--sk_foreground_min,29,28,29),0.04);font-family:Monaco,Menlo,Consolas,"Courier New",monospace!important">'EdReadyRole':Script did not run successfully
        at net.shibboleth.idp.attribute.resolver.ad.impl.ScriptedAttributeDefinition$AttributeDefinitionScriptEvaluator.execute(ScriptedAttributeDefinition.java:228)
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
</pre></span><div><br></div><div dir="ltr">A colleague smartly told me to replace .size() with .length, which does in fact work without triggering the error. I do not really understand why, given the existence of > 20 other instances of precisely parallel tests of non-existence of dependent attribute in my resolver, accumulated over many years. e.g.,</div><div dir="ltr"><br></div><div dir="ltr"><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">if (typeof uakStudentMAU != "undefined" && uakStudentMAU != null && uakStudentMAU.getValues().</span><span style="font-variant-ligatures:no-common-ligatures;color:#b42419"><b>size()</b></span><span style="font-variant-ligatures:no-common-ligatures"> != 0)</span></p><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"></span></p><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">if (typeof mauPrimaryAffiliation != "undefined" && mauPrimaryAffiliation != null && mauPrimaryAffiliation.getValues().</span><span style="font-variant-ligatures:no-common-ligatures;color:#b42419"><b>size()</b></span><span style="font-variant-ligatures:no-common-ligatures"> != 0)</span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif">…</font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><font face="ui-sans-serif, sans-serif">Should I replace all the .size() with .length condition?</font></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif"><i>Feel free to administer virtual dope slap if accompanied by good explanation!</i></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif">David St Pierre Bantz</font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal" dir="ltr"><span style="font-variant-ligatures:no-common-ligatures;font-size:13px"><font face="ui-sans-serif, sans-serif"><i><br></i></font></span></p></div></div></body></html>