Jump to content
  • Be able to assign ProtectionDomain with dynamic Permissions to loaded code

    Assigned User lucianc
    CategoryFeature request

    In recent versions of JasperReports you added the

    static JRClassLoader.setProtectionDomain() function.

    This would allow users to assign a custom protection domain to loaded report code. However, this forces the user to use this constructor since the instance of the classloader is not available:


    public ProtectionDomain(CodeSource codesource,

    PermissionCollection permissions)


    the resulting protection domain has static permissions.


    I would like to use this constructor:


    public ProtectionDomain(CodeSource codesource,

    PermissionCollection permissions,

    ClassLoader classloader,

    Principal[] principals)


    to use dynamic permissions (see javadoc).


    The attached patch agains Jasper 1.3.3 fixes this.



    User Feedback

    Recommended Comments

    We cannot accept this path as is since the core JR code needs to retain compatibility with Java 1.3.


    However, we have changed JRClassLoader to use a factory which is responsible for producing a ProtectionDomain for each JRClassLoader instance. Therefore you can refactor your code into a ProtectionDomainFactory implementation and instruct JRClassLoader to use it via setProtectionDomainFactory().


    Closing this.




    Link to comment
    Share on other sites

  • Create New...