[jboss-cvs] JBossAS SVN: r80794 - projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 11 06:57:04 EST 2008


Author: alesj
Date: 2008-11-11 06:57:04 -0500 (Tue, 11 Nov 2008)
New Revision: 80794

Removed:
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java
Modified:
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
Log:
Set useRealURL=true by default.
Fix usage of VFSUtils.getRealURL, so it takes VirtualFile.
Remove that system property hack.

Deleted: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java	2008-11-11 11:47:15 UTC (rev 80793)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java	2008-11-11 11:57:04 UTC (rev 80794)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.classloading.spi.vfs.policy;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Privileged Blocks
- * @author Anil.Saldhana at redhat.com
- * @since Nov 10, 2008
- */
-class SecurityActions
-{   
-   static String getProperty(final String key, final String defaultValue)
-   {
-      return AccessController.doPrivileged(new PrivilegedAction<String>()
-      {
-         public String run()
-         {
-            return System.getProperty(key, defaultValue);
-         }
-      }); 
-   } 
-}

Modified: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2008-11-11 11:47:15 UTC (rev 80793)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2008-11-11 11:57:04 UTC (rev 80794)
@@ -109,8 +109,8 @@
    @SuppressWarnings("unchecked")
    private Map<String, VirtualFileInfo> vfsCache = Collections.synchronizedMap(new SoftValueHashMap());
    
-   /** JBCL-64: CodeSource should use read vfs url **/
-   private boolean useRealURL = false;
+   /** JBCL-64, JBVFS-77: CodeSource should use real url **/
+   private boolean useRealURL = true;
 
    /**
     * Determine a name from the roots
@@ -253,8 +253,6 @@
       this.name = name;
       this.roots = roots;
       this.excludedRoots = excludedRoots;
-      
-      this.useRealURL = Boolean.valueOf(SecurityActions.getProperty("vfs.codesource.useRealURL", "true"));
    }
 
    @Override
@@ -491,13 +489,23 @@
          }
       }
       return null;
-   } 
+   }
 
+   /**
+    * Do we use real url.
+    *
+    * @return true if real url should be used
+    */
    public boolean isUseRealURL()
    {
       return useRealURL;
    }
 
+   /**
+    * Set use real url flag.
+    *
+     * @param useRealURL the real url flag
+    */
    public void setUseRealURL(boolean useRealURL)
    {
       this.useRealURL = useRealURL;
@@ -632,20 +640,24 @@
       VirtualFile clazz = findChild(path);
       if (clazz == null)
       {
-         log.trace("Unable to determine class file for " + className);
+         if (log.isTraceEnabled())
+            log.trace("Unable to determine class file for " + className);
+
          return null;
       }
       try
       {
          VirtualFile root = findRoot(path);
-         URL codeSourceURL = root.toURL(); 
-         
-         log.trace("getProtectionDomain:className="+ className + 
-               " path="+ path + " codeSourceURL=" + codeSourceURL);
-         
-         Certificate[] certs = null; // TODO JBCL-67 determine certificates 
-         if(this.useRealURL)
-            codeSourceURL = VFSUtils.getRealURL(codeSourceURL);
+         URL codeSourceURL;
+         if(isUseRealURL())
+            codeSourceURL = VFSUtils.getRealURL(root);
+         else
+            codeSourceURL = root.toURL();
+
+         if (log.isTraceEnabled())
+            log.trace("getProtectionDomain:className="+ className + " path="+ path + " codeSourceURL=" + codeSourceURL);
+
+         Certificate[] certs = null; // TODO JBCL-67 determine certificates
          CodeSource cs = new CodeSource(codeSourceURL, certs);
          PermissionCollection permissions = Policy.getPolicy().getPermissions(cs);
          return new ProtectionDomain(cs, permissions);




More information about the jboss-cvs-commits mailing list