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

SecurityException while generating JPEG from SVG string using batik

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7
    • Fix Version/s: None
    • Component/s: SVG Rasterizer
    • Labels:
    • Environment:
      Windows/Linux

      Description

      We are getting exception while exporting chart SVG string to JPEG file.

      Batik Version : 1.7

      Exception :

      java.lang.SecurityException: The application cannot install or remove a security manager when there is already one it place that it did not install.

      Root cause:

      In my webapplication, we already installed the security manager to perform some checks.Now when we try to export chart to JPEG we are invoking batik with arguments "-scriptSecurityOff".it is failed to pass the security checks due to my application is already installed security manager.

      We are invoking batik Main.execute() method by passing arguments.

      String[] inputArr =

      { "-scriptSecurityOff", "-m","JPEG", inputFileName }

      ;
      (new org.apache.batik.apps.rasterizer.Main(inputArr)).execute();

      After debugging the exception, we came to know there are security checks happening in ApplicationSecurityEnforcer.java.

      Class Name : ApplicationSecurityEnforcer.java
      Method Name : enforceSecurity(boolean enforce) {

      if (sm != null && sm != lastSecurityManagerInstalled) {
      // Throw a Security exception: we do not want to override
      // an 'alien' SecurityManager with either null or
      // a new SecurityManager.
      throw new SecurityException
      (Messages.getString(EXCEPTION_ALIEN_SECURITY_MANAGER));
      }

      Please let us know , how to resolve the issue without commenting above code in ApplicationSecurityEnforcer.java, when security Manager is already installed.

      find the link somebody got the same kind of exception, but we don't have any solution in below link.

      https://community.oracle.com/thread/1546085?start=0&tstart=0

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kunkasurendra Surendra Babu Kunka
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 168h
                168h
                Remaining:
                Remaining Estimate - 168h
                168h
                Logged:
                Time Spent - Not Specified
                Not Specified