apache/jena — pull request #2 by stain (2013-08-22 11:32:31+00:00)
Title: Fix Jena readers/writers reset

IO_JenaReaders.resetJena() (called by org.apache.jena.riot.IO_Jena.resetJena()) - threw a NullPointerException.

This is fixed by resetting to className "" rather than null - "" is allowed in Property.setProperty().

RDF/XML and RDF/XML-ABBREV readers were not reset - this patch also fixes that. The previous code tried to reset the reader RDFJSON - but that was never registered, so unnecessary.

The IO_JenaWriters.resetJena() is updated to also deregister the new languages NT, RDF/JSON and RDFJSON (here both are registered for some reason).

Side-note: this code remains quite fragile - for instance if the user had set a System.setProperty() to override the classic reader/writers, after a reset that is lost. If additional languages are registered here, then they should also be reset. If the classnames in RDFReaderFImpl and RDFWriterFImpl are changed, then this reset would set the wrong thing.

The "real" fix here would be to add a reset() method to RDFReaderFImpl and RDFWriterFImpl to re-execute what is now just in a static { } block. I did not include that in this patch, as it might be seen as too drastic change. Overall the Class.forName() mechanism in the classic factories is fundamentally flawed - and this is the reason I myself will have to call the reset method (the RIOT writers are not seen by the factory as they are in the separate classloader for the ARQ jar) - this does not work within an environment like OSGi.