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

JSVGCanvas shows error, when displaying SVG with javascript

    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. pom.xml
          1 kB
          Rüdiger Groß-Hardt
        3. simple.svg
          0.5 kB
          Rüdiger Groß-Hardt
        4. TestClass.java
          0.6 kB
          Rüdiger Groß-Hardt

        Activity

          People

            Unassigned Unassigned
            hardy_65 Rüdiger Groß-Hardt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: