Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-1365

JSVGCanvas shows error, when displaying SVG with javascript

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.17
    • None
    • Scripting
    • None
    • Windows 11, tested on Java 8 and Java 17 (temurin)

    Description

      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.

      Attachments

        1. ksudoku_egyptian.svg
          978 kB
          Bjoern Voigt
        2. simple.svg
          0.5 kB
          Rüdiger Groß-Hardt
        3. TestClass.java
          0.6 kB
          Rüdiger Groß-Hardt
        4. pom.xml
          1 kB
          Rüdiger Groß-Hardt

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            hardy_65 Rüdiger Groß-Hardt

            Dates

              Created:
              Updated:

              Slack

                Issue deployment