Bug 46476 - Scripting won't work if document doesn't have a URI
Summary: Scripting won't work if document doesn't have a URI
Status: NEW
Alias: None
Product: Batik - Now in Jira
Classification: Unclassified
Component: Scripting (show other bugs)
Version: 1.8
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Batik Developer's Mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-04 20:25 UTC by Cameron McCormack
Modified: 2009-03-27 01:43 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack 2009-01-04 20:25:19 UTC
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().
Comment 1 Maxim Polshcha 2009-03-27 01:42:17 UTC
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 :-)
Comment 2 Maxim Polshcha 2009-03-27 01:43:43 UTC
An error in workaround :-)

...
input = new TranscoderInput(new ByteArrayInputStream(bfs));
input.setURI("http://");
trans.transcode(input, output);
...