NullPointerException in XMLSAXHandler: locator is null ------------------------------------------------------
Key: GEOT-801 URL: http://jira.codehaus.org/browse/GEOT-801 Project: GeoTools Type: Bug Components: main Versions: 2.2, 2.1.0, 2.1.1, 2.2.M0, 2.2.M1, 2.2.M2, 2.2-RC0 Environment: Java 1.4.2_08, Windows 2000 Pro, Tomcat 5.0.28 Reporter: Timo Thomas Assigned to: James Macgill Priority: Critical Attachments: XMLSAXHandler.java When XMLSaxHandler is catching exceptions or the methods error(), fatalError() or warning() are called, it logs the column and line number using the locator object, which is a private field in XMLSAXHandler. In some environments such as Tomcat 5.0, the locator object is null (either never set or setDocumentLocator() is never called - I didn't track it down to this point). I assume this depends on the xml parsers registered here. The methods mentioned do not check this, resulting in NullPointerExceptions. Fix: Whereever the locator object is used, check it on null, and do not use it if it's null (see attached source). I don't know if the standard DefaultHandler interface implemented here requires the setDocumentLocator() method to be always called with a non-null value. But I think it doesn't hurt to check on null to add robustness. -- 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: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel