History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GEOT-1828
Type: Bug Bug
Status: Open Open
Priority: Blocker Blocker
Assignee: Andrea Aime
Reporter: Profii
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
GeoTools

throws exception while updating multiple geometry column feature. Bug in OracleFeatureWriter.doUpdate() method

Created: 21/May/08 02:02 PM   Updated: 21/May/08 02:02 PM
Component/s: data oraclespatial
Affects Version/s: 2.4.3
Fix Version/s: None


 Description  « Hide
Throws following exception while updating a feature with more than one GeometryAttriburteTypes in it.

Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 2
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1711)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
20:52:46,411 INFO [STDOUT] OraclePreparedStatement.java:3311)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
at org.geotools.data.oracle.OracleFeatureWriter.doUpdate(OracleFeatureWriter.java:137)

The bug lies within OracleFeatureWriter.java implementation.
-for loop implemented within doUpdate() method breaks as soon as it finds a GeometryAttributeType.
-Where as doInsert() method doesn't breaks, so Inserting a feature with multiple GeometryAttributeTypes works fine in this case.

Here is the code snippit of doUpdate() implementation.

 
            for (int i = 0; i < current.getNumberOfAttributes(); i++) {
                AttributeType type = schema.getAttributeType(i);

                if (type instanceof GeometricAttributeType && !DataUtilities.attributesEqual(current.getAttribute(i), live.getAttribute(i))) {
                    Geometry geometry = (Geometry) current.getAttribute(i);

                    if (geometry == null) {
                        geometry = current.getDefaultGeometry();
                    }

                    LOGGER.fine("ORACLE SPATIAL: geometry to be written:"
                        + geometry);

                    STRUCT struct = converter.toSDO(geometry);
                    statement.setObject(position, struct);
                    LOGGER.fine(
                        "ORACLE SPATIAL: set geometry parameter at position:"
                        + position);
                    position++;
                   break;
                }
            }

Can anyone provide me patch please. I need this fix urgently.

thx,
-Profii



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.