On 26/02/2014 18:14, Jon Warbrick wrote:
> I'm fairly sure that's because (in this case)
> extensionAttribute1.getValues() is an array of length zero, hence the
> IndexOutOfBoundsException when you try to access element 0.
I concur with your analysis.
> I suspect (though I haven't tested it) that you want something like
>
> if (extensionAttribute1.getValues().length() == 1) {
I'd use "if (extensionAttribute1.getValues().length() > 0) {" myself,
fwiw. But I'd still rather set a variable to
extensionAttribute1.getValues() at the beginning to avoid all these
repeated calls to getValues().
> (or perhaps >= 1 if there might be more than one value. And I'm slightly
> puzzled because as far as I can see that should be
>
> if (extensionAttribute1.getValues().length == 1) {
>
> because I think length is a property of an array, not a method [1]...
It's a function, it seems. If I use .length() it works (ie. returns the
length of the string that is my attribute value). If I use .length then
it returns this:
function length() {/*
int length()
*/}
(Can't comment on the documentation, I'm afraid. I just know what
results I'm getting when I test....)
> BTW I managed to setup real logging in my attribute resolver with e.g:
>
> importPackage(Packages.org.slf4j);
> logger =
> LoggerFactory.getLogger("edu.internet2.middleware.shibboleth.resolver.Script.eResources");
>
>
> after which I could go
>
> logger.debug("staff = true");
>
> and have it turn up in the idp-process log. This made debugging somewhat
> easier.
Ah, a useful tip!! Thanks for that....
Cheers,
Sara
--
Sara Hopkins
Support Team
UK Access Management Federation for Education and Research
web: http://www.ukfederation.org.uk/
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
|