[Geoserver-devel] [jira] Created: (GEOS-1361) BUG under GeoServer SLD rendering process with Oracle Spatial

BUG under GeoServer SLD rendering process with Oracle Spatial
-------------------------------------------------------------

                 Key: GEOS-1361
                 URL: http://jira.codehaus.org/browse/GEOS-1361
             Project: GeoServer
          Issue Type: Bug
    Affects Versions: 1.5.3
         Environment: Windows XP SP2, Tomcat 5.0.18
            Reporter: Daniel Luna Rodríguez
            Assignee: Andrea Aime

I detect a possible bug under GeoServer SLD rendering process with Oracle Spatial.

Primary i applyed a classification over a string field in a shapefile.
It was fine and without any problem.

This field has values like 'A'.'AF','0','EN'....

<?xml version="1.0" encoding="ISO-8859-1"?>
<sld:StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld&quot;
xmlns:sld="http://www.opengis.net/sld&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <sld:NamedLayer>
    <sld:Name>MyShape</sld:Name>
    <sld:UserStyle>
      <sld:Name>Style1</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:Name>Not assigned</sld:Name>
          <sld:Title>Not assigned</sld:Title>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>X_TIPLAMP</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <sld:PointSymbolizer>
            <sld:Graphic>
              <sld:Mark>
                <sld:WellKnownName>circle</sld:WellKnownName>
                <sld:Stroke>
                  <sld:CssParameter name="stroke">#000000</sld:CssParameter>
                  <sld:CssParameter name="stroke-width">1</sld:CssParameter>
                  <sld:CssParameter name="stroke-opacity">1.0</sld:CssParameter>
                </sld:Stroke>
              </sld:Mark>
              <sld:Size>18</sld:Size>
              <sld:Rotation>0</sld:Rotation>
            </sld:Graphic>
          </sld:PointSymbolizer>
          <sld:PointSymbolizer>
            <sld:Graphic>
              <sld:Mark>
                <sld:WellKnownName>circle</sld:WellKnownName>
                <sld:Fill>
                  <sld:CssParameter name="fill">#000000</sld:CssParameter>
                  <sld:CssParameter name="fill-opacity">1.0</sld:CssParameter>
                </sld:Fill>
              </sld:Mark>
.....

When i take the same sld and i adapt it to a similar structure in an Oracle Spatial Database, over a similar VARCHAR field and same values, i get the next error at tomcat console:

************************************************************

GetMap Request
version: 1.1.1
output format: image/png
width height: 457,800
bbox: Env[206775.511094 : 280287.579321, 4118932.435112 : 4160926.204087]
layers: topp:X_PUNTOLUZ
styles: INVIEM_CLASIF_ORA_PUNTOLUZ_TIPLAMP
27588110 [GRAVE] org.geotools.data.jdbc.JDBC1DataStore - Error Performing SQL qu
ery: SELECT "X_RID", "X_TIPLAMPARA", "GEOMETRY1" FROM "X_PUNTOLUZ" WHERE (SDO_RE
LATE("GEOMETRY1",MDSYS.SDO_GEOMETRY(2003,23030,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,
1003,3),MDSYS.SDO_ORDINATE_ARRAY(205121.4895588925,4117278.4135768795,281941.600
85610754,4162580.2256221203)),'mask=anyinteract querytype=WINDOW') = 'TRUE' AND
((((((((((("X_TIPLAMPARA" = 0 OR "X_TIPLAMPARA" = 'F') OR "X_TIPLAMPARA" = 'FC'
) OR "X_TIPLAMPARA" = 'H') OR "X_TIPLAMPARA" = 'HM') OR "X_TIPLAMPARA" = 'I') OR
"X_TIPLAMPARA" = 'IND') OR "X_TIPLAMPARA" = 'LM') OR "X_TIPLAMPARA" = 'SM') OR
"X_TIPLAMPARA" = 'VM') OR "X_TIPLAMPARA" = 'VSAP') OR "X_TIPLAMPARA" = 'VSBP'))
java.sql.SQLException: ORA-01722: n- mero no vßlido
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
        at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1060)
        at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.jav
a:830)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1132)
        at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
1272)
        at org.geotools.data.jdbc.JDBC1DataStore.executeQuery(JDBC1DataStore.jav
a:926)
        at org.geotools.data.jdbc.JDBC1DataStore.getFeatureReader(JDBC1DataStore
.java:669)
        at org.geotools.data.jdbc.JDBCFeatureCollection.reader(JDBCFeatureCollec
tion.java:78)

************************************************************

it sounds like that if there's a numeric value in a VARCHAR field, then the SQL string is not correct.

see
.... X_TIPLAMPARA" = 0 OR "X_TIPLAMPARA" = 'F' ... in the sample error

it should be like

... X_TIPLAMPARA" = "0" OR "X_TIPLAMPARA" = 'F' ...

In my sld at the moment i've changed

       <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>X_TIPLAMP</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>

with

            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>X_TIPLAMP</ogc:PropertyName>
              <ogc:Literal>'0'</ogc:Literal>
            </ogc:PropertyIsEqualTo>

and works fine

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira