You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Bjoern Voigt (Jira)" <ji...@apache.org> on 2024/04/08 21:09:00 UTC

[jira] [Commented] (BATIK-1365) JSVGCanvas shows error, when displaying SVG with javascript

    [ https://issues.apache.org/jira/browse/BATIK-1365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17835048#comment-17835048 ] 

Bjoern Voigt commented on BATIK-1365:
-------------------------------------

This error is also shown, if the Rhino interpreter will be accessed:

 
{code:java}
RhinoInterpreter interpreter = (RhinoInterpreter) svgCanvas.getInterpreter("text/ecmascript");{code}
 

Depending on the SVG file, additional classes may be needed. For instance ksudoku_egyptian.svg from Ksudoku needs this additional class:
{code:java}
org.apache.batik.anim.dom.SVGOMDocument{code}
[^ksudoku_egyptian.svg]

> JSVGCanvas shows error, when displaying SVG with javascript
> -----------------------------------------------------------
>
>                 Key: BATIK-1365
>                 URL: https://issues.apache.org/jira/browse/BATIK-1365
>             Project: Batik
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: 1.17
>         Environment: Windows 11, tested on Java 8 and Java 17 (temurin)
>            Reporter: Rüdiger Groß-Hardt
>            Priority: Minor
>         Attachments: TestClass.java, ksudoku_egyptian.svg, pom.xml, simple.svg
>
>
> When using a JSVGCanvas to display a SVG, which has an <script type="text/ecmascript"/> element, the following error is displayed in a message box: 
> _"Function importClass must be called with a class; had "[JavaPackage org.w3c.dom.DOMImplementationSource]"._ 
> This problem broke our code, when we switched from batik 1.16 to 1.17. 
> The problem seems to be a mismatch between the classes imported from the default ImportInfo.getImports() in RhinoInterpreter.init() and the new RhinoClassShutter, which disables access to all java class, unless somebody adds them to RhinoClassShutter.WHITELIST.
> While it is simple to add the files from ImportInfo.getImports().getClasses() to RhinoClassShutter.WHITELIST, it is difficult to know, whether these classes are essential to the JavaScript scripting support or not.
> Please find attached a simple program and SVG file, which reproduces the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org