openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r707937 [2/2] - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ openjpa-jdbc/src/main/java/org/apac...
Date Sun, 26 Oct 2008 04:31:30 GMT
Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java Sat Oct 25 21:31:28 2008
@@ -214,7 +214,7 @@
                 return new String[]{ getFromClassFile(file) };
             if (arg.endsWith(".java"))
                 return new String[]{ getFromJavaFile(file) };
-            if (((Boolean) AccessController.doPrivileged(
+            if ((AccessController.doPrivileged(
                 J2DoPrivHelper.existsAction(file))).booleanValue()) {
                 Collection col = getFromMetaDataFile(file);
                 return (String[]) col.toArray(new String[col.size()]);
@@ -300,7 +300,7 @@
     private String getFromClassFile(File file) throws IOException {
         FileInputStream fin = null;
         try {
-            fin = (FileInputStream) AccessController.doPrivileged(
+            fin = AccessController.doPrivileged(
                 J2DoPrivHelper.newFileInputStreamAction(file));
             return getFromClass(fin);
         } catch (PrivilegedActionException pae) {

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java Sat Oct 25 21:31:28 2008
@@ -75,7 +75,7 @@
         }
 
         if (loader == null) {
-            MultiClassLoader multi = (MultiClassLoader) AccessController
+            MultiClassLoader multi = AccessController
                 .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
             multi.addClassLoader(multi.SYSTEM_LOADER);
             multi.addClassLoader(multi.THREAD_LOADER);
@@ -156,7 +156,7 @@
             _url = -1;
             _urls.clear();
             try {
-                e = (Enumeration) AccessController.doPrivileged(
+                e = AccessController.doPrivileged(
                     J2DoPrivHelper.getResourcesAction(
                         _loader, (String) _locs.get(_loc)));
             } catch (PrivilegedActionException pae) {
@@ -178,7 +178,7 @@
         if (_url == -1 || _url >= _urls.size())
             throw new IllegalStateException();
         try {
-            return (InputStream) AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 J2DoPrivHelper.openStreamAction((URL) _urls.get(_url)));
         } catch (PrivilegedActionException pae) {
             throw (IOException) pae.getException();
@@ -190,7 +190,7 @@
             throw new IllegalStateException();
         File file = new File(URLDecoder.decode(((URL) _urls.get(_url)).
             getFile()));
-        return (((Boolean) AccessController.doPrivileged(
+        return ((AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null;
     }
 

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java Sat Oct 25 21:31:28 2008
@@ -51,7 +51,7 @@
      */
     public ClasspathMetaDataIterator(String[] dirs, MetaDataFilter filter)
         throws IOException {
-        Properties props = (Properties) AccessController.doPrivileged(
+        Properties props = AccessController.doPrivileged(
             J2DoPrivHelper.getPropertiesAction()); 
         String path = props.getProperty("java.class.path");
         String[] tokens = Strings.split(path,
@@ -62,15 +62,15 @@
                 continue;
 
             File file = new File(tokens[i]);
-            if (!((Boolean) AccessController.doPrivileged(
+            if (!(AccessController.doPrivileged(
                 J2DoPrivHelper.existsAction(file))).booleanValue())
                 continue;
-            if (((Boolean) AccessController.doPrivileged(J2DoPrivHelper
+            if ((AccessController.doPrivileged(J2DoPrivHelper
                 .isDirectoryAction(file))).booleanValue())
                 addIterator(new FileMetaDataIterator(file, filter));
             else if (tokens[i].endsWith(".jar")) {
                 try {
-                    ZipFile zFile = (ZipFile) AccessController
+                    ZipFile zFile = AccessController
                         .doPrivileged(J2DoPrivHelper.newZipFileAction(file));
                     addIterator(new ZipFileMetaDataIterator(zFile, filter));
                 } catch (PrivilegedActionException pae) {

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java Sat Oct 25 21:31:28 2008
@@ -113,7 +113,7 @@
 
         _file = (File) _itr.next();
         try {
-            File f = (File) AccessController.doPrivileged(J2DoPrivHelper
+            File f = AccessController.doPrivileged(J2DoPrivHelper
                 .getAbsoluteFileAction(_file));
             return AccessController.doPrivileged(
                 J2DoPrivHelper.toURLAction(f));
@@ -127,7 +127,7 @@
             throw new IllegalStateException();
         FileInputStream fis = null;
         try {
-            fis = (FileInputStream) AccessController.doPrivileged(
+            fis = AccessController.doPrivileged(
                 J2DoPrivHelper.newFileInputStreamAction(_file));
             return fis;
         } catch (PrivilegedActionException pae) {
@@ -157,11 +157,11 @@
         }
 
         public byte[] getContent() throws IOException {
-            long len = ((Long) AccessController.doPrivileged(
+            long len = (AccessController.doPrivileged(
                 J2DoPrivHelper.lengthAction(_file))).longValue();
             FileInputStream fin = null;
             try {
-                fin = (FileInputStream) AccessController.doPrivileged(
+                fin = AccessController.doPrivileged(
                     J2DoPrivHelper.newFileInputStreamAction(_file));
             } catch (PrivilegedActionException pae) {
                  throw (FileNotFoundException) pae.getException();

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java Sat Oct 25 21:31:28 2008
@@ -57,7 +57,7 @@
     public ResourceMetaDataIterator(String rsrc, ClassLoader loader)
         throws IOException {
         if (loader == null) {
-            MultiClassLoader multi = (MultiClassLoader) AccessController
+            MultiClassLoader multi = AccessController
                 .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
             multi.addClassLoader(multi.SYSTEM_LOADER);
             multi.addClassLoader(multi.THREAD_LOADER);
@@ -66,7 +66,7 @@
         }
 
         try {
-            Enumeration e = (Enumeration) AccessController.doPrivileged(
+            Enumeration e = AccessController.doPrivileged(
                 J2DoPrivHelper.getResourcesAction(loader, rsrc));
             while (e.hasMoreElements()) {
                 if (_urls == null)
@@ -92,7 +92,7 @@
         if (_url == -1 || _url >= _urls.size())
             throw new IllegalStateException();
         try {
-            return (InputStream) AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 J2DoPrivHelper.openStreamAction((URL) _urls.get(_url)));
         } catch (PrivilegedActionException pae) {
             throw (IOException) pae.getException();
@@ -104,7 +104,7 @@
             throw new IllegalStateException();
         File file = new File(URLDecoder.decode(((URL) _urls.get(_url)).
             getFile()));
-        return (((Boolean) AccessController.doPrivileged(
+        return ((AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(file))).booleanValue()) ? file :null;
     }
 

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTrackers.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTrackers.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTrackers.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTrackers.java Sat Oct 25 21:31:28 2008
@@ -49,7 +49,7 @@
         for (int i = 0; i < trackers.length; i++) {
             sourceFilePath = (trackers[i].getSourceFile() == null ?
                 _loc.get("source-tracker-file-unknown").getMessage() :
-                (String) AccessController.doPrivileged(
+                AccessController.doPrivileged(
                     J2DoPrivHelper.getAbsolutePathAction(
                         trackers[i].getSourceFile())));
             buf.append("  ").append(_loc.get(

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java Sat Oct 25 21:31:28 2008
@@ -64,7 +64,7 @@
         if (_url == null)
             return null;
         try {
-            return (InputStream) AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 J2DoPrivHelper.openStreamAction(_url));
         } catch (PrivilegedActionException pae) {
             throw (IOException) pae.getException();
@@ -77,7 +77,7 @@
         if (_url == null)
             return null;
         File file = new File(URLDecoder.decode(_url.getPath()));
-        return (((Boolean) AccessController.doPrivileged(
+        return ((AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null;
     }
 

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java Sat Oct 25 21:31:28 2008
@@ -271,7 +271,7 @@
     public void parse(File file) throws IOException {
         if (file == null)
             return;
-        if (!((Boolean) AccessController.doPrivileged(J2DoPrivHelper
+        if (!(AccessController.doPrivileged(J2DoPrivHelper
             .isDirectoryAction(file))).booleanValue())
             parse(new FileMetaDataIterator(file));
         else {
@@ -632,7 +632,7 @@
         if (_loader != null)
             return _loader;
         if (_curLoader == null)
-            _curLoader = (ClassLoader) AccessController.doPrivileged(
+            _curLoader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
         return _curLoader;
     }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java Sat Oct 25 21:31:28 2008
@@ -138,7 +138,7 @@
         File backup = Files.backup(file, false);
         if (backup == null) {
             File parent = file.getParentFile();
-            if (parent != null && !((Boolean) AccessController.doPrivileged(
+            if (parent != null && !(AccessController.doPrivileged(
                 J2DoPrivHelper.existsAction(parent))).booleanValue())
                 AccessController.doPrivileged(
                     J2DoPrivHelper.mkdirsAction(parent));
@@ -198,7 +198,7 @@
         _backup = prepareWrite(file);
         try {
             FileWriter out = new FileWriter(
-                (String) AccessController.doPrivileged(
+                AccessController.doPrivileged(
                     J2DoPrivHelper.getCanonicalPathAction(file)),
                 (flags & APPEND) > 0);
             serialize(out, flags);

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java Sat Oct 25 21:31:28 2008
@@ -51,16 +51,16 @@
      * the file does not exist or a backup could not be created, returns null.
      */
     public static File backup(File file, boolean copy) {
-        if (file == null || !((Boolean) AccessController.doPrivileged(
+        if (file == null || !(AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(file))).booleanValue())
             return null;
 
         // create new file object copy so we don't modify the original
-        String aPath = (String) AccessController.doPrivileged(
+        String aPath = AccessController.doPrivileged(
             J2DoPrivHelper.getAbsolutePathAction(file));
         File clone = new File(aPath);
         File bk = new File(aPath + "~");
-        if (!((Boolean) AccessController.doPrivileged(
+        if (!(AccessController.doPrivileged(
             J2DoPrivHelper.renameToAction(clone, bk))).booleanValue())
             return null;
         if (copy) {
@@ -83,16 +83,16 @@
             return null;
         if (!backup.getName().endsWith("~"))
             backup = new File(backup.getPath() + "~");
-        if (!((Boolean) AccessController.doPrivileged(
+        if (!(AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(backup))).booleanValue())
             return null;
 
         // create new file object copy so we don't modify the original
-        String path = (String) AccessController.doPrivileged(
+        String path = AccessController.doPrivileged(
             J2DoPrivHelper.getAbsolutePathAction(backup)); 
         File clone = new File(path);
         File orig = new File(path.substring(0, path.length() - 1));
-        if (!((Boolean) AccessController.doPrivileged(
+        if (!(AccessController.doPrivileged(
             J2DoPrivHelper.renameToAction(clone, orig))).booleanValue())
             return null;
         if (copy) {
@@ -132,7 +132,7 @@
         if (innerIdx != -1)
             name = name.substring(0, innerIdx);
 
-        URL rsrc = (URL) AccessController.doPrivileged(
+        URL rsrc = AccessController.doPrivileged(
             J2DoPrivHelper.getResourceAction(cls, name + ext)); 
         if (rsrc != null && rsrc.getProtocol().equals("file"))
             return new File(URLDecoder.decode(rsrc.getFile()));
@@ -148,10 +148,10 @@
      */
     public static File getPackageFile(File base, String pkg, boolean mkdirs) {
         if (base == null)
-            base = new File((String) AccessController.doPrivileged(
+            base = new File(AccessController.doPrivileged(
                 J2DoPrivHelper.getPropertyAction("user.dir")));
         if (StringUtils.isEmpty(pkg)) {
-            if (mkdirs && !((Boolean) AccessController.doPrivileged(
+            if (mkdirs && !(AccessController.doPrivileged(
                 J2DoPrivHelper.existsAction(base))).booleanValue())
                 AccessController.doPrivileged(
                     J2DoPrivHelper.mkdirsAction(base));
@@ -161,7 +161,7 @@
         pkg = pkg.replace('.', File.separatorChar);
         File file = null;
         try {
-            if (((String) AccessController.doPrivileged(
+            if ((AccessController.doPrivileged(
                 J2DoPrivHelper.getCanonicalPathAction(base))).endsWith(pkg))
                 file = base;
             else
@@ -173,7 +173,7 @@
             throw new NestableRuntimeException(ioe);
         }
 
-        if (mkdirs && !((Boolean) AccessController.doPrivileged(
+        if (mkdirs && !(AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(file))).booleanValue())
             AccessController.doPrivileged(J2DoPrivHelper.mkdirsAction(file));
         return file;
@@ -195,20 +195,20 @@
             return null;
 
         File file = new File(name);
-        if (((Boolean) AccessController.doPrivileged(
+        if ((AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(file))).booleanValue())
             return file;
 
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
-        URL url = (URL) AccessController.doPrivileged(
+        URL url = AccessController.doPrivileged(
             J2DoPrivHelper.getResourceAction(loader, name)); 
         if (url != null) {
             String urlFile = url.getFile();
             if (urlFile != null) {
                 File rsrc = new File(URLDecoder.decode(urlFile));
-                if (((Boolean) AccessController.doPrivileged(
+                if ((AccessController.doPrivileged(
                     J2DoPrivHelper.existsAction(rsrc))).booleanValue())
                     return rsrc;
             }
@@ -254,7 +254,7 @@
         if ("stderr".equals(file))
             return System.err;
         try {
-            return (FileOutputStream) AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 J2DoPrivHelper.newFileOutputStreamAction(
                     getFile(file, loader)));
         } catch (PrivilegedActionException pae) {
@@ -269,17 +269,17 @@
      */
     public static boolean copy(File from, File to) throws IOException {
         if (from == null || to == null ||
-            !((Boolean) AccessController.doPrivileged(
+            !(AccessController.doPrivileged(
                 J2DoPrivHelper.existsAction(from))).booleanValue())
             return false;
 
         FileInputStream in = null;
         FileOutputStream out = null;
         try {
-            in = (FileInputStream) AccessController.doPrivileged(
+            in = AccessController.doPrivileged(
                 J2DoPrivHelper.newFileInputStreamAction(from));
             BufferedInputStream inbuf = new BufferedInputStream(in);
-            out = (FileOutputStream) AccessController.doPrivileged(
+            out = AccessController.doPrivileged(
                 J2DoPrivHelper.newFileOutputStreamAction(to)); 
             BufferedOutputStream outbuf = new BufferedOutputStream(out);
             for (int b; (b = inbuf.read()) != -1; outbuf.write(b)) ;

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java Sat Oct 25 21:31:28 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.openjpa.lib.util;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 import java.security.PrivilegedAction;
 
@@ -44,10 +45,10 @@
      *
      * @return Annotation[]
      */
-    public static final PrivilegedAction getAnnotationsAction(
+    public static final PrivilegedAction<Annotation []> getAnnotationsAction(
         final AnnotatedElement element) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<Annotation []>() {
+            public Annotation [] run() {
                 return element.getAnnotations();
             }
         };
@@ -62,10 +63,11 @@
      *
      * @return Annotation[]
      */
-    public static final PrivilegedAction getDeclaredAnnotationsAction(
+    public static final PrivilegedAction<Annotation []> 
+        getDeclaredAnnotationsAction(
         final AnnotatedElement element) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<Annotation[]>() {
+            public Annotation [] run() {
                 return element.getDeclaredAnnotations();
             }
         };
@@ -80,10 +82,11 @@
      *
      * @return Boolean
      */
-    public static final PrivilegedAction isAnnotationPresentAction(
-        final AnnotatedElement element, final Class annotationClazz) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> isAnnotationPresentAction(
+        final AnnotatedElement element,
+        final Class<? extends Annotation> annotationClazz) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 return element.isAnnotationPresent(annotationClazz)
                     ? Boolean.TRUE : Boolean.FALSE;
             }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java Sat Oct 25 21:31:28 2008
@@ -23,7 +23,10 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.ServerSocket;
@@ -34,10 +37,13 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
+import java.util.Enumeration;
+import java.util.Properties;
 import java.util.zip.ZipFile;
 
 import serp.bytecode.BCClass;
 import serp.bytecode.BCClassLoader;
+import serp.bytecode.BCField;
 import serp.bytecode.Code;
 import serp.bytecode.FieldInstruction;
 import serp.bytecode.Project;
@@ -104,7 +110,7 @@
  * 2) Methods with no exception thrown. PrivilegedAction is returned from
  *    J2DoPrivHelper.*Action(). E.g.
  *      
- *    ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
+ *    ClassLoader loader = AccessController.doPrivileged(
  *                             J2DoPrivHelper.getClassLoaderAction(clazz));
  *                               
  *    ClassLoader loader = (ClassLoader) (System.getSecurityManager() == null)
@@ -115,7 +121,7 @@
  *    from J2DoPrivHelper.*Action(). E.g.
  *    
  *    try {
- *      method = (Method) AccessController.doPrivileged(
+ *      method = AccessController.doPrivileged(
  *        J2DoPrivHelper.getDeclaredMethodAction(clazz, name, parameterType));
  *    } catch (PrivilegedActionException pae) {
  *      throw (NoSuchMethodException) pae.getException();
@@ -124,7 +130,7 @@
  *    try {
  *      method = (System.getSecurityManager() == null)
  *        ? clazz.getDeclaredMethod(name,parameterType)
- *        : (Method) AccessController.doPrivileged(
+ *        : AccessController.doPrivileged(
  *            J2DoPrivHelper.getDeclaredMethodAction(
  *              clazz, name, parameterType));
  *    } catch (PrivilegedActionException pae) {
@@ -146,12 +152,12 @@
      */
     public static final String getLineSeparator() {
         if (lineSeparator == null) {
-            lineSeparator = (String) AccessController
-                    .doPrivileged(new PrivilegedAction() {
-                        public Object run() {
-                            return System.getProperty("line.separator");
-                        }
-                    });
+            lineSeparator =
+                AccessController.doPrivileged(new PrivilegedAction<String>() {
+                    public String run() {
+                        return System.getProperty("line.separator");
+                    }
+                });
         }
         return lineSeparator;
     }
@@ -164,12 +170,12 @@
      */
     public static final String getPathSeparator() {
         if (pathSeparator == null) {
-            pathSeparator = (String) AccessController
-                    .doPrivileged(new PrivilegedAction() {
-                        public Object run() {
-                            return System.getProperty("path.separator");
-                        }
-                    });
+            pathSeparator =
+                AccessController.doPrivileged(new PrivilegedAction<String>() {
+                    public String run() {
+                        return System.getProperty("path.separator");
+                    }
+                });
         }
         return pathSeparator;
     }
@@ -180,9 +186,9 @@
      * Requires security policy: 'permission java.lang.reflect.ReflectPermission
      * "suppressAccessChecks";'
      */
-    public static final PrivilegedAction setAccessibleAction(
+    public static final PrivilegedAction<Object> setAccessibleAction(
         final AccessibleObject aObj, final boolean flag) {
-        return new PrivilegedAction() {
+        return new PrivilegedAction<Object>() {
             public Object run() {
                 aObj.setAccessible(flag);
                 return (Object) null;
@@ -229,7 +235,7 @@
      * @return Classloader
      */
     public static final PrivilegedAction<ClassLoader> getClassLoaderAction(
-        final Class clazz) {
+        final Class<?> clazz) {
         return new PrivilegedAction<ClassLoader>() {
             public ClassLoader run() {
                 return clazz.getClassLoader();
@@ -246,10 +252,10 @@
      * @return Field
      * @exception NoSuchFieldException
      */
-    public static final PrivilegedExceptionAction getDeclaredFieldAction(
-        final Class clazz, final String name) {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws NoSuchFieldException {
+    public static final PrivilegedExceptionAction<Field> getDeclaredFieldAction(
+        final Class<?> clazz, final String name) {
+        return new PrivilegedExceptionAction<Field>() {
+            public Field run() throws NoSuchFieldException {
                 return clazz.getDeclaredField(name);
             }
         };
@@ -263,10 +269,10 @@
      *   
      * @return Field[]
      */
-    public static final PrivilegedAction getDeclaredFieldsAction(
-        final Class clazz) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Field []> getDeclaredFieldsAction(
+        final Class<?> clazz) {
+        return new PrivilegedAction<Field []>() {
+            public Field[] run() {
                 return clazz.getDeclaredFields();
             }
         };
@@ -281,10 +287,12 @@
      * @return Method
      * @exception NoSuchMethodException
      */
-    public static final PrivilegedExceptionAction getDeclaredMethodAction(
-        final Class clazz, final String name, final Class[] parameterTypes) {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws NoSuchMethodException {
+    public static final PrivilegedExceptionAction<Method> 
+        getDeclaredMethodAction(
+            final Class<?> clazz, final String name, 
+            final Class<?>[] parameterTypes) {
+        return new PrivilegedExceptionAction<Method>() {
+            public Method run() throws NoSuchMethodException {
                 return clazz.getDeclaredMethod(name, parameterTypes);
             }
         };
@@ -298,10 +306,10 @@
      *   
      * @return Method[]
      */
-    public static final PrivilegedAction getDeclaredMethodsAction(
-        final Class clazz) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Method []> getDeclaredMethodsAction(
+        final Class<?> clazz) {
+        return new PrivilegedAction<Method []>() {
+            public Method[] run() {
                 return clazz.getDeclaredMethods();
             }
         };
@@ -315,10 +323,10 @@
      *   
      * @return URL
      */
-    public static final PrivilegedAction getResourceAction(
-        final Class clazz, final String resource) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<URL> getResourceAction(
+        final Class<?> clazz, final String resource) {
+        return new PrivilegedAction<URL>() {
+            public URL run() {
                 return clazz.getResource(resource);
             }
         };
@@ -353,10 +361,10 @@
      *   
      * @return ClassLoader
      */
-    public static final PrivilegedAction getParentAction(
+    public static final PrivilegedAction<ClassLoader> getParentAction(
         final ClassLoader loader) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 return loader.getParent();
             }
         };
@@ -370,10 +378,10 @@
      *   
      * @return URL
      */
-    public static final PrivilegedAction getResourceAction(
+    public static final PrivilegedAction<URL> getResourceAction(
         final ClassLoader loader, final String resource) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<URL>() {
+            public URL run() {
                 return loader.getResource(resource);
             }
         };
@@ -388,10 +396,11 @@
      * @return Enumeration
      * @exception IOException
      */
-    public static final PrivilegedExceptionAction getResourcesAction(
+    public static final PrivilegedExceptionAction<Enumeration<URL>> 
+        getResourcesAction(
         final ClassLoader loader, final String resource) throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<Enumeration<URL>>() {
+            public Enumeration<URL> run() throws IOException {
                 return loader.getResources(resource);
             }
         };
@@ -405,9 +414,10 @@
      *   
      * @return ClassLoader
      */
-    public static final PrivilegedAction getSystemClassLoaderAction() {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<ClassLoader> 
+        getSystemClassLoaderAction() {
+        return new PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 return ClassLoader.getSystemClassLoader();
             }
         };
@@ -421,9 +431,9 @@
      * 
      * @return Boolean
      */
-    public static final PrivilegedAction deleteAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> deleteAction(final File f) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 return f.delete() ? Boolean.TRUE : Boolean.FALSE;
             }
         };
@@ -437,9 +447,9 @@
      *   
      * @return Boolean
      */
-    public static final PrivilegedAction existsAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> existsAction(final File f) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 try {
                     return f.exists() ? Boolean.TRUE : Boolean.FALSE;
                 } catch (NullPointerException npe) {
@@ -457,9 +467,9 @@
      * 
      * @return File
      */
-    public static final PrivilegedAction getAbsoluteFileAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<File> getAbsoluteFileAction(final File f) {
+        return new PrivilegedAction<File>() {
+            public File run() {
                 return f.getAbsoluteFile();
             }
         };
@@ -473,9 +483,10 @@
      *   
      * @return String
      */
-    public static final PrivilegedAction getAbsolutePathAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<String> 
+        getAbsolutePathAction(final File f) {
+        return new PrivilegedAction<String>() {
+            public String run() {
                 return f.getAbsolutePath();
             }
         };
@@ -490,10 +501,11 @@
      * @return String
      * @exception IOException
      */
-    public static final PrivilegedExceptionAction getCanonicalPathAction(
+    public static final PrivilegedExceptionAction<String> 
+        getCanonicalPathAction(
         final File f) throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<String>() {
+            public String run() throws IOException {
                 return f.getCanonicalPath();
             }
         };
@@ -507,9 +519,10 @@
      * 
      * @return Boolean
      */
-    public static final PrivilegedAction isDirectoryAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> 
+        isDirectoryAction(final File f) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 return f.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
             }
         };
@@ -523,9 +536,9 @@
      * 
      * @return Boolean
      */
-    public static final PrivilegedAction isFileAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> isFileAction(final File f) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 return f.isFile() ? Boolean.TRUE : Boolean.FALSE;
             }
         };
@@ -539,9 +552,9 @@
      *   
      * @return Long
      */
-    public static final PrivilegedAction lengthAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Long> lengthAction(final File f) {
+        return new PrivilegedAction<Long>() {
+            public Long run() {
                 return new Long(f.length());
             }
         };
@@ -555,9 +568,10 @@
      * 
      * @return File[]
      */
-    public static final PrivilegedAction listFilesAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<File []> 
+        listFilesAction(final File f) {
+        return new PrivilegedAction<File []>() {
+            public File [] run() {
                 return f.listFiles();
             }
         };
@@ -571,9 +585,9 @@
      *   
      * @return Boolean
      */
-    public static final PrivilegedAction mkdirsAction(final File f) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> mkdirsAction(final File f) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 return f.mkdirs() ? Boolean.TRUE : Boolean.FALSE;
             }
         };
@@ -587,10 +601,10 @@
      *   
      * @return Boolean
      */
-    public static final PrivilegedAction renameToAction(final File from,
-        final File to) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Boolean> renameToAction(
+        final File from, final File to) {
+        return new PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 return from.renameTo(to) ? Boolean.TRUE : Boolean.FALSE;
             }
         };
@@ -602,13 +616,14 @@
      * Requires security policy:
      *   'permission java.io.FilePermission "read";'
      *   
-     * @return Boolean
+     * @return URL
      * @throws MalformedURLException
      */
-    public static final PrivilegedExceptionAction toURLAction(final File file)
+    public static final PrivilegedExceptionAction<URL> toURLAction(
+        final File file)
         throws MalformedURLException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws MalformedURLException {
+        return new PrivilegedExceptionAction<URL>() {
+            public URL run() throws MalformedURLException {
                 return file.toURL();
             }
         };
@@ -623,10 +638,11 @@
      * @return FileInputStream
      * @throws FileNotFoundException
      */
-    public static final PrivilegedExceptionAction newFileInputStreamAction(
+    public static final PrivilegedExceptionAction<FileInputStream> 
+        newFileInputStreamAction(
         final File f) throws FileNotFoundException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws FileNotFoundException {
+        return new PrivilegedExceptionAction<FileInputStream>() {
+            public FileInputStream run() throws FileNotFoundException {
                 return new FileInputStream(f);
             }
         };
@@ -641,10 +657,11 @@
      * @return FileOutputStream
      * @throws FileNotFoundException
      */
-    public static final PrivilegedExceptionAction newFileOutputStreamAction(
+    public static final PrivilegedExceptionAction<FileOutputStream> 
+        newFileOutputStreamAction(
         final File f) throws FileNotFoundException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws FileNotFoundException {
+        return new PrivilegedExceptionAction<FileOutputStream>() {
+            public FileOutputStream run() throws FileNotFoundException {
                 return new FileOutputStream(f);
             }
         };
@@ -659,10 +676,11 @@
      * @return FileOutputStream
      * @throws FileNotFoundException
      */
-    public static final PrivilegedExceptionAction newFileOutputStreamAction(
+    public static final PrivilegedExceptionAction<FileOutputStream> 
+        newFileOutputStreamAction(
         final String f, final boolean append) throws FileNotFoundException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws FileNotFoundException {
+        return new PrivilegedExceptionAction<FileOutputStream>() {
+            public FileOutputStream run() throws FileNotFoundException {
                 return new FileOutputStream(f, append);
             }
         };
@@ -677,10 +695,10 @@
      * @return InetAddress
      * @throws UnknownHostException
      */
-    public static final PrivilegedExceptionAction getByNameAction(
+    public static final PrivilegedExceptionAction<InetAddress> getByNameAction(
         final String hostname) throws UnknownHostException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws UnknownHostException {
+        return new PrivilegedExceptionAction<InetAddress>() {
+            public InetAddress run() throws UnknownHostException {
                 return InetAddress.getByName(hostname);
             }
         };
@@ -695,10 +713,10 @@
      * @return Socket
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction newSocketAction(
+    public static final PrivilegedExceptionAction<Socket> newSocketAction(
         final InetAddress host, final int port) throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<Socket>() {
+            public Socket run() throws IOException {
                 return new Socket(host, port);
             }
         };
@@ -713,10 +731,10 @@
      * @return ServerSocket
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction newServerSocketAction(
+    public static final PrivilegedExceptionAction<ServerSocket> newServerSocketAction(
         final int port) throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<ServerSocket>() {
+            public ServerSocket run() throws IOException {
                 return new ServerSocket(port);
             }
         };
@@ -731,10 +749,10 @@
      * @return Socket
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction acceptAction(
+    public static final PrivilegedExceptionAction<Socket> acceptAction(
         final ServerSocket ss) throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<Socket>() {
+            public Socket run() throws IOException {
                 return ss.accept();
             }
         };
@@ -748,9 +766,9 @@
      *   
      * @return Properties
      */
-    public static final PrivilegedAction getPropertiesAction() {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Properties> getPropertiesAction() {
+        return new PrivilegedAction<Properties>() {
+            public Properties run() {
                 return System.getProperties();
             }
         };
@@ -764,9 +782,10 @@
      *   
      * @return String
      */
-    public static final PrivilegedAction getPropertyAction(final String name) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<String> getPropertyAction(
+        final String name) {
+        return new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(name);
             }
         };
@@ -799,10 +818,10 @@
      * 
      * @return Thread
      */
-    public static final PrivilegedAction newDaemonThreadAction(
+    public static final PrivilegedAction<Thread> newDaemonThreadAction(
         final Runnable target, final String name) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<Thread>() {
+            public Thread run() {
                 Thread thread = new Thread(target, name);
                 thread.setDaemon(true);
                 return thread;
@@ -819,10 +838,10 @@
      * @return InputStream
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction openStreamAction(
+    public static final PrivilegedExceptionAction<InputStream> openStreamAction(
         final URL url) throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<InputStream>() {
+            public InputStream run() throws IOException {
                 return url.openStream();
             }
         };
@@ -837,9 +856,9 @@
      * @return Object
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction getContentAction(
+    public static final PrivilegedExceptionAction<Object> getContentAction(
         final URLConnection con) throws IOException {
-        return new PrivilegedExceptionAction() {
+        return new PrivilegedExceptionAction<Object>() {
             public Object run() throws IOException {
                 return con.getContent();
             }
@@ -855,10 +874,11 @@
      * @return ZipFile
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction newZipFileAction(final File f)
+    public static final PrivilegedExceptionAction<ZipFile> newZipFileAction(
+        final File f)
         throws IOException {
-        return new PrivilegedExceptionAction() {
-            public Object run() throws IOException {
+        return new PrivilegedExceptionAction<ZipFile>() {
+            public ZipFile run() throws IOException {
                 return new ZipFile(f);
             }
         };
@@ -872,9 +892,9 @@
      *   
      * @return serp.bytecode.Code
      */
-    public static final PrivilegedAction newCodeAction() {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<Code> newCodeAction() {
+        return new PrivilegedAction<Code>() {
+            public Code run() {
                 return new Code();
             }
         };
@@ -888,10 +908,11 @@
      *   
      * @return TemporaryClassLoader
      */
-    public static final PrivilegedAction newTemporaryClassLoaderAction(
+    public static final PrivilegedAction<TemporaryClassLoader>
+        newTemporaryClassLoaderAction(
         final ClassLoader parent) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<TemporaryClassLoader>() {
+            public TemporaryClassLoader run() {
                 return new TemporaryClassLoader(parent);
             }
         };
@@ -905,9 +926,10 @@
      *   
      * @return MultiClassLoader
      */
-    public static final PrivilegedAction newMultiClassLoaderAction() {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<MultiClassLoader>
+        newMultiClassLoaderAction() {
+        return new PrivilegedAction<MultiClassLoader>() {
+            public MultiClassLoader run() {
                 return new MultiClassLoader();
             }
         };
@@ -921,19 +943,19 @@
      *   
      * @return BCClassLoader
      */
-    public static final PrivilegedAction newBCClassLoaderAction(
+    public static final PrivilegedAction<BCClassLoader> newBCClassLoaderAction(
         final Project project, final ClassLoader parent) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<BCClassLoader>() {
+            public BCClassLoader run() {
                 return new BCClassLoader(project, parent);
             }
         };
     }
 
-    public static final PrivilegedAction newBCClassLoaderAction(
+    public static final PrivilegedAction<BCClassLoader> newBCClassLoaderAction(
         final Project project) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<BCClassLoader>() {
+            public BCClassLoader run() {
                 return new BCClassLoader(project);
             }
         };
@@ -945,12 +967,12 @@
      * Requires security policy:
      *   'permission java.io.FilePermission "write";'
      * 
-     * @return File
+     * @return null
      * @throws IOException
      */
-    public static final PrivilegedExceptionAction bCClassWrite(
+    public static final PrivilegedExceptionAction<Object> bCClassWrite(
         final BCClass bc, final File f) throws IOException {
-        return new PrivilegedExceptionAction() {
+        return new PrivilegedExceptionAction<Object>() {
             public Object run() throws IOException {
                 bc.write(f);
                 return null;
@@ -966,10 +988,10 @@
      *   
      * @return BCField
      */
-    public static final PrivilegedAction getBCClassFieldsAction(
+    public static final PrivilegedAction<BCField []> getBCClassFieldsAction(
         final BCClass bcClass, final String fieldName) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<BCField []>() {
+            public BCField [] run() {
                 return bcClass.getFields(fieldName);
             }
         };
@@ -983,10 +1005,10 @@
      *   
      * @return BCField
      */
-    public static final PrivilegedAction getFieldInstructionFieldAction(
+    public static final PrivilegedAction<BCField> getFieldInstructionFieldAction(
         final FieldInstruction instruction) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<BCField>() {
+            public BCField run() {
                 return instruction.getField();
             }
         };
@@ -1000,10 +1022,10 @@
      *   
      * @return BCClass
      */
-    public static final PrivilegedAction loadProjectClassAction(
-        final Project project, final Class clazz) {
-        return new PrivilegedAction() {
-            public Object run() {
+    public static final PrivilegedAction<BCClass> loadProjectClassAction(
+        final Project project, final Class<?> clazz) {
+        return new PrivilegedAction<BCClass>() {
+            public BCClass run() {
                 return project.loadClass(clazz);
             }
         };
@@ -1017,10 +1039,10 @@
      *   
      * @return BCClass
      */
-    public static final PrivilegedAction loadProjectClassAction(
+    public static final PrivilegedAction<BCClass> loadProjectClassAction(
         final Project project, final String clazzName) {
-        return new PrivilegedAction() {
-            public Object run() {
+        return new PrivilegedAction<BCClass>() {
+            public BCClass run() {
                 return project.loadClass(clazzName);
             }
         };

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/JavaVersions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/JavaVersions.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/JavaVersions.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/JavaVersions.java Sat Oct 25 21:31:28 2008
@@ -46,7 +46,7 @@
     private static Method INIT_CAUSE = null;
 
     static {
-        String specVersion = (String) AccessController.doPrivileged(
+        String specVersion = AccessController.doPrivileged(
             J2DoPrivHelper.getPropertyAction("java.specification.version")); 
         if ("1.2".equals(specVersion))
             VERSION = 2;

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Localizer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Localizer.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Localizer.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Localizer.java Sat Oct 25 21:31:28 2008
@@ -100,7 +100,7 @@
             return loc;
         else {
             loc = new Localizer(pkg, file, locale,
-                cls == null ? null:(ClassLoader) AccessController.doPrivileged(
+                cls == null ? null:AccessController.doPrivileged(
                     J2DoPrivHelper.getClassLoaderAction(cls)));
             _localizers.put(key, loc);
             return loc;

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/MultiClassLoader.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/MultiClassLoader.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/MultiClassLoader.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/MultiClassLoader.java Sat Oct 25 21:31:28 2008
@@ -48,7 +48,7 @@
      * The standard system class loader.
      */
     public static final ClassLoader SYSTEM_LOADER =
-        (ClassLoader) AccessController.doPrivileged(
+        AccessController.doPrivileged(
             J2DoPrivHelper.getSystemClassLoaderAction());
 
     private List _loaders = new ArrayList(5);
@@ -85,7 +85,7 @@
         for (int i = 0; i < loaders.length; i++) {
             loader = (ClassLoader) itr.next();
             if (loader == THREAD_LOADER)
-                loader = (ClassLoader) AccessController.doPrivileged(
+                loader = AccessController.doPrivileged(
                     J2DoPrivHelper.getContextClassLoaderAction());
             loaders[i] = loader;
         }
@@ -98,7 +98,7 @@
     public ClassLoader getClassLoader(int index) {
         ClassLoader loader = (ClassLoader) _loaders.get(index);
         if (loader == THREAD_LOADER)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
         return loader;
     }
@@ -206,7 +206,7 @@
         for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
             loader = (ClassLoader) itr.next();
             if (loader == THREAD_LOADER)
-                loader = (ClassLoader) AccessController.doPrivileged(
+                loader = AccessController.doPrivileged(
                     J2DoPrivHelper.getContextClassLoaderAction());
             try {
                 return Class.forName(name, false, loader);
@@ -222,13 +222,13 @@
         for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
             loader = (ClassLoader) itr.next();
             if (loader == THREAD_LOADER)
-                loader = (ClassLoader) AccessController.doPrivileged(
+                loader = AccessController.doPrivileged(
                     J2DoPrivHelper.getContextClassLoaderAction());
 
             if (loader == null) // skip 
                 continue;
 
-            rsrc = (URL) AccessController.doPrivileged(
+            rsrc = AccessController.doPrivileged(
                 J2DoPrivHelper.getResourceAction(loader, name)); 
             if (rsrc != null)
                 return rsrc;
@@ -244,14 +244,14 @@
         for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
             loader = (ClassLoader) itr.next();
             if (loader == THREAD_LOADER)
-                loader = (ClassLoader) AccessController.doPrivileged(
+                loader = AccessController.doPrivileged(
                     J2DoPrivHelper.getContextClassLoaderAction());
 
             if (loader == null) // skip
                 continue;
 
             try {
-                rsrcs = (Enumeration) AccessController.doPrivileged(
+                rsrcs = AccessController.doPrivileged(
                     J2DoPrivHelper.getResourcesAction(loader, name)); 
                 while (rsrcs.hasMoreElements()) {
                     rsrc = rsrcs.nextElement();

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ParameterTemplate.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ParameterTemplate.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ParameterTemplate.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ParameterTemplate.java Sat Oct 25 21:31:28 2008
@@ -211,7 +211,7 @@
                 if (_params.containsKey(param.toString()))
                     copy.append(_params.get(param.toString()));
                 else
-                    copy.append((String) AccessController.doPrivileged(
+                    copy.append(AccessController.doPrivileged(
                         J2DoPrivHelper.getPropertyAction(param.toString())));
                 param = null;
             } else if (param != null)

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java Sat Oct 25 21:31:28 2008
@@ -88,12 +88,12 @@
     public static String[] getImplementors(String serviceName,
         ClassLoader loader) {
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
 
         try {
             Set resourceList = new TreeSet();
-            Enumeration resources = (Enumeration) AccessController.doPrivileged(
+            Enumeration resources = AccessController.doPrivileged(
                 J2DoPrivHelper.getResourcesAction(loader, PREFIX + serviceName)); 
             while (resources.hasMoreElements())
                 addResources((URL) resources.nextElement(), resourceList);
@@ -205,7 +205,7 @@
     public static Class[] getImplementorClasses(String serviceName,
         ClassLoader loader, boolean skipMissing) throws ClassNotFoundException {
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
 
         String[] names = getImplementors(serviceName, loader);

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StreamResourceBundleProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StreamResourceBundleProvider.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StreamResourceBundleProvider.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StreamResourceBundleProvider.java Sat Oct 25 21:31:28 2008
@@ -38,7 +38,7 @@
         ClassLoader loader) {
         String rsrc = name.replace('.', '/') + ".properties";
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
 
         InputStream in = loader.getResourceAsStream(rsrc);

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ZipResourceBundleProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ZipResourceBundleProvider.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ZipResourceBundleProvider.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ZipResourceBundleProvider.java Sat Oct 25 21:31:28 2008
@@ -40,7 +40,7 @@
         ClassLoader loader) {
         String rsrc = name.replace('.', '/') + ".properties";
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
 
         InputStream in = loader.getResourceAsStream(rsrc);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java Sat Oct 25 21:31:28 2008
@@ -1308,7 +1308,7 @@
             
             if (xmlTypeClass != null
                 && StringUtils.isEmpty(pcols[i].columnDefinition())
-                && ((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+                && (AccessController.doPrivileged(J2DoPriv5Helper
                     .isAnnotationPresentAction(fm.getDeclaredType(),
                         xmlTypeClass))).booleanValue()) {
                 DBDictionary dict = ((MappingRepository) getRepository())

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementWithMultiplePUs.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementWithMultiplePUs.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementWithMultiplePUs.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementWithMultiplePUs.java Sat Oct 25 21:31:28 2008
@@ -43,7 +43,7 @@
         OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
         Configurations.populateConfiguration(conf, new Options());
         MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
-        ClassLoader loader = (ClassLoader) AccessController
+        ClassLoader loader = AccessController
             .doPrivileged(J2DoPrivHelper.newTemporaryClassLoaderAction(
                 getClass().getClassLoader()));
         Project project = new Project();
@@ -76,7 +76,7 @@
             "META-INF/persistence.xml#second-persistence-unit");
         Configurations.populateConfiguration(conf, opts);
         MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
-        ClassLoader loader = (ClassLoader) AccessController
+        ClassLoader loader = AccessController
             .doPrivileged(J2DoPrivHelper.newTemporaryClassLoaderAction(
                 getClass().getClassLoader()));
         Project project = new Project();
@@ -115,7 +115,7 @@
         opts.setProperty("p", "META-INF/persistence.xml");
         Configurations.populateConfiguration(conf, opts);
         MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
-        ClassLoader loader = (ClassLoader) AccessController
+        ClassLoader loader = AccessController
             .doPrivileged(J2DoPrivHelper.newTemporaryClassLoaderAction(
                 getClass().getClassLoader()));
         Project project = new Project();

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java Sat Oct 25 21:31:28 2008
@@ -467,12 +467,12 @@
         // check immediately whether the user is using any annotations,
         // regardless of mode.  this prevents adding non-entity classes to
         // repository if we're ignoring these annotations in mapping mode
-        if (!((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+        if (!(AccessController.doPrivileged(J2DoPriv5Helper
             .isAnnotationPresentAction(_cls, Entity.class))).booleanValue()
-            && !((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            && !(AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(_cls, Embeddable.class)))
                 .booleanValue()
-            && !((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            && !(AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(_cls, MappedSuperclass.class)))
                 .booleanValue())
             return null;
@@ -678,17 +678,17 @@
             cls = cls.getEnclosingClass();
 
         String rsrc = StringUtils.replace(cls.getName(), ".", "/");
-        ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
+        ClassLoader loader = AccessController.doPrivileged(
             J2DoPriv5Helper.getClassLoaderAction(cls)); 
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPriv5Helper.getSystemClassLoaderAction()); 
         if (loader == null)
             return null;
-        URL url = (URL) AccessController.doPrivileged(
+        URL url = AccessController.doPrivileged(
             J2DoPriv5Helper.getResourceAction(loader, rsrc + ".java")); 
         if (url == null) {
-            url = (URL) AccessController.doPrivileged(
+            url = AccessController.doPrivileged(
                 J2DoPriv5Helper.getResourceAction(loader, rsrc + ".class")); 
             if (url == null)
                 return null;
@@ -782,7 +782,7 @@
                 J2DoPriv5Helper.getDeclaredFieldsAction(
                     meta.getDescribedType())); 
             for (int i = 0; i < fields.length; i++)
-                if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+                if ((AccessController.doPrivileged(J2DoPriv5Helper
                     .isAnnotationPresentAction(fields[i], DetachedState.class)))
                     .booleanValue())
                     meta.setDetachedState(fields[i].getName());
@@ -984,7 +984,7 @@
         fmd.setExplicit(true);
 
         AnnotatedElement el = (AnnotatedElement) member;
-        boolean lob = ((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+        boolean lob = (AccessController.doPrivileged(J2DoPriv5Helper
             .isAnnotationPresentAction(el, Lob.class))).booleanValue();
         if (isMetaDataMode()) {
             switch (pstrat) {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java Sat Oct 25 21:31:28 2008
@@ -1198,7 +1198,7 @@
 
     public void serialize(File file, int flags) throws IOException {
         try {
-            FileWriter out = new FileWriter((String) AccessController
+            FileWriter out = new FileWriter(AccessController
                 .doPrivileged(J2DoPrivHelper.getCanonicalPathAction(file)),
                 (flags & APPEND) > 0);
             serialize(out, flags);

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java Sat Oct 25 21:31:28 2008
@@ -173,9 +173,9 @@
     private XMLMetaData parseXMLClassAnnotations() {
         // check immediately whether the class has JAXB XML annotations
         if (_cls == null || xmlTypeClass == null
-            || !(((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            || !((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(_cls, xmlTypeClass))).booleanValue()
-                && ((Boolean) AccessController
+                && (AccessController
                 .doPrivileged(J2DoPriv5Helper.isAnnotationPresentAction(_cls,
                     xmlRootElementClass))).booleanValue()))
             return null;
@@ -225,7 +225,7 @@
         Class superclass = cls.getSuperclass();
 
         // handle inheritance at sub-element level
-        if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+        if ((AccessController.doPrivileged(J2DoPriv5Helper
             .isAnnotationPresentAction(superclass, xmlTypeClass)))
             .booleanValue())
             populateFromReflection(superclass, meta);
@@ -247,7 +247,7 @@
                     // avoid JAXB XML bind default name
                     if (StringUtils.equals(XMLMetaData.defaultName, xmlname))
                         xmlname = member.getName();
-                    if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+                    if ((AccessController.doPrivileged(J2DoPriv5Helper
                         .isAnnotationPresentAction(((Field) member).getType(),
                             xmlTypeClass))).booleanValue()) {
                         field = _repos.addXMLMetaData(((Field) member).getType()

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java Sat Oct 25 21:31:28 2008
@@ -118,7 +118,7 @@
         if (member == null)
             return null;
         AnnotatedElement el = (AnnotatedElement) member;
-        if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+        if ((AccessController.doPrivileged(J2DoPriv5Helper
             .isAnnotationPresentAction(el, Transient.class))).booleanValue())
             return TRANSIENT;
         if (fmd != null
@@ -185,7 +185,7 @@
         }
 
         //### EJB3: what if defined in XML?
-        if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+        if ((AccessController.doPrivileged(J2DoPriv5Helper
             .isAnnotationPresentAction(type, Embeddable.class))).booleanValue())
             return EMBEDDED;
         if (Serializable.class.isAssignableFrom(type))
@@ -312,7 +312,7 @@
         if (member instanceof Method) {
             try {
                 // check for setters for methods
-                Method setter = (Method) AccessController.doPrivileged(
+                Method setter = AccessController.doPrivileged(
                     J2DoPriv5Helper.getDeclaredMethodAction(
                         meta.getDescribedType(), "set" +
                         StringUtils.capitalize(name), new Class[] { 
@@ -337,7 +337,7 @@
 
     private boolean isAnnotatedTransient(Member member) {
         return member instanceof AnnotatedElement
-            && ((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            && (AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(((AnnotatedElement) member),
                     Transient.class))).booleanValue();
     }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java Sat Oct 25 21:31:28 2008
@@ -293,24 +293,24 @@
             return null;
         Collection classes = repos.loadPersistentTypes(false, loader);
         for (Class cls : (Collection<Class>) classes) {
-            if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            if ((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(cls, NamedQuery.class)))
                 .booleanValue() && hasNamedQuery
                 (queryName, (NamedQuery) cls.getAnnotation(NamedQuery.class)))
                 return cls;
-            if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            if ((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(cls, NamedQueries.class)))
                 .booleanValue() &&
                 hasNamedQuery(queryName, ((NamedQueries) cls.
                     getAnnotation(NamedQueries.class)).value()))
                 return cls;
-            if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            if ((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(cls, NamedNativeQuery.class)))
                 .booleanValue() &&
                 hasNamedNativeQuery(queryName, (NamedNativeQuery) cls.
                     getAnnotation(NamedNativeQuery.class)))
                 return cls;
-            if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            if ((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(cls, NamedNativeQueries.class)))
                 .booleanValue() &&
                 hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls.
@@ -329,14 +329,14 @@
         Collection classes = repos.loadPersistentTypes(false, loader);
         for (Class cls : (Collection<Class>) classes) {
 
-            if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            if ((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(cls, SqlResultSetMapping.class)))
                 .booleanValue() &&
                 hasRSMapping(rsMappingName, (SqlResultSetMapping) cls.
                 getAnnotation(SqlResultSetMapping.class)))
                 return cls;
 
-            if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
+            if ((AccessController.doPrivileged(J2DoPriv5Helper
                 .isAnnotationPresentAction(cls, SqlResultSetMappings.class)))
                 .booleanValue() &&
                 hasRSMapping(rsMappingName, ((SqlResultSetMappings) cls.
@@ -457,11 +457,11 @@
     private File defaultXMLFile() {
         ClassLoader loader = repos.getConfiguration().
             getClassResolverInstance().getClassLoader(getClass(), null);
-        URL rsrc = (URL) AccessController.doPrivileged(
+        URL rsrc = AccessController.doPrivileged(
             J2DoPriv5Helper.getResourceAction(loader, "META-INF/orm.xml"));
         if (rsrc != null) {
             File file = new File(rsrc.getFile());
-            if (((Boolean) AccessController.doPrivileged(
+            if ((AccessController.doPrivileged(
                 J2DoPriv5Helper.existsAction(file))).booleanValue())
                 return file;
         }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java Sat Oct 25 21:31:28 2008
@@ -228,7 +228,7 @@
     public List getAnchorsInResource(String resource) throws Exception {
         ConfigurationParser parser = new ConfigurationParser(null);
         try {
-            ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
+            ClassLoader loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
             List<URL> urls = getResourceURLs(resource, loader);
             if (urls != null) {
@@ -249,7 +249,7 @@
         String[] prefixes = ProductDerivations.getConfigurationPrefixes();
         String rsrc = null;
         for (int i = 0; i < prefixes.length && StringUtils.isEmpty(rsrc); i++)
-           rsrc = (String) AccessController.doPrivileged(J2DoPrivHelper
+           rsrc = AccessController.doPrivileged(J2DoPrivHelper
                 .getPropertyAction(prefixes[i] + ".properties")); 
         boolean explicit = !StringUtils.isEmpty(rsrc);
         String anchor = null;
@@ -284,11 +284,11 @@
         throws IOException {
         Enumeration<URL> urls = null;
         try {
-            urls = (Enumeration) AccessController.doPrivileged(
+            urls = AccessController.doPrivileged(
                 J2DoPrivHelper.getResourcesAction(loader, rsrc)); 
             if (!urls.hasMoreElements()) {
                 if (!rsrc.startsWith("META-INF"))
-                    urls = (Enumeration) AccessController.doPrivileged(
+                    urls = AccessController.doPrivileged(
                         J2DoPrivHelper.getResourcesAction(
                             loader, "META-INF/" + rsrc)); 
                 if (!urls.hasMoreElements())
@@ -315,7 +315,7 @@
         String name, Map m, ClassLoader loader, boolean explicit)
         throws IOException {
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
 
         List<URL> urls = getResourceURLs(rsrc, loader);
@@ -401,7 +401,7 @@
             return true;
 
         if (loader == null)
-            loader = (ClassLoader) AccessController.doPrivileged(
+            loader = AccessController.doPrivileged(
                 J2DoPrivHelper.getContextClassLoaderAction());
         try {
             if (PersistenceProviderImpl.class.isAssignableFrom
@@ -513,7 +513,7 @@
         public void parse(File file)
             throws IOException {
             try {
-                _source = (URL) AccessController.doPrivileged(J2DoPrivHelper
+                _source = AccessController.doPrivileged(J2DoPrivHelper
                     .toURLAction(file));
             } catch (PrivilegedActionException pae) {
                 throw (MalformedURLException) pae.getException();

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java Sat Oct 25 21:31:28 2008
@@ -95,8 +95,8 @@
     }
 
     public ClassLoader getNewTempClassLoader() {
-        return (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper
-            .newTemporaryClassLoaderAction((ClassLoader) AccessController
+        return AccessController.doPrivileged(J2DoPrivHelper
+            .newTemporaryClassLoaderAction(AccessController
                 .doPrivileged(J2DoPrivHelper.getContextClassLoaderAction())));
     }
 
@@ -203,11 +203,11 @@
     }
 
     public void addJarFileName(String name) {
-        MultiClassLoader loader = (MultiClassLoader) AccessController
+        MultiClassLoader loader = AccessController
             .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
         loader.addClassLoader(getClass().getClassLoader());
         loader.addClassLoader(MultiClassLoader.THREAD_LOADER);
-        URL url = (URL) AccessController.doPrivileged(
+        URL url = AccessController.doPrivileged(
             J2DoPrivHelper.getResourceAction(loader, name));
         if (url != null) {
             addJarFile(url);
@@ -215,14 +215,14 @@
         }
 
         // jar file is not a resource; check classpath
-        String[] cp = ((String) AccessController.doPrivileged(
+        String[] cp = (AccessController.doPrivileged(
             J2DoPrivHelper.getPropertyAction("java.class.path"))) 
             .split(J2DoPrivHelper.getPathSeparator());
         for (int i = 0; i < cp.length; i++) {
             if (cp[i].equals(name)
                 || cp[i].endsWith(File.separatorChar + name)) {
                 try {
-                    addJarFile((URL) AccessController
+                    addJarFile(AccessController
                         .doPrivileged(J2DoPrivHelper
                             .toURLAction(new File(cp[i]))));
                     return;

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java Sat Oct 25 21:31:28 2008
@@ -1105,13 +1105,13 @@
                     String cap = StringUtils.capitalize(name);
                     type = meta.getDescribedType();
                     try {
-                        member = (Method) AccessController.doPrivileged(
+                        member = AccessController.doPrivileged(
                             J2DoPrivHelper.getDeclaredMethodAction(
                                 type, "get" + cap,
                                 (Class[]) null));// varargs disambiguate
                     } catch (Exception excep) {
                         try {
-                            member = (Method) AccessController.doPrivileged(
+                            member = AccessController.doPrivileged(
                                 J2DoPrivHelper.getDeclaredMethodAction(
                                     type, "is" + cap, (Class[]) null));
                         } catch (Exception excep2) {
@@ -1120,7 +1120,7 @@
                     }
                     type = ((Method) member).getReturnType();
                 } else {
-                    member = (Field) AccessController.doPrivileged(
+                    member = AccessController.doPrivileged(
                         J2DoPrivHelper.getDeclaredFieldAction(
                             meta.getDescribedType(), name));
                     type = ((Field) member).getType();

Modified: openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java?rev=707937&r1=707936&r2=707937&view=diff
==============================================================================
--- openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java (original)
+++ openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java Sat Oct 25 21:31:28 2008
@@ -80,9 +80,9 @@
      */
     public Collection load(ClassMetaData meta) {
         File f = getFile(meta);
-        if (!((Boolean) AccessController.doPrivileged(
+        if (!(AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(f))).booleanValue() || 
-            ((Long) AccessController.doPrivileged(
+            (AccessController.doPrivileged(
             J2DoPrivHelper.lengthAction(f))).longValue() == 0)
             return Collections.EMPTY_SET;
         try {
@@ -133,7 +133,7 @@
             throw new InternalException();
 
         File f = getFile(meta);
-        if (!((Boolean) AccessController.doPrivileged(
+        if (!(AccessController.doPrivileged(
             J2DoPrivHelper.existsAction(f.getParentFile()))).booleanValue())
             AccessController.doPrivileged(
                 J2DoPrivHelper.mkdirsAction(f.getParentFile()));



Mime
View raw message