Skip to Content.
Sympa Menu

grouper-dev - Re: [grouper-dev] REST group member list results in java.lang.ArrayIndexOutOfBoundsException: 2 LazySubject.java:163

Subject: Grouper Developers Forum

List archive

Re: [grouper-dev] REST group member list results in java.lang.ArrayIndexOutOfBoundsException: 2 LazySubject.java:163


Chronological Thread 
  • From: Colin Hudler <>
  • To:
  • Subject: Re: [grouper-dev] REST group member list results in java.lang.ArrayIndexOutOfBoundsException: 2 LazySubject.java:163
  • Date: Wed, 03 Mar 2010 12:45:03 -0600

Replying to self..

I can confirm that changing
set.add(strings[i+2])
to:
set.add(strings[i+1])

in subject.jar fixes it.

Colin Hudler wrote:
Hiya,

I am testing grouper 1.5.2 webservice. I noticed that when doing a REST query like .../servicesRest/v1_5_002/groups/uc:apps:boe:irf:users/members I get an exception when it looks up the members, but only when I have a non-empty
ws.subject.result.attribute.names in grouper-ws.properties, and at least one unresolvable subject in the group.

I had some time, so I dug a bit. I hope this helps. Here is an abbreviated stack trace.

groupFindResult=SUCCESS], edu.internet2.middleware.grouper.exception.GrouperException: java.lang.ArrayIndexOutOfBoundsException: 2
at edu.internet2.middleware.grouper.subj.LazySubject.getName(LazySubject.java:163)
at edu.internet2.middleware.grouper.ws.soap.WsSubject.assignSubjectData(WsSubject.java:222)
<snip...>
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
at edu.internet2.middleware.subject.provider.SubjectImpl.toAttributeMap(SubjectImpl.java:42)
at edu.internet2.middleware.grouper.subj.LazySubject.getSubject(LazySubject.java:214)
at edu.internet2.middleware.grouper.subj.LazySubject.getName(LazySubject.java:161)
... 31

This ONLY happens if a member of the group is unresolvable. It only happens in our 1.5.x development systems; the problem is not present in 1.4.x. I found some stuff that changed, which seems relevant, in LazySubject.getSubject():

//there was an error, note, dont return an error for every attribute...
this.subject = new SubjectImpl(LazySubject.this.member.getSubjectId(), error[0],
error[0],
this.getTypeName(), this.getSourceId(), SubjectImpl.toAttributeMap("error", error[0]));
}

Here it calls SubjectImlp.toAttributeMap with two strings, so lets look at toAttributeMap():

SubjectImpl.toAttributeMap(String... strings) {
<snip>
for (int i=0;i<strings.length;i+=2) {
Set<String> set = new LinkedHashSet<String>();
set.add(strings[i+2]); <----- EXCEPTION IS RAISED
map.put(strings[i], set);
}

I have pointed out the section that appears to be at fault. The array does not have enough members to do set.add(strings[i+2]). Alternatively, we do have a custom subject provider, so I might have screwed something else up :-p





Archive powered by MHonArc 2.6.16.

Top of Page