Menu

#32 OraReader: Unable to read a geometry collection.

closed-fixed
Dr JTS
core (12)
5
2013-02-01
2013-01-24
Thomas
No

An 'IllegalArgumentException' is thrown when reading a collection containing a point (or multipoint) as second element. This happens because the Oracle ordinate start offset is wrongly compared against coordinate size. Taking the dimension into account could solve issue.

In com.vividsolutions.jts.io.oracle.OraReader.createPoint(GeometryFactory, int, int, int[], int, CoordinateSequence)
"if (!(sOffset >= 1) || !(sOffset <= coords.size()))" should become
"if (!(sOffset >= 1) || !(sOffset <= coords.size() * dim))"

In com.vividsolutions.jts.io.oracle.OraReader.createCollection(GeometryFactory, int, int, int[], int, CoordinateSequence, int) the "switch, case -1:" is not "ended", causing havoc when creating a collection. Adding the "continue" statement could solve the issue.
...
switch (etype) {
case -1:
cont = false; // We are the of the list - get out of here
continue;
...

Attached you will find a unit test that could help in identifying the issue.

Discussion

  • Thomas

    Thomas - 2013-01-24

    Unit test triggering the issue.

     
  • Dr JTS

    Dr JTS - 2013-02-01
    • status: open --> closed-fixed
     
  • Dr JTS

    Dr JTS - 2013-02-01

    Thanks, good catch.

    The testing approach is very useful too - will probably use this to add some more unit tests (since there are some other known bugs in the OraReader code)

     

Log in to post a comment.