AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws Exception { String allow = Security.getProperty ("policy.allowSystemProperty"); if (allow == null || Boolean.getBoolean (allow)) { String s = SystemProperties.getProperty ("java.security.policy"); logger.log (Component.POLICY, "java.security.policy={0}", s); if (s != null) { boolean only = s.startsWith ("="); if (only) s = s.substring (1); policyFiles.clear (); policyFiles.add (new URL (s)); if (only) return null; } } for (int i = 1; ; i++) { String pname = "policy.url." + i; String s = Security.getProperty (pname); logger.log (Component.POLICY, "{0}={1}", new Object [] { pname, s }); if (s == null) break; policyFiles.add (new URL (s)); } return null; } });
public Object run() throws Exception { LinkedList l = new LinkedList(); for (int i = 1;; i++) { String s = Security.getProperty("policy.file." + i); debug("policy.file." + i + "=" + s); if (s == null) break; l.add(new URL(s)); } String s = System .getProperty("java.security.policy"); debug("java.security.policy=" + s); if (s != null) l.add(new URL(s)); return l; } })); } catch (PrivilegedActionException pae) { error(pae.getException());
  public void refresh()  {        cs2pc.clear();    final List policyFiles = new LinkedList();    try      {        policyFiles.add (new File (DEFAULT_POLICY).toURL());        policyFiles.add (new File (DEFAULT_USER_POLICY).toURL ());        AccessController.doPrivileged(          new PrivilegedExceptionAction()          {            public Object run() throws Exception            {              String allow = Security.getProperty ("policy.allowSystemProperty");              if (allow == null || Boolean.getBoolean (allow))                {                  String s = SystemProperties.getProperty ("java.security.policy");                  logger.log (Component.POLICY, "java.security.policy={0}", s);                  if (s != null)                    {                      boolean only = s.startsWith ("=");                      if (only)                        s = s.substring (1);                      policyFiles.clear ();                      policyFiles.add (new URL (s));                      if (only)                        return null;                    }                }              for (int i = 1; ; i++)                {                  String pname = "policy.url." + i;                  String s = Security.getProperty (pname);                  logger.log (Component.POLICY, "{0}={1}", new Object []                    { pname, s });                  if (s == null)                    break;                  policyFiles.add (new URL (s));                }              return null;            }          });        }    catch (PrivilegedActionException pae)      {        logger.log (Component.POLICY, "reading policy properties", pae);      }    catch (MalformedURLException mue)      {        logger.log (Component.POLICY, "setting default policies", mue);      }    logger.log (Component.POLICY, "building policy from URLs {0}",                policyFiles);    for (Iterator it = policyFiles.iterator(); it.hasNext(); )      {        try          {                URL url = (URL) it.next();                parse(url);          }        catch (IOException ioe)          {            logger.log (Component.POLICY, "reading policy", ioe);            }        }    }