db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess PersistentFieldPrivilegedImpl.java
Date Mon, 28 Jul 2003 08:06:11 GMT
arminw      2003/07/28 01:06:11

  Modified:    src/java/org/apache/ojb/broker/metadata/fieldaccess
                        PersistentFieldPrivilegedImpl.java
  Log:
  #184: use AccessController when reset field
  access too.
  patch by Chris Giordano.
  
  Revision  Changes    Path
  1.5       +19 -3     db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPrivilegedImpl.java
  
  Index: PersistentFieldPrivilegedImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPrivilegedImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersistentFieldPrivilegedImpl.java	11 Jul 2003 07:54:21 -0000	1.4
  +++ PersistentFieldPrivilegedImpl.java	28 Jul 2003 08:06:10 -0000	1.5
  @@ -76,6 +76,7 @@
   public class PersistentFieldPrivilegedImpl extends PersistentFieldDirectAccessImpl
   {
       private SetAccessibleAction setAccessibleAction = new SetAccessibleAction();
  +    private UnsetAccessibleAction unsetAccessibleAction = new UnsetAccessibleAction();
       private static final int ACCESSIBLE_STATE_UNKOWN = 0;
       private static final int ACCESSIBLE_STATE_FALSE = 1;
       private static final int ACCESSIBLE_STATE_SET_TRUE = 2;
  @@ -108,7 +109,10 @@
           }
           finally
           {
  -            if (accessibleState == ACCESSIBLE_STATE_SET_TRUE) field.setAccessible(false);
  +            if (accessibleState == ACCESSIBLE_STATE_SET_TRUE)
  +            {
  +                AccessController.doPrivileged(unsetAccessibleAction);
  +            }
           }
       }
   
  @@ -132,7 +136,10 @@
           }
           finally
           {
  -            if (accessibleState == ACCESSIBLE_STATE_SET_TRUE) field.setAccessible(false);
  +            if (accessibleState == ACCESSIBLE_STATE_SET_TRUE)
  +            {
  +                AccessController.doPrivileged(unsetAccessibleAction);
  +            }
           }
           return result;
       }
  @@ -163,6 +170,15 @@
           public Object run()
           {
               getField().setAccessible(true);
  +            return null;
  +        }
  +    }
  +
  +    private class UnsetAccessibleAction implements PrivilegedAction, Serializable
  +    {
  +        public Object run()
  +        {
  +            getField().setAccessible(false);
               return null;
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message