<< Instant PropertyChangeSupport | Home | A Groovy AST Viewer >>

Useless Exception Messages

The JVM was nice enough to throw an exception at me. The java.awt.image.Raster code that caught it however could have been more helpful:

for (int i = 0; i < raster.getWidth(); ++i) {
raster.getPixel(i, 0, sample);
smap.addSample(sample);
raster.getPixel(i, ymax, sample);
smap.addSample(sample);
}
java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
That's not too helpful!
Perhaps java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds: x=32, width=30 is more appropriate?

 

This is not uncommon in many APIs, buy something as important as the Java platform should do better. With all the fixes and features that go into each release, refactoring a few error messages would be nice. As the above message stands, I have to set a breakpoint and rerun my program - just enough of a distraction to break my coding flow. Verbose error messages are good!




Add a comment Send a TrackBack