We're getting this error
java.lang.NullPointerException
at java.util.ArrayList.<init>(Unknown Source)
at de.mystuff.ExtendedArrayList.<init>(ExtendedArrayList.java:38)
where ExtendedArrayList:38 is
new ArrayList(new ArrayCollection<E>(data));
In short: the ArrayList constructor sometimes seems to choke on our home grown Collection implementation ArrayCollection.
I was unable to reproduce it on my computer even with the exact same version that was distributed to our customers.
But i'm not 100% sure that they are using the JRE we included. So, i googled for some ArrayList.java source code and found openJDK 6b17 which has this
public ArrayList(Collection<? extends E> c) {
elementData = c.toArray();
size = elementData.length;
// c.toArray might (incorrectly) not return Object[] (see 6260652)
if (elementData.getClass() != Object[].class)
elementData = Arrays.copyOf(elementData, size, Object[].class);
}
That would make sense, because if there's no data our ArrayCollection.toArray() returns null. And this constructor looked safe (and worked without exception) for the 1.5.0_09 Sun JDK/JRE implementation we are using.
But openJDK only seems to release for the unix world. Is this code also part of a Windows JRE? And if so, which version?
NB: I know that we have to fix our classes, but i want to make sure i understand the cause of the NullPointerException.