[jboss-cvs] javassist/src/main/javassist/util/proxy ...

Shigeru Chiba chiba at is.titech.ac.jp
Sun Mar 9 09:07:10 EDT 2008


  User: chiba   
  Date: 08/03/09 09:07:10

  Modified:    src/main/javassist/util/proxy  SecurityActions.java
  Log:
  preparation for 3.7.1 release
  
  Revision  Changes    Path
  1.2       +106 -135  javassist/src/main/javassist/util/proxy/SecurityActions.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SecurityActions.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/util/proxy/SecurityActions.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- SecurityActions.java	12 Feb 2008 18:55:46 -0000	1.1
  +++ SecurityActions.java	9 Mar 2008 13:07:10 -0000	1.2
  @@ -23,140 +23,111 @@
   import java.security.PrivilegedActionException;
   import java.security.PrivilegedExceptionAction;
   
  -class SecurityActions
  -{
  -    static Method[] getDeclaredMethods(final Class clazz)
  -    {
  +class SecurityActions {
  +    static Method[] getDeclaredMethods(final Class clazz) {
          if (System.getSecurityManager() == null)
  -       {
             return clazz.getDeclaredMethods();
  -       }
  -       else
  -       {
  -          return (Method[])AccessController.doPrivileged(new PrivilegedAction() {
  -
  -            public Object run()
  -            {
  +        else {
  +            return (Method[]) AccessController
  +                    .doPrivileged(new PrivilegedAction() {
  +                        public Object run() {
                  return clazz.getDeclaredMethods();
  -            }});
  +                        }
  +                    });
          }
       }
       
  -    static Constructor[] getDeclaredConstructors(final Class clazz)
  -    {
  +    static Constructor[] getDeclaredConstructors(final Class clazz) {
          if (System.getSecurityManager() == null)
  -       {
             return clazz.getDeclaredConstructors();
  -       }
  -       else
  -       {
  -          return (Constructor[])AccessController.doPrivileged(new PrivilegedAction() {
  -
  -            public Object run()
  -            {
  +        else {
  +            return (Constructor[]) AccessController
  +                    .doPrivileged(new PrivilegedAction() {
  +                        public Object run() {
                  return clazz.getDeclaredConstructors();
  -            }});
  +                        }
  +                    });
          }
       }
       
  -    static Method getDeclaredMethod(final Class clazz, final String name, final Class[] types) throws NoSuchMethodException
  -    {
  +    static Method getDeclaredMethod(final Class clazz, final String name,
  +            final Class[] types) throws NoSuchMethodException {
          if (System.getSecurityManager() == null)
  -       {
             return clazz.getDeclaredMethod(name, types);
  -       }
  -       else
  -       {
  -          try
  -          {
  -             return (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -
  -                public Object run()throws Exception
  -                {
  +        else {
  +            try {
  +                return (Method) AccessController
  +                        .doPrivileged(new PrivilegedExceptionAction() {
  +                            public Object run() throws Exception {
                      return clazz.getDeclaredMethod(name, types);
  -                }});
             }
  -          catch(PrivilegedActionException e)
  -          {
  -             if (e.getCause() instanceof NoSuchMethodException)
  -             {
  -                throw (NoSuchMethodException)e.getCause();
  +                        });
                }
  +            catch (PrivilegedActionException e) {
  +                if (e.getCause() instanceof NoSuchMethodException)
  +                    throw (NoSuchMethodException) e.getCause();
  +
                throw new RuntimeException(e.getCause());
             }
          }
       }
       
  -    static Constructor getDeclaredConstructor(final Class clazz, final Class[] types) throws NoSuchMethodException
  +    static Constructor getDeclaredConstructor(final Class clazz,
  +                                              final Class[] types)
  +        throws NoSuchMethodException
       {
          if (System.getSecurityManager() == null)
  -       {
             return clazz.getDeclaredConstructor(types);
  -       }
  -       else
  -       {
  -          try
  -         {
  -            return (Constructor)AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -
  -               public Object run() throws Exception
  -               {
  +        else {
  +            try {
  +                return (Constructor) AccessController
  +                        .doPrivileged(new PrivilegedExceptionAction() {
  +                            public Object run() throws Exception {
                     return clazz.getDeclaredConstructor(types);
  -               }});
            }
  -         catch (PrivilegedActionException e)
  -         {
  -            if (e.getCause() instanceof NoSuchMethodException)
  -            {
  -               throw (NoSuchMethodException)e.getCause();
  +                        });
               }
  +            catch (PrivilegedActionException e) {
  +                if (e.getCause() instanceof NoSuchMethodException)
  +                    throw (NoSuchMethodException) e.getCause();
  +
               throw new RuntimeException(e.getCause());
            }
          }
       }    
       
  -    static void setAccessible(final AccessibleObject ao, final boolean accessible)
  -    {
  +    static void setAccessible(final AccessibleObject ao,
  +                              final boolean accessible) {
          if (System.getSecurityManager() == null)
  -       {
             ao.setAccessible(accessible);
  -       }
  -       else
  -       {
  +        else {
             AccessController.doPrivileged(new PrivilegedAction() {
  -
  -            public Object run() 
  -            {
  +                public Object run() {
                  ao.setAccessible(accessible);
                  return null;
  -            }});
  +                }
  +            });
          }
       }    
       
  -    static void set(final Field fld, final Object target, final Object value) throws IllegalAccessException
  +    static void set(final Field fld, final Object target, final Object value)
  +        throws IllegalAccessException
       {
          if (System.getSecurityManager() == null)
  -       {
             fld.set(target, value);
  -       }
  -       else
  -       {
  -          try
  -         {
  +        else {
  +            try {
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -
  -               public Object run() throws Exception 
  -               {
  +                    public Object run() throws Exception {
                     fld.set(target, value);
                     return null;
  -               }});
            }
  -         catch (PrivilegedActionException e)
  -         {
  -            if (e.getCause() instanceof NoSuchMethodException)
  -            {
  -               throw (IllegalAccessException)e.getCause();
  +                });
               }
  +            catch (PrivilegedActionException e) {
  +                if (e.getCause() instanceof NoSuchMethodException)
  +                    throw (IllegalAccessException) e.getCause();
  +
               throw new RuntimeException(e.getCause());
            }
          }
  
  
  



More information about the jboss-cvs-commits mailing list