Jon Ruiz - 2013-02-14

I've been seeing the following crash in the field with the CyberLink for Java code:

java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at java.util.Vector.arrayIndexOutOfBoundsException(Vector.java:907)
at java.util.Vector.elementAt(Vector.java:328)
at java.util.Vector.get(Vector.java:442)
at org.cybergarage.xml.NodeList.getNode(GraceRemote:28)
at org.cybergarage.upnp.ControlPoint.getDeviceList(GraceRemote:313)
at org.cybergarage.upnp.ControlPoint.renewSubscriberService$1349ef(GraceRemote:860)
at org.cybergarage.upnp.ControlPoint.renewSubscriberService(GraceRemote:871)
at org.cybergarage.upnp.control.RenewSubscriber.run(GraceRemote:69)
at java.lang.Thread.run(Thread.java:856)

This is occurring on the renewsubscriber thread. There's another thread for removing expired devices. The renew iterates through the devNodeList, the remove deletes entries from the devNodeList and there's no synchronization between the two. Has anyone else seen this problem? Is it as simple as synchronizing the getDevice() and removeDevice() calls? I'm only seeing this in anonymous crash reports, and it's not common, so reproducing and testing isn't an option.