Bug in ArrayList.toArray() method?
From: Keith McLeod (KeithMcLeod_at_discussions.microsoft.com)
Date: 02/18/05
- Previous message: Lars-Inge Tønnessen [VJ# MVP]: "Re: Accessing the windows registry"
- Next in thread: Amit Bhagwat [MSFT]: "RE: Bug in ArrayList.toArray() method?"
- Reply: Amit Bhagwat [MSFT]: "RE: Bug in ArrayList.toArray() method?"
- Reply: Lars-Inge Tønnessen [VJ# MVP]: "Re: Bug in ArrayList.toArray() method?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Feb 2005 07:51:04 -0800
We are writing a GIS application in C# and using Vivid Solutions’ Java
Topology Suite converted to J# for our Computational Geometry library. I am
receiving a null reference exception on the following line of code…
object [] list = spatialIndex.query(new Envelope( minX + (ix * tileWidth),
minX + ((ix + 1) * tileWidth), maxY - (iy * tileHeight), maxY - ((iy + 1) *
tileHeight))).toArray();
This is the method being called…
protected List query(Object searchBounds) {
if (!built) { build(); }
ArrayList matches = new ArrayList();
if (itemBoundables.isEmpty()) {
Assert.isTrue(root.getBounds() == null);
return matches;
}
if (getIntersectsOp().intersects(root.getBounds(), searchBounds)) {
query(searchBounds, root, matches);
}
return matches;
}
I’ve stepped through the code and get all the way to the second "return
matches" statement. The matches object is indeed instantiated and has objects
(in this case they are ints) in it so it is definitely not null. This method
is used throughout the rest of the application and works fine. It just seems
to be the toArray method that is giving us a problem. I’m wondering if this
is a known bug in the J# runtime. We are using the J# redistributable package
1.1 along with the J# supplemental UI library.
One more bit of information, if I step through this code more than twice,
the exception then becomes a System.EngineException and I have to reboot my
computer.
Thank you in advance for any information you can provide regarding this issue.
- Previous message: Lars-Inge Tønnessen [VJ# MVP]: "Re: Accessing the windows registry"
- Next in thread: Amit Bhagwat [MSFT]: "RE: Bug in ArrayList.toArray() method?"
- Reply: Amit Bhagwat [MSFT]: "RE: Bug in ArrayList.toArray() method?"
- Reply: Lars-Inge Tønnessen [VJ# MVP]: "Re: Bug in ArrayList.toArray() method?"
- Messages sorted by: [ date ] [ thread ]