#9 No handling of IllegalStateException

open
nobody
None
5
2007-07-11
2007-07-11
hanskr
No

In List lius.index.xml.XmlFileIndexer.getAllDocumentNs(Document doc) there is a call to Element org.jdom.Document.getRootElement()

However there is no handling of the IllegalStateException that can be thrown here.

If indexing a directory containing a malformed xml-file, this will cause the process to stop instead of skipping the file and continuing.

My current fix is to add "throws IllegalStateException" to the following methods

List lius.index.xml.XmlFileIndexer.getAllDocumentNs(Document doc)

Collection lius.index.xml.XmlFileIndexer.getPopulatedLiusFields(Object xml, Collection liusXmlFields)

void lius.index.Indexer.index(String indexDir)

and handle the problem in my own app (that is calling Indexer.index).

Discussion