wfs-t insert fails due to empty GML attribute tag

Description

I dont know if i should open this issue in geotools or geoserver domain, so please forgive
when i am in the wrong project:

If I commit a native udig-PointTool Insert-operation, udig sends following request (according to geoserver-logging):

<?xml version="1.0" encoding="UTF-8"?>
<Transaction xmlns="http://www.opengis.net/wfs"
xmlns:vienna="http://www.wien.gv.at/ows/wfs/gml"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
version="1.0.0" service="WFS" lockAction="ALL">
<Insert>
<vienna:BAGIS_HILFSPUNKTE fid="newvienna:BAGIS_HILFSPUNKTE.9223372036854775807">
<vienna:OBJECTID>0</vienna:OBJECTID>
<vienna:KOMMENTAR></vienna:KOMMENTAR>
<vienna:BA_MA21_ID></vienna:BA_MA21_ID>
<vienna:STATUS></vienna:STATUS>
<vienna:SHAPE>
<gmloint srsName="EPSG:31256">
<gml:coordinates decimal="." cs="," ts=" ">8055.168286854523,345160.1841013599</gml:coordinates>
</gmloint>
</vienna:SHAPE>
<vienna:MOD_USER></vienna:MOD_USER>
</vienna:BAGIS_HILFSPUNKTE>
</Insert>
</Transaction>

but geoserver fails with StringIndexOutOfBoundsException:

java.lang.RuntimeException: Parsing failed for STATUS: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:158)
at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:216)
at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:182)
at org.geotools.xml.impl.ElementHandlerImpl.endElement(ElementHandlerImpl.java:222)
at org.geotools.xml.impl.ParserHandler.endElement(ParserHandler.java:607)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.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.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.geotools.xml.Parser.parse(Parser.java:223)
at org.geotools.xml.Parser.parse(Parser.java:169)
at org.geoserver.wfs.xml.v1_0_0.WfsXmlReader.read(WfsXmlReader.java:72)
at org.geoserver.ows.Dispatcher.parseRequestXML(Dispatcher.java:1154)
at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:446)
at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:206)
....

Seems that the empty STATUS-attribute tag causes this exception.
Because when I manually (STATUS-tag commented out) run the underlying request from geoserver demo request site:

<Transaction version="1.0.0" service="WFS" lockAction="ALL"
xmlns="http://www.opengis.net/wfs"
xmlns:vienna="http://www.wien.gv.at/ows/wfs/gml"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Insert>
<vienna:BAGIS_HILFSPUNKTE fid="newvienna:BAGIS_HILFSPUNKTE.9223372036854775807">
<vienna:OBJECTID>0</vienna:OBJECTID>
<vienna:KOMMENTAR></vienna:KOMMENTAR>
<vienna:BA_MA21_ID></vienna:BA_MA21_ID>
&lt;!<del>&lt;vienna:STATUS&gt;&lt;/vienna:STATUS&gt;</del>&gt;
&lt;vienna:SHAPE&gt;
&lt;gmloint srsName="EPSG:31256"&gt;
&lt;gml:coordinates decimal="." cs="," ts=" "&gt;8055.168286854523,345160.1841013599&lt;/gml:coordinates&gt;
&lt;/gmloint&gt;
&lt;/vienna:SHAPE&gt;
&lt;vienna:MOD_USER&gt;&lt;/vienna:MOD_USER&gt;
&lt;/vienna:BAGIS_HILFSPUNKTE&gt;
&lt;/Insert&gt;
&lt;/Transaction&gt;

I get a SUCCESS.

some more infos:
FeatureType-Definition of Attribute 'STATUS' is Integer - its the only Integer in the schema :

&lt;attribute&gt;
&lt;name&gt;STATUS&lt;/name&gt;
&lt;minOccurs&gt;0&lt;/minOccurs&gt;
&lt;maxOccurs&gt;1&lt;/maxOccurs&gt;
&lt;nillable&gt;true&lt;/nillable&gt;
&lt;/attribute&gt;

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: rudi - Time: Mon, 12 Jul 2010 08:58:13 -0500
---------------------
geoserver-log of udig point insert on featuretype sf:archsites(which comes delivered with geoserver)

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: aaime - Time: Sun, 1 May 2011 02:13:18 -0500
---------------------
This looks like a xml parsing issue. Not sure if it&#39;s still valid, 2.6.0 is old.

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: rudi - Time: Mon, 2 May 2011 02:49:49 -0500
---------------------
I tested with gt snapshot 8. Empty numerical feature attributes in GML of WFS-T insert requests are still encoded as empty string and xml parser fails if it wants for example build a Double from an empty string. I guess this is a correct behaviour for xml-parser, but the wfs-t should go on and simply omit the empty attribute.

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: jdeolive - Time: Mon, 2 May 2011 09:35:55 -0500
---------------------
Not sure I agree... the wfs spec pretty much mandates us to use the convention that omitting an attribute means null instead of treating empty as null. The data being inserted is invalid... and again throwing back a server exception is something that wfs forces us to do.

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: rudi - Time: Mon, 2 May 2011 10:07:01 -0500
---------------------
mhm, now you made it clear. Because the data being inserted is invalid, thrown service exception is legitimate. Ok, so I guess this is no parser issue anymore, thx.

Fixed

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Fix versions

Affects versions

Priority

Medium
Configure