# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/work/trunk/nb_all/apisupport/harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: RuntimePolicy.java *** /home/work/trunk/nb_all/apisupport/harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/RuntimePolicy.java No Base Revision --- /home/work/trunk/nb_all/apisupport/harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/RuntimePolicy.java Locally New *************** *** 1,0 **** --- 1,59 ---- + /* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Nokia. Portions Copyright 2006 Nokia. All Rights Reserved. + */ + + package org.netbeans.modules.apisupport.jnlplauncher; + + import java.io.PrintStream; + import java.security.*; + import java.util.Collections; + import java.util.Enumeration; + import java.util.PropertyPermission; + + /** + * Policy giving all permissions to all of the code. + * + * @author Claudiu Chioariu, David Strupl + */ + public class RuntimePolicy extends Policy { + + private static PermissionCollection permissions = + new RuntimePermissionCollection(); + + public PermissionCollection getPermissions(CodeSource codesource) { + return permissions; + } + + public boolean implies(ProtectionDomain domain, Permission permission) { + return getPermissions(domain.getCodeSource()).implies(permission); + } + + public PermissionCollection getPermissions(ProtectionDomain domain) { + return getPermissions(domain.getCodeSource()); + } + + public void refresh() { + } + + static class RuntimePermissionCollection extends PermissionCollection { + + public void add(Permission permission) { + } + + public boolean implies(Permission permission) { + return true; + } + + public Enumeration elements() { + return Collections.enumeration(Collections.EMPTY_LIST); + } + } + } Index: Main.java *** /home/work/trunk/nb_all/apisupport/harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java Base (1.3) --- /home/work/trunk/nb_all/apisupport/harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java Locally Modified (Based On 1.3) *************** *** 15,20 **** --- 15,21 ---- package org.netbeans.modules.apisupport.jnlplauncher; import java.io.File; + import java.security.Policy; /** The JNLP entry point. Does not do much, in future it can do more * of JNLP related stuff. *************** *** 28,33 **** --- 29,35 ---- * @throws Exception for lots of reasons */ public static void main (String args[]) throws Exception { + fixPolicy(); fixNetBeansUser(); org.netbeans.Main.main(args); } *************** *** 52,58 **** --- 54,75 ---- System.setProperty("netbeans.user", newDir); // NOI18N } + /** + * Attempt to give the rest of NetBeans all the + * permissions. The jars besides the one containing this class + * don't have to be signed with this. + */ + private final static void fixPolicy() { + // Grant all the code all persmission + Policy.setPolicy(new RuntimePolicy()); + // Replace the security manager by a fresh copy + // that does the delegation to the permissions system + // -- just to make sure that there is nothing left + // from the JWS + System.setSecurityManager(new SecurityManager()); } + }