Revansidd / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

ClassCastException - SpatialIndex - table insert null value in a geometry column - Pull request provided #609

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a table with a geometry column
2. Add a spatial index
3. insert a null value into the geometry column
4. the following ClassCastException will be thrown

Caused by: java.lang.ClassCastException: org.h2.value.ValueNull cannot be cast 
to org.h2.value.ValueGeometry
                at org.h2.mvstore.db.MVSpatialIndex.getKey(MVSpatialIndex.java:169)
                at org.h2.mvstore.db.MVSpatialIndex.add(MVSpatialIndex.java:125)
                at org.h2.mvstore.db.MVTable.addRow(MVTable.java:637)
                ... 37 more

What is the expected output?
null geometries should be ignored in case of the spatial index.

Pull-request to fix that problem
https://github.com/svn2github/H2-Mirror/pull/1

Tests:
I attached a new test method in your org.h2.test.db.TestSpatial which is called
testNullableGeometry

Original issue reported on code.google.com by steve.hr...@gmail.com on 24 Mar 2015 at 3:41

GoogleCodeExporter commented 9 years ago
Thanks a lot for the patch! I have committed it now in trunk (I made a few 
small changes, I hope that's OK for you).

Original comment by thomas.t...@gmail.com on 26 Mar 2015 at 6:56

GoogleCodeExporter commented 9 years ago
You're welcome ;-)

Original comment by steve.hr...@gmail.com on 26 Mar 2015 at 10:07

GoogleCodeExporter commented 9 years ago
Should be fixed with version 1.4.187

Original comment by thomas.t...@gmail.com on 10 Apr 2015 at 6:54