Bug #5119 NegativeArraySizeException handling large geometry objects
Submitted: 20 Aug 2004 5:05 Modified: 31 Mar 2014 7:43
Reporter: Peter Yuill Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:3.1.3 OS:Windows (Windows XP)
Assigned to: Alexander Soklakov CPU Architecture:Any

[20 Aug 2004 5:05] Peter Yuill
Description:
I am using the new spatial features in MySql 4.1 including creation of geometry objects from Well Known Text

Smaller geometry objects work fine, but a large object produces a NegativeArraySizeException when I attempt to retrieve the geometry object with a statement such as:

PreparedStatement toGeom = c.prepareStatement("select GeomFromText(?)");
toGeom.setString(1, inText);
rs = toGeom.executeQuery();

java.sql.SQLException: java.lang.NegativeArraySizeException
	at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:944)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1622)
	at GeometryTest.<init>(GeometryTest.java:21)
	at GeometryTest.main(GeometryTest.java:39)

Using the 3.0.14 production driver does not throw an exception, but the geometry is corrupted with small coordinate errors.

How to repeat:
I have a test program and test data that will reproduce the exception. The test data is rather large (56k) to insert here, but I can email on request.
[20 Aug 2004 9:36] Peter Yuill
I tested against the latest nightly snapshot (20040820) and the exception has been fixed, but the same coordinate corruption observed in 3.0.14 is back. It was fixed in 3.1.3
[20 Aug 2004 12:38] Mark Matthews
I'm not able to repeat this with a large geometry that I can come up with. If you wish, you can post a testcase (even if it's large) via the 'files' tab on the bug report. Only MySQL developers will see it if you choose that option in the 'privacy' drop-down.
[21 Aug 2004 2:45] Peter Yuill
Large geometry text

Attachment: Geom.txt (text/plain), 54.71 KiB.

[21 Aug 2004 2:46] Peter Yuill
Program to reproduce bug with test geometry

Attachment: GeometryTest.java (application/octet-stream, text), 1.38 KiB.

[31 Mar 2014 7:43] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and provided test case doesn't fail with latest c/J 5.1.29. Please, feel free to reopen it if the problem still exists in current driver.