Setting to "" appears to be fine but setting to explicit null caused a NPE for some reason
I only noticed this because I was playing with something vaguely related and needed to actually turn this on in the @AfterClass method and then discovered the bug A better registry of readers and writers for SPARQL results, RDF triple and quads formats would be nice since right now we have several different places doing this (the Jena reader/writer registry, RIOTs language registry, Fuseki also has some MIME type related stuff. I don't know if this is helpful but dotNetRDF has a single central registry which maps MIME types and file extensions to readers/writers for various formats (and vice versa). This gets used for everything from just auto-detecting what the most likely parser is when a user asks to load a file through to content negotiation in HTTP endpoints. Implementing such a strategy for Jena would be harder because of its modular nature and I don't know whether adding yet another registry would just complicate things further (even if all the old registries just became facades to the new registry) Rob On Apr 10, 2012, at 1:18 AM, Paolo Castagna wrote: > rve...@apache.org wrote: >> Also fixed a bug with SysRiot.resetJenaReaders() related to setting the >> RDF/JSON readers and writer class names to null (now uses empty strings >> instead) > > [...] > >> Modified: >> incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/SysRIOT.java >> URL: >> http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/SysRIOT.java?rev=1311528&r1=1311527&r2=1311528&view=diff >> ============================================================================== >> --- >> incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/SysRIOT.java >> (original) >> +++ >> incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/SysRIOT.java >> Tue Apr 10 00:15:25 2012 >> @@ -103,8 +103,8 @@ public class SysRIOT >> RDFReaderFImpl.setBaseReaderClassName("Turtle", jenaTurtleReader) ; >> RDFReaderFImpl.setBaseReaderClassName("TTL", jenaTurtleReader) ; >> >> - RDFReaderFImpl.setBaseReaderClassName("RDF/JSON", null) ; >> - RDFWriterFImpl.setBaseWriterClassName("RDF/JSON", null) ; >> + RDFReaderFImpl.setBaseReaderClassName("RDF/JSON", "") ; >> + RDFWriterFImpl.setBaseWriterClassName("RDF/JSON", "") ; >> } >> >> } > > Yep, I remember that. > > The thing is that there is no explicit way to unregister a reader or a writer. > What's the advantage of using "" instead of null? (I don't like both... ;-)) > Was null causing any problem? > > Perhaps, we should add an explicit unsetBase*ClassName(...) call. > > In future, it would be nice to give users the ability to easily > register/unregister their RDF readers and writers making easy for third > parties to add their own serialization formats and/or parsers > from native formats. > > Paolo