|
In org.geotools.xml.handlers.ComplexElementHandler is code like this:
if (elements == null) {
if (type != null) {
ElementValue[] vals;
if(type.isMixed()){
vals = new ElementValue[1];
vals[0] = new DefaultElementValue(null, text); }else{
vals = new ElementValue[0];
}
value = type.getValue(elem, vals, attr, hints);
} else {
value = text;
}
return;
}
Which will set
vals = new ElementValue[0];
in some cases.
The class org.geotools.xml.gml.GMLComplexTypes.MultiPointType has a method
public Object getValue(Element element, ElementValue[] value,
Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException {
Element e = value[0].getElement();
Which will always result in an ArrayIndexOutOfBoundsException in this case (Because the array is emtpy and has no [0] element).
Some Implementations of Type like org.geotools.xml.gml.GMLComplexTypes.PointMemberType in this class have a check for this:
public Object getValue(Element element, ElementValue[] value,
Attributes attrs, Map hints) throws SAXException {
if ((value == null) || (value.length == 0) || (value[0] == null)) {
return null; }
if (value.length > 1) {
throw new SAXException("Cannot have more than one geom per "
+ getName());
}
If the ArrayIndexOutOfBoundsException occurs the follwing catch will happen in FeatureReaderItertator:
public boolean hasNext() {
try {
if (reader == null)
return false;
if (reader.hasNext()) {
return true;
} else {
close();
return false;
}
} catch (Exception e) {
close();
return false; }
}
and parsing of the features will end abruptly (and silently!).
Example GML:
<gml:featureMember>
<SCHEMA:TEST fid="TEST.fid--78937a77_15085ea8137_-1b93">
<SCHEMA:ID>529</SCHEMA:ID>
<SCHEMA:bezeichnung>Gruppe NÖ Nord</SCHEMA:bezeichnung>
<SCHEMA:typ>TYP</SCHEMA:typ>
<SCHEMA:typ_lang>LANG</SCHEMA:typ_lang>
<SCHEMA:rt>Z00</SCHEMA:rt>
<SCHEMA:von>35.0000</SCHEMA:von>
<SCHEMA:bis>44.5170</SCHEMA:bis>
<SCHEMA:gesellschaft>AAA</SCHEMA:gesellschaft>
<SCHEMA:shape>
<gml:MultiPoint srsName="http:/>
</SCHEMA:shape>
</SCHEMA:TEST>
</gml:featureMember>
|