In InterpreterPool.createInterpreter(), trying to create an Interpreter for a Document that has a null URI will cause null to be returned: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/script/InterpreterPool.java?annotate=578701#l97 null being returned from getDocumentURI() should be checked for and passed through to factory.createInterpreter().
I had the same problem with transcoding data not from file or url but from stream: ... input = new TranscoderInput(new ByteArrayInputStream(bfs)); trans.transcode(input, output); ... throws an exception when input SVG document contains scripting. Otherwise all works fine. It is normal when document have no URI. My workaround is: ... input = new TranscoderInput(new ByteArrayInputStream(bfs)); trans.transcode(input, output); input.setURI("http://"); ... But problem must be fixed in org.apache.batik.script.InterpreterPool in createInterpreter. MalformedURLException have to be processed in other way :-)
An error in workaround :-) ... input = new TranscoderInput(new ByteArrayInputStream(bfs)); input.setURI("http://"); trans.transcode(input, output); ...