Index: /home/sgala/Documents/workspace/jetspeed-2/components/security/src/java/org/apache/jetspeed/security/impl/RdbmsPolicy.java
===================================================================
--- /home/sgala/Documents/workspace/jetspeed-2/components/security/src/java/org/apache/jetspeed/security/impl/RdbmsPolicy.java	(revisión: 267185)
+++ /home/sgala/Documents/workspace/jetspeed-2/components/security/src/java/org/apache/jetspeed/security/impl/RdbmsPolicy.java	(copia de trabajo)
@@ -44,8 +44,14 @@
 {
     private static final Log log = LogFactory.getLog(RdbmsPolicy.class);
 
-    /** <p>Default Policy.</p> */
-    private static String defaultPolicy = "sun.security.provider.PolicyFile";
+    /** <p>Default Policy.</p>
+     *  <p>We take a snapshot of the current policy at
+     *  class initialization time and use it as default
+     *  policy. Not sure how right it is, but at least
+     *  it is not specific of any VM implementation.</p>
+     * 
+     */
+    private static Policy defaultPolicy = Policy.getPolicy();
 
     /** <p>InternalPermission Manager Service.</p> */
     private PermissionManager pms = null;
@@ -94,8 +100,11 @@
             // Get the permissions
             perms = pms.getPermissions(user.getPrincipals());
         }
+	if (log.isDebugEnabled()) log.debug("user: " + user);
+	
         if (null != perms)
-        {         
+        {
+            if (log.isDebugEnabled()) log.debug("returned: " + perms + " for user: " + user + " with perms");
             return perms;
         }
         else
@@ -103,14 +112,19 @@
             // TODO Is there a better way to do this?
             // If the permission is not found here then delegate it
             // to the standard java Policy class instance.
-            Policy.setPolicy(RdbmsPolicy.getDefaultPolicy());
-            Policy policy = Policy.getPolicy();
-            policy.refresh();
-            PermissionCollection defaultPerms = policy.getPermissions(codeSource);
+            //Policy.setPolicy(RdbmsPolicy.defaultPolicy);
+            //Policy policy = Policy.getPolicy();
+            defaultPolicy.refresh();
+            PermissionCollection defaultPerms = defaultPolicy.getPermissions(codeSource);
+	    
             // Revert back to the current policy.
-            Policy.setPolicy(this);
+            //Policy.setPolicy(this);
             // Return the default permission collection.
+	    if (log.isDebugEnabled()) log.debug("returned defaultPolicy permissions for null user or null user perms.");
             return defaultPerms;
+	    //perms = new java.security.Permissions();
+            //perms.add(new java.security.AllPermission());
+	    //return perms;
         }
     }
 
@@ -124,7 +138,8 @@
      */
     public static void setDefaultPolicy(Policy policy)
     {
-        RdbmsPolicy.defaultPolicy = policy.getClass().getName();
+        if (log.isDebugEnabled()) log.debug("RdbmsPolicy setDefaultPolicy called. (noop)");
+        //RdbmsPolicy.defaultPolicy = policy; //.getClass().getName();
     }
 
     /**
@@ -134,7 +149,7 @@
      * are returned when checking againt the <code>RdbmsPolicy</code>.</p>
      * @return The default policy.
      */
-    public static Policy getDefaultPolicy()
+/*    public static Policy getDefaultPolicy()
     {
         try
         {
@@ -143,7 +158,7 @@
         }
         catch (ClassNotFoundException cnfe)
         {
-            cnfe.printStackTrace();
+            return Policy.getPolicy();
         }
         catch (InstantiationException ie)
         {
@@ -156,5 +171,5 @@
 
         return null;
     }
-
+*/
 }
