GMLFilterGeometry thows NullPointerException
--------------------------------------------
Key: GEOT-742
URL: http://jira.codehaus.org/browse/GEOT-742
Project: GeoTools
Type: Bug
Components: filter & expression
Versions: 2.2.M0
Environment: Java 5.0, Windows XP
Reporter: Pierrick Brihaye
Priority: Minor
Attachments: Test.xml, airports.gml
When trying to get the geometries contained in the attached file (Test.xml)
with the following code snippet :
import java.io.IOException;
import org.geotools.gml.GMLFilterDocument;
import org.geotools.gml.GMLFilterGeometry;
import org.geotools.gml.TestHandler;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
public class Test {
public static void main(String[] args) {
String fileName = "./Test.xml";
try {
TestHandler contentHandler = new TestHandler();
GMLFilterGeometry geometryFilter = new
GMLFilterGeometry(contentHandler);
GMLFilterDocument documentFilter = new
GMLFilterDocument(geometryFilter);
XMLReader parser;
parser =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
parser.setContentHandler(documentFilter);
parser.parse(fileName);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
... I get the following exception :
Exception in thread "main" java.lang.NullPointerException
at
org.geotools.gml.GMLFilterGeometry.gmlCoordinates(GMLFilterGeometry.java:131)
at
org.geotools.gml.GMLFilterDocument$CoordinateReader.readCoordinates(GMLFilterDocument.java:399)
at
org.geotools.gml.GMLFilterDocument.endElement(GMLFilterDocument.java:258)
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 Test.main(Test.java:22)
When trying with the other attached file (aiports.gml)., I get the results I
expect.
I welcome any suggestion to improve the retrieving of geometries in a GML file,
but NPEs should be handled IMHO.
--
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
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel