<div dir="ltr"><div>I have a conundrum - we extract a number of values from AD (like student number) -- and run a DB query to obtain other permissions.</div><div><br></div><div>Not everyone has student numbers.<br></div><div><br></div><div>Here is the conundrum -- where executing the QueryTemplate in DataConnector 'FOO', if the user does not have student number, the 'java.lang.IndexOutOfBoundsException:' is received (see below).</div><div><br></div><div>Would there be any recommendations on how best to avoid this? Thank you.<br></div><div><br></div><div><resolver:DataConnector id="FOO" xsi:type="RelationalDatabase" xmlns="urn:mace:shibboleth:2.0:resolver:dc"><br>           <resolver:Dependency ref="studentNumber" /><br>           <resolver:FailoverDataConnector ref="FOO-staticfailoverconnector" /><br>           <dc:BeanManagedConnection>OracleDataSource</dc:BeanManagedConnection><br>           <QueryTemplate><br>               <![CDATA[                       <br>                       select COLUMN a from TABLE<br>                       where<br>                      STUD='$studentNumber.get(0)'                 <br>               ]]><br>            </QueryTemplate><br>           <Column columnName="COLUMN" attributeID="VALUE" /> <br>          </resolver:DataConnector></div><div><br></div><div><br></div><div><br></div><div>2020-07-20 16:28:24,859 - ERROR [net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.TemplatedExecutableStatementBuilder:209] - [16AE35F4FD704708D0CF2F7C4780D04C] - [] - Error running template<br>org.apache.velocity.exception.VelocityException: Velocity template 889f0339-526f-418e-a42b-2537db8068cc threw an exception<br>        at net.shibboleth.utilities.java.support.velocity.Template.merge(Template.java:238)<br>Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'get' in  class java.util.ArrayList threw exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at 889f0339-526f-418e-a42b-2537db8068cc[line 6, column 57]<br>  at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243)<br>Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0<br> at java.util.ArrayList.rangeCheck(ArrayList.java:657)<br>2020-07-20 16:28:24,860 - DEBUG [net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl:403] - [16AE35F4FD704708D0CF2F7C4780D04C] - [137.82.124.101] - Attribute Resolver 'ShibbolethAttributeResolver': Data connector 'FOO' failed to resolve, invoking failover data connector 'FOO-staticfailoverconnector'.  Reason for failure:<br>net.shibboleth.idp.attribute.resolver.ResolutionException: Error running template<br>    at net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.TemplatedExecutableStatementBuilder.getSQLQuery(TemplatedExecutableStatementBuilder.java:210)<br>Caused by: org.apache.velocity.exception.VelocityException: Velocity template 889f0339-526f-418e-a42b-2537db8068cc threw an exception<br>   at net.shibboleth.utilities.java.support.velocity.Template.merge(Template.java:238)<br>Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'get' in  class java.util.ArrayList threw exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at 889f0339-526f-418e-a42b-2537db8068cc[line 3, column 32]<br>  at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243)<br>Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0<br> at java.util.ArrayList.rangeCheck(ArrayList.java:657)</div></div>