[Geoserver-devel] Problem with inserting boolean values in feature

Geoserver developers,

If I try to insert a feature that has a boolean element "isValid", I get
an error:

  StackTrace: java.lang.RuntimeException: problem creating feature
    at org.vfny.geoserver.wfs.requests.TransactionFeatureHandler.endElement(TransactionFeatureHandler.java:298)
    at org.geotools.gml.GMLFilterGeometry.endElement(GMLFilterGeometry.java:203)
    at org.geotools.gml.GMLFilterDocument.endElement(GMLFilterDocument.java:286)
    at org.xml.sax.helpers.ParserAdapter.endElement(ParserAdapter.java:626)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:405)
    at org.vfny.geoserver.wfs.requests.readers.TransactionXmlReader.read(TransactionXmlReader.java:78)
    at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:435)
    at org.geoserver.request.Dispatcher.post(Dispatcher.java:301)
    at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:181)
    at org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:52)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:357)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:103)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
  Caused by: IllegalAttribute: java.lang.Boolean , but got java.lang.String
    at org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:228)
    at org.geotools.feature.DefaultFeature.setAttributes(DefaultFeature.java:269)
    at org.geotools.feature.DefaultFeature.<init>(DefaultFeature.java:97)
    at org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:171)
    at org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:154)
    at org.vfny.geoserver.wfs.requests.TransactionFeatureHandler.endElement(TransactionFeatureHandler.java:287)
    ... 43 more
  Caused by: java.lang.IllegalArgumentException: java.lang.String is not an acceptable class for isValid as it is not assignable from class java.lang.Boolean
    at org.geotools.feature.DefaultAttributeType.validate(DefaultAttributeType.java:375)
    at org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:225)
    ... 48 more

If I update an existing feature there is no problem (of course, I had to
hand-make that feature first in PostGIS). I have a schema.xml in my
featureType directory that has the element with type="xs:boolean".

I found this thread:
  http://osdir.com/ml/gis.geoserver.user/2005-07/msg00050.html
that seems relevant. Does anyone know whether this should be fixed in
the current Geoserver? I'm using a 1.5.1 nightly build.

Regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600

Hi Gertjan,

Appears you have found another bug... not sure if it crept in after the thread you mentioned or not...I have opened a new jira for this against 1.5.2.

http://jira.codehaus.org/browse/GEOS-1197\\

-Justin

Gertjan van Oosten wrote:

Geoserver developers,

If I try to insert a feature that has a boolean element "isValid", I get
an error:

  StackTrace: java.lang.RuntimeException: problem creating feature
    at org.vfny.geoserver.wfs.requests.TransactionFeatureHandler.endElement(TransactionFeatureHandler.java:298)
    at org.geotools.gml.GMLFilterGeometry.endElement(GMLFilterGeometry.java:203)
    at org.geotools.gml.GMLFilterDocument.endElement(GMLFilterDocument.java:286)
    at org.xml.sax.helpers.ParserAdapter.endElement(ParserAdapter.java:626)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:405)
    at org.vfny.geoserver.wfs.requests.readers.TransactionXmlReader.read(TransactionXmlReader.java:78)
    at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:435)
    at org.geoserver.request.Dispatcher.post(Dispatcher.java:301)
    at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:181)
    at org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:52)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:357)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:103)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
  Caused by: IllegalAttribute: java.lang.Boolean , but got java.lang.String
    at org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:228)
    at org.geotools.feature.DefaultFeature.setAttributes(DefaultFeature.java:269)
    at org.geotools.feature.DefaultFeature.<init>(DefaultFeature.java:97)
    at org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:171)
    at org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:154)
    at org.vfny.geoserver.wfs.requests.TransactionFeatureHandler.endElement(TransactionFeatureHandler.java:287)
    ... 43 more
  Caused by: java.lang.IllegalArgumentException: java.lang.String is not an acceptable class for isValid as it is not assignable from class java.lang.Boolean
    at org.geotools.feature.DefaultAttributeType.validate(DefaultAttributeType.java:375)
    at org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:225)
    ... 48 more

If I update an existing feature there is no problem (of course, I had to
hand-make that feature first in PostGIS). I have a schema.xml in my
featureType directory that has the element with type="xs:boolean".

I found this thread:
  http://osdir.com/ml/gis.geoserver.user/2005-07/msg00050.html
that seems relevant. Does anyone know whether this should be fixed in
the current Geoserver? I'm using a 1.5.1 nightly build.

Regards,

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org