You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2022/04/19 14:49:31 UTC

svn commit: r1900040 [7/8] - in /db/derby/code/trunk/java: org.apache.derby.client/org/apache/derby/client/ org.apache.derby.client/org/apache/derby/client/am/ org.apache.derby.client/org/apache/derby/client/net/ org.apache.derby.commons/org/apache/der...

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/FileContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/FileContainer.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/FileContainer.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/FileContainer.java Tue Apr 19 14:49:30 2022
@@ -62,9 +62,6 @@ import org.apache.derby.iapi.util.ByteAr
 import java.io.IOException;
 import java.io.DataInput;
 
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-
 import java.util.Properties;
 import java.util.zip.CRC32;
 
@@ -3551,43 +3548,21 @@ abstract class FileContainer
 	    throws StandardException;
     
     /**
-     * Privileged lookup of the ContextService. Must be limited to
+     * Must be limited to
      * package visibility so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     static  ContextService    getContextService()
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<ContextService>()
-             {
-                 public ContextService run()
-                 {
-                     return ContextService.getFactory();
-                 }
-             }
-             );
+        return ContextService.getFactory();
     }
     /**
-     * Privileged module lookup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  Object getServiceModule( final Object serviceModule, final String factoryInterface )
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<Object>()
-             {
-                 public Object run()
-                 {
-                     return Monitor.getServiceModule( serviceModule, factoryInterface );
-                 }
-             }
-             );
+        return Monitor.getServiceModule( serviceModule, factoryInterface );
     }
 
 }

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java Tue Apr 19 14:49:30 2022
@@ -43,17 +43,13 @@ import java.io.IOException;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.RandomAccessFile;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
 
 /**
 	RAFContainer (short for RandomAccessFileContainer) is a concrete subclass of FileContainer
 	for FileContainers which are implemented on java.io.RandomAccessFile.
 */
 
-class RAFContainer extends FileContainer implements PrivilegedExceptionAction<Object>
+class RAFContainer extends FileContainer
 {
 
 	/*
@@ -727,26 +723,22 @@ class RAFContainer extends FileContainer
 	}
 
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	 synchronized StorageFile getFileName(ContainerKey identity, boolean stub,
-											 boolean errorOK, boolean tryAlternatePath)
-		 throws StandardException
-	 {
-         // RESOLVE - READ ONLY
+    synchronized StorageFile getFileName(ContainerKey identity, boolean stub,
+                                         boolean errorOK, boolean tryAlternatePath)
+        throws StandardException
+    {
+        // RESOLVE - READ ONLY
 
-         actionCode = GET_FILE_NAME_ACTION;
-         actionIdentity = identity;
-         actionStub = stub;
-         actionErrorOK = errorOK;
-         actionTryAlternatePath = tryAlternatePath;
-         try
-         {
-             return (StorageFile) AccessController.doPrivileged( this);
-         }
-         catch( PrivilegedActionException pae){ throw (StandardException) pae.getException();}
-         finally{ actionIdentity = null; }
-	 }
+        actionCode = GET_FILE_NAME_ACTION;
+        actionIdentity = identity;
+        actionStub = stub;
+        actionErrorOK = errorOK;
+        actionTryAlternatePath = tryAlternatePath;
+        try {
+            return (StorageFile) run();
+        }
+        finally{ actionIdentity = null; }
+    }
 
     protected StorageFile privGetFileName(ContainerKey identity, boolean stub,
                                     boolean errorOK, boolean tryAlternatePath)
@@ -806,24 +798,21 @@ class RAFContainer extends FileContainer
     } // end of privGetFileName
 
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	synchronized void createContainer(ContainerKey newIdentity)
+    synchronized void createContainer(ContainerKey newIdentity)
         throws StandardException
     {
 
-		if (SanityManager.DEBUG) {
-			if ((spareSpace < 0) || (spareSpace > 100))
-				SanityManager.THROWASSERT("invalid spare space " + spareSpace);
-		}
+        if (SanityManager.DEBUG) {
+            if ((spareSpace < 0) || (spareSpace > 100))
+                SanityManager.THROWASSERT("invalid spare space " + spareSpace);
+        }
 
         actionCode = CREATE_CONTAINER_ACTION;
         actionIdentity = newIdentity;
         try
         {
-            AccessController.doPrivileged( this);
+            run();
         }
-        catch( PrivilegedActionException pae){ throw (StandardException) pae.getException();}
         finally{ actionIdentity = null; }
     } // end of createContainer
 
@@ -834,13 +823,9 @@ class RAFContainer extends FileContainer
      * @param to the file to copy to
      * @throws StandardException if the copying failed
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private void copyFile(final StorageFile from, final File to)
-            throws StandardException {
-        PrivilegedAction<Boolean> pa = () ->
-                FileUtil.copyFile(dataFactory.getStorageFactory(), from, to);
-        boolean success = AccessController.doPrivileged(pa);
+        throws StandardException {
+        boolean success = FileUtil.copyFile(dataFactory.getStorageFactory(), from, to);
         if (!success) {
             throw StandardException.newException(
                     SQLState.RAWSTORE_ERROR_COPYING_FILE,
@@ -853,29 +838,23 @@ class RAFContainer extends FileContainer
      * @param file the file to remove
      * @throws StandardException if the file could not be removed
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private void removeFile(final File file) throws StandardException {
-        PrivilegedAction<Boolean> pa = () -> !file.exists() || file.delete();
-        boolean success = AccessController.doPrivileged(pa);
+        boolean success = !file.exists() || file.delete();
         if (!success) {
             throw StandardException.newException(
                     SQLState.UNABLE_TO_DELETE_FILE, file);
         }
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	synchronized boolean removeFile(StorageFile file)
+    synchronized boolean removeFile(StorageFile file)
         throws SecurityException, StandardException
     {
         actionCode = REMOVE_FILE_ACTION;
         actionFile = file;
         try
         {
-            return AccessController.doPrivileged( this) != null;
+            return run() != null;
         }
-        catch( PrivilegedActionException pae){ throw (StandardException) pae.getException();}
         finally{ actionFile = null; }
     } // end of removeFile
 
@@ -899,21 +878,15 @@ class RAFContainer extends FileContainer
     } // end of privRemoveFile
 
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     synchronized boolean openContainer(ContainerKey newIdentity)
-            throws StandardException {
+        throws StandardException {
         actionCode = OPEN_CONTAINER_ACTION;
         actionIdentity = newIdentity;
         try
         {
-            return AccessController.doPrivileged( this) != null;
-        }
-        catch( PrivilegedActionException pae) {
-            closeContainer();
-            throw (StandardException) pae.getException();
+            return run() != null;
         }
-        catch (RuntimeException e) {
+        catch (Exception e) {
             closeContainer();
             throw e;
         }
@@ -930,8 +903,6 @@ class RAFContainer extends FileContainer
      * @param currentIdentity
      * @throws StandardException standard exception policy
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     protected synchronized void reopenContainer(ContainerKey currentIdentity)
             throws StandardException {
 
@@ -939,11 +910,8 @@ class RAFContainer extends FileContainer
         actionIdentity = currentIdentity;
 
         try {
-            AccessController.doPrivileged(this);
-        } catch (PrivilegedActionException pae) {
-            closeContainer();
-            throw (StandardException) pae.getException();
-        } catch (RuntimeException e) {
+            run();
+        } catch (Exception e) {
             closeContainer();
             throw e;
         } finally {
@@ -951,70 +919,67 @@ class RAFContainer extends FileContainer
         }
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private synchronized void stubbify(LogInstant instant)
+    private synchronized void stubbify(LogInstant instant)
         throws StandardException
-	{
-         // update header, synchronized this in case the cache is cleaning
-         // this container at the same time.  Make sure the clean and
-         // stubbify is mutually exclusive.
-         setDroppedState(true);
-         setCommittedDropState(true);
-
-		 // The whole container should be shrunk into a 'stub'.
-		 // If the file system supports truncation, we can just truncate the
-		 // file after the header.  Since it doesn't, we need to write out a
-		 // seperate file (the stub), then reset fileData to point to that,
-		 // then remove the current file.
-		 //
-		 // There may still be dirty pages that belongs to this file which are
-		 // still in the page cache.  They need not really
-		 // be written since they don't really exist anymore
-		 //
-		 // there are 3 pieces of information on disk :
-		 // 1) the log operation that caused this file to be stubbified
-		 // 2) the stub
-		 // 3) the file
-		 //
-		 // The order of event, as far as persisent store is concerned, is
-		 // A) stub shows up
-		 // B) the file disappear
-		 // C) the log operation got flushed
-		 // (B and C may swap order)
-		 //
-		 // If neither A or B happens (we crashed before the sync call),
-		 // then nothing happened.
-		 //
-		 // if A happened but B and C did not, then when we recover, we will not
-		 // know the file has been stubbified.  Hopefully, it will be stubbified
-		 // again if the post-commit queue manager is alerted to the fact.
-		 //
-		 // if A and B happened but C did not, then the file is stubbified but
-		 // there is no log record to indicate that.  This is undesirable but
-		 // still safe because the only time we stubbify is on a post commit
-		 // operation, i.e., either a create container has rolled back or a
-		 // dropped container has committed.  We end up having a a container
-		 // stub which behaves the same as a dropped container - only that all
-		 // the redo work is unnecessary because we 'know' it will
-		 // eventually be dropped and committed.
-		 //
-		 // If A and C happened and not B, then during redo, this stubbify
-		 // routine will be called again and the file will be deleted again
-		 //
-		 // The reason why A has to be sync'ed out is that we don't want B to
-		 // happen but A did not and the system crashed.  Then we are left
-		 // with neither the file nor the stub and maybe even no log record.
-		 // Then the system is not recoverable.
+    {
+        // update header, synchronized this in case the cache is cleaning
+        // this container at the same time.  Make sure the clean and
+        // stubbify is mutually exclusive.
+        setDroppedState(true);
+        setCommittedDropState(true);
+
+        // The whole container should be shrunk into a 'stub'.
+        // If the file system supports truncation, we can just truncate the
+        // file after the header.  Since it doesn't, we need to write out a
+        // seperate file (the stub), then reset fileData to point to that,
+        // then remove the current file.
+        //
+        // There may still be dirty pages that belongs to this file which are
+        // still in the page cache.  They need not really
+        // be written since they don't really exist anymore
+        //
+        // there are 3 pieces of information on disk :
+        // 1) the log operation that caused this file to be stubbified
+        // 2) the stub
+        // 3) the file
+        //
+        // The order of event, as far as persisent store is concerned, is
+        // A) stub shows up
+        // B) the file disappear
+        // C) the log operation got flushed
+        // (B and C may swap order)
+        //
+        // If neither A or B happens (we crashed before the sync call),
+        // then nothing happened.
+        //
+        // if A happened but B and C did not, then when we recover, we will not
+        // know the file has been stubbified.  Hopefully, it will be stubbified
+        // again if the post-commit queue manager is alerted to the fact.
+        //
+        // if A and B happened but C did not, then the file is stubbified but
+        // there is no log record to indicate that.  This is undesirable but
+        // still safe because the only time we stubbify is on a post commit
+        // operation, i.e., either a create container has rolled back or a
+        // dropped container has committed.  We end up having a a container
+        // stub which behaves the same as a dropped container - only that all
+        // the redo work is unnecessary because we 'know' it will
+        // eventually be dropped and committed.
+        //
+        // If A and C happened and not B, then during redo, this stubbify
+        // routine will be called again and the file will be deleted again
+        //
+        // The reason why A has to be sync'ed out is that we don't want B to
+        // happen but A did not and the system crashed.  Then we are left
+        // with neither the file nor the stub and maybe even no log record.
+        // Then the system is not recoverable.
 
-		actionIdentity = (ContainerKey)getIdentity();
+        actionIdentity = (ContainerKey)getIdentity();
         actionInstant = instant;
         actionCode = STUBBIFY_ACTION;
         try
         {
-            AccessController.doPrivileged( this);
+            run();
         }
-        catch( PrivilegedActionException pae){ throw (StandardException) pae.getException();}
         finally
         {
             actionIdentity = null;
@@ -1327,29 +1292,16 @@ class RAFContainer extends FileContainer
      * read-write mode
      * @throws IOException if some other I/O error happens
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private RandomAccessFile getRandomAccessFile(final File file)
-            throws IOException {
-        try {
-            return AccessController.doPrivileged(
-                new PrivilegedExceptionAction<RandomAccessFile>() {
-                    public RandomAccessFile run() throws IOException {
-                        boolean preExisting = file.exists();
-                        RandomAccessFile raf = new RandomAccessFile(file, "rw");
-                        if (!preExisting) {
-                            FileUtil.limitAccessToOwner(file);
-                        }
-                        return raf;
-                    }
-                });
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
+        throws IOException {
+        boolean preExisting = file.exists();
+        RandomAccessFile raf = new RandomAccessFile(file, "rw");
+        if (!preExisting) {
+            FileUtil.limitAccessToOwner(file);
         }
+        return raf;
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     synchronized StorageRandomAccessFile getRandomAccessFile(StorageFile file)
         throws SecurityException, StandardException
     {
@@ -1357,10 +1309,7 @@ class RAFContainer extends FileContainer
         actionFile = file;
         try
         {
-            return (StorageRandomAccessFile)AccessController.doPrivileged(this);
-        }
-        catch( PrivilegedActionException pae){ 
-            throw (StandardException) pae.getException();
+            return (StorageRandomAccessFile) run();
         }
         finally{ actionFile = null; }
     }

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RFResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RFResource.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RFResource.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RFResource.java Tue Apr 19 14:49:30 2022
@@ -25,9 +25,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 
 import org.apache.derby.shared.common.error.StandardException;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -246,7 +243,7 @@ class RFResource implements FileResource
 } // end of class RFResource
 
 
-final class RemoveFile implements Serviceable, PrivilegedExceptionAction<Object>
+final class RemoveFile implements Serviceable
 {
 	private final StorageFile fileToGo;
 
@@ -255,18 +252,12 @@ final class RemoveFile implements Servic
 		this.fileToGo = fileToGo;
 	}
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	public int performWork(ContextManager context)
+    public int performWork(ContextManager context)
         throws StandardException
     {
-        try {
-            AccessController.doPrivileged(this);
-        } catch (PrivilegedActionException e) {
-            throw (StandardException) (e.getException());
-         }
+        run();
         return Serviceable.DONE;
-	}
+    }
 
 	public boolean serviceASAP()
     {

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java Tue Apr 19 14:49:30 2022
@@ -58,10 +58,6 @@ import java.io.IOException;
 import java.io.EOFException;
 import java.io.InvalidClassException;
 import java.io.Externalizable;
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
 import java.io.FileNotFoundException;
 
 /**
@@ -81,7 +77,7 @@ import java.io.FileNotFoundException;
 **/
 
 
-class StreamFileContainer implements TypedFormat, PrivilegedExceptionAction<Object>
+class StreamFileContainer implements TypedFormat
 {
 
     /**************************************************************************
@@ -1061,8 +1057,6 @@ class StreamFileContainer implements Typ
 
 
     
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized boolean privExists(StorageFile file)
     {
         actionCode = STORAGE_FILE_EXISTS_ACTION;
@@ -1070,9 +1064,9 @@ class StreamFileContainer implements Typ
 
         try
         {
-            Object ret = AccessController.doPrivileged( this);
+            Object ret = run();
             return ((Boolean) ret).booleanValue();
-        }catch( PrivilegedActionException pae) 
+        }catch( IOException pae) 
         { 
             // method executed under this priveleged block 
             // does not throw an exception
@@ -1084,23 +1078,15 @@ class StreamFileContainer implements Typ
         }
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized boolean privMkdirs(StorageFile file)
             throws IOException
     {
         actionCode = STORAGE_FILE_MKDIRS_ACTION;
         actionStorageFile = file;
 
-        try
-        {
-            Object ret = AccessController.doPrivileged( this);
+        try {
+            Object ret = run();
             return ((Boolean) ret).booleanValue();
-        }catch( PrivilegedActionException pae) 
-        {
-            // method executed under this priveleged block 
-            // could throw IOException
-            throw (IOException) pae.getCause();
         } 
         finally
         {
@@ -1109,8 +1095,6 @@ class StreamFileContainer implements Typ
     }
 
     
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized boolean privDelete(StorageFile file)
     {
         actionCode = STORAGE_FILE_DELETE_ACTION;
@@ -1118,9 +1102,9 @@ class StreamFileContainer implements Typ
 
         try
         {
-            Object ret = AccessController.doPrivileged( this);
+            Object ret = run();
             return ((Boolean) ret).booleanValue();
-        }catch( PrivilegedActionException pae) 
+        }catch( IOException pae) 
         { 
             // method executed under this priveleged block 
             // does not throw an exception
@@ -1132,8 +1116,6 @@ class StreamFileContainer implements Typ
         }
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized OutputStream privGetOutputStream(StorageFile file)
         throws FileNotFoundException
     {
@@ -1142,10 +1124,10 @@ class StreamFileContainer implements Typ
 
         try
         {
-            return (OutputStream) AccessController.doPrivileged( this);
-        }catch( PrivilegedActionException pae) 
+            return (OutputStream) run();
+        }catch( IOException pae) 
         { 
-            throw (FileNotFoundException)pae.getException();
+            throw (FileNotFoundException)pae;
         } 
         finally
         {
@@ -1154,8 +1136,6 @@ class StreamFileContainer implements Typ
     }
 
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized InputStream privGetInputStream(StorageFile file)
         throws FileNotFoundException
     {
@@ -1164,10 +1144,10 @@ class StreamFileContainer implements Typ
 
         try
         {
-            return (InputStream) AccessController.doPrivileged( this);
-        }catch( PrivilegedActionException pae) 
+            return (InputStream) run();
+        }catch( IOException pae) 
         { 
-            throw (FileNotFoundException)pae.getException();
+            throw (FileNotFoundException)pae;
         } 
         finally
         {
@@ -1199,43 +1179,21 @@ class StreamFileContainer implements Typ
     }
 
     /**
-     * Privileged lookup of the ContextService. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  ContextService    getContextService()
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<ContextService>()
-             {
-                 public ContextService run()
-                 {
-                     return ContextService.getFactory();
-                 }
-             }
-             );
+        return ContextService.getFactory();
     }
 
     /**
-     * Privileged module lookup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  Object getServiceModule( final Object serviceModule, final String factoryInterface )
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<Object>()
-             {
-                 public Object run()
-                 {
-                     return Monitor.getServiceModule( serviceModule, factoryInterface );
-                 }
-             }
-             );
+        return Monitor.getServiceModule( serviceModule, factoryInterface );
     }
 
 }

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/log/LogToFile.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/log/LogToFile.java Tue Apr 19 14:49:30 2022
@@ -88,10 +88,6 @@ import java.io.FileNotFoundException;
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
 
 import java.util.Properties;
 import java.util.zip.CRC32;
@@ -207,7 +203,7 @@ import java.util.zip.CRC32;
 	*/
 
 public final class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,
-								  Serviceable, java.security.PrivilegedExceptionAction<Object>
+								  Serviceable
 {
 
 	private static final    long INT_LENGTH = 4L;
@@ -5687,151 +5683,138 @@ public final class LogToFile implements
 		return runBooleanAction(1, file);
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized StorageRandomAccessFile privRandomAccessFile(StorageFile file, String perms)
         throws IOException
     {
 		action = 2;
         activeFile = file;
         activePerms = perms;
-        try
-        {
-            return (StorageRandomAccessFile) java.security.AccessController.doPrivileged(this);
-        }
-        catch (java.security.PrivilegedActionException pae)
-        {
-            throw (IOException) pae.getException();
+
+        try {
+            return (StorageRandomAccessFile) run();
         }
+        catch (StandardException se) { throw wrapSE(se); }
+    }
+
+    /**
+     * This method compensates for the fact that callers of run()
+     * have to handle the StandardException raised by that method.
+     * We don't expect that this method will ever be called.
+     */
+    private IOException wrapSE(Exception se)
+    {
+        return new IOException(se.getMessage(), se);
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private synchronized OutputStreamWriter privGetOutputStreamWriter(StorageFile file)
         throws IOException
     {
         action = 10;
         activeFile = file;
-        try
-        {
-            return (OutputStreamWriter) java.security.AccessController.doPrivileged(this);
-        }
-        catch (java.security.PrivilegedActionException pae)
-        {
-            throw (IOException) pae.getException();
+
+        try {
+            return (OutputStreamWriter) run();
         }
+        catch (StandardException se) { throw wrapSE(se); }
     }
 
     protected boolean privCanWrite(StorageFile file)
     {
-		return runBooleanAction(3, file);
+        return runBooleanAction(3, file);
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     protected boolean privMkdirs(StorageFile file) throws IOException
     {
         this.action = 4;
         this.activeFile = file;
+
         try {
-            return ((Boolean) AccessController.doPrivileged(this));
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
+            return (Boolean) run();
         }
+        catch (StandardException se) { throw wrapSE(se); }
     }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private synchronized String[] privList(File file)
+    private synchronized String[] privList(File file)
     {
-		action = 8;
+        action = 8;
         toFile = file;
 
-        try
-        {
-			return (String[]) java.security.AccessController.doPrivileged(this);
-		}
-        catch (java.security.PrivilegedActionException pae)
+        try {
+            return (String[]) run();
+        }
+        catch (Exception pae)
         {
             return null;
         }
-	}
+    }
     
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private synchronized String[] privList(StorageFile file)
+    private synchronized String[] privList(StorageFile file)
     {
-		action = 5;
+        action = 5;
         activeFile = file;
 
         try
         {
-			return (String[]) java.security.AccessController.doPrivileged(this);
-		}
-        catch (java.security.PrivilegedActionException pae)
+            return (String[]) run();
+        }
+        catch (Exception pae)
         {
             return null;
         }
-	}
+    }
 
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private synchronized boolean privCopyFile(StorageFile from, File to)
-            throws StandardException
-	{
-		action = 6;
-		activeFile = from;
-		toFile = to;
+    private synchronized boolean privCopyFile(StorageFile from, File to)
+        throws StandardException
+    {
+        action = 6;
+        activeFile = from;
+        toFile = to;
         try
         {
-			return ((Boolean) java.security.AccessController.doPrivileged(this)).booleanValue();
-		}
-        catch (java.security.PrivilegedActionException pae)
+            return (Boolean) run();
+        }
+        catch (Exception pae)
         {
-            if (pae.getCause() instanceof StandardException) {
+            if (pae instanceof StandardException) {
                 throw (StandardException)pae.getCause();
             }
 
             return false;
         }
-	}
+    }
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private synchronized boolean privCopyFile(File from, StorageFile to)
-	{
-		action = 9;
-		activeFile = to;
-		toFile = from;
+    private synchronized boolean privCopyFile(File from, StorageFile to)
+    {
+        action = 9;
+        activeFile = to;
+        toFile = from;
         try
         {
-			return ((Boolean) java.security.AccessController.doPrivileged(this)).booleanValue();
-		}
-        catch (java.security.PrivilegedActionException pae)
+            return (Boolean) run();
+        }
+        catch (Exception pae)
         {
             return false;
         }	
-	}
+    }
 
-	private boolean privRemoveDirectory(StorageFile file)
-	{
-		return runBooleanAction(7, file);
-	}
+    private boolean privRemoveDirectory(StorageFile file)
+    {
+        return runBooleanAction(7, file);
+    }
 
 
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private synchronized boolean runBooleanAction(int action, StorageFile file) {
-		this.action = action;
-		this.activeFile = file;
+    private synchronized boolean runBooleanAction(int action, StorageFile file) {
+        this.action = action;
+        this.activeFile = file;
 
-		try {
-			return ((Boolean) java.security.AccessController.doPrivileged(this)).booleanValue();
-		} catch (java.security.PrivilegedActionException pae) {
-			return false;
-		}
-	}
+        try {
+            return (Boolean) run();
+        } catch (Exception pae) {
+            return false;
+        }
+    }
 
     /** set the endPosition of the log and make sure the new position won't spill off the end of the log */
     private void    setEndPosition( long newPosition )
@@ -5975,115 +5958,48 @@ public final class LogToFile implements
      * Privileged lookup of the ContextService. Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  ContextService    getContextService()
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<ContextService>()
-             {
-                 public ContextService run()
-                 {
-                     return ContextService.getFactory();
-                 }
-             }
-             );
+        return ContextService.getFactory();
     }
 
     
     /**
-     * Privileged Monitor lookup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  ModuleFactory  getMonitor()
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<ModuleFactory>()
-             {
-                 public ModuleFactory run()
-                 {
-                     return Monitor.getMonitor();
-                 }
-             }
-             );
+        return Monitor.getMonitor();
     }
 
     /**
-     * Privileged startup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  Object findServiceModule( final Object serviceModule, final String factoryInterface)
         throws StandardException
     {
-        try {
-            return AccessController.doPrivileged
-                (
-                 new PrivilegedExceptionAction<Object>()
-                 {
-                     public Object run()
-                         throws StandardException
-                     {
-                         return Monitor.findServiceModule( serviceModule, factoryInterface );
-                     }
-                 }
-                 );
-        } catch (PrivilegedActionException pae)
-        {
-            throw StandardException.plainWrapException( pae );
-        }
+        return Monitor.findServiceModule( serviceModule, factoryInterface );
     }
 
     /**
-     * Privileged module lookup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  Object getServiceModule( final Object serviceModule, final String factoryInterface )
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<Object>()
-             {
-                 public Object run()
-                 {
-                     return Monitor.getServiceModule( serviceModule, factoryInterface );
-                 }
-             }
-             );
+        return Monitor.getServiceModule( serviceModule, factoryInterface );
     }
     
     /**
-     * Privileged startup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  boolean isFullUpgrade( final Properties startParams, final String oldVersionInfo )
         throws StandardException
     {
-        try {
-            return AccessController.doPrivileged
-                (
-                 new PrivilegedExceptionAction<Boolean>()
-                 {
-                     public Boolean run()
-                         throws StandardException
-                     {
-                         return Monitor.isFullUpgrade( startParams, oldVersionInfo );
-                     }
-                 }
-                 ).booleanValue();
-        } catch (PrivilegedActionException pae)
-        {
-            throw StandardException.plainWrapException( pae );
-        }
+        return Monitor.isFullUpgrade( startParams, oldVersionInfo );
     }
 }
 

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/xact/XactFactory.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/xact/XactFactory.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/xact/XactFactory.java Tue Apr 19 14:49:30 2022
@@ -61,10 +61,6 @@ import org.apache.derby.shared.common.er
 
 import org.apache.derby.iapi.util.InterruptStatus;
 
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.AccessController;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -1168,52 +1164,28 @@ public class XactFactory implements Tran
 	
     
     /**
-     * Privileged lookup of the ContextService. Private so that user code
+     * Private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  ContextService    getContextService()
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<ContextService>()
-             {
-                 public ContextService run()
-                 {
-                     return ContextService.getFactory();
-                 }
-             }
-             );
+        return ContextService.getFactory();
     }
 
     
     /**
-     * Privileged Monitor lookup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  ModuleFactory  getMonitor()
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<ModuleFactory>()
-             {
-                 public ModuleFactory run()
-                 {
-                     return Monitor.getMonitor();
-                 }
-             }
-             );
+        return Monitor.getMonitor();
     }
 
     /**
-     * Privileged startup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  Object bootServiceModule
         (
          final boolean create, final Object serviceModule,
@@ -1221,49 +1193,17 @@ public class XactFactory implements Tran
          )
         throws StandardException
     {
-        try {
-            return AccessController.doPrivileged
-                (
-                 new PrivilegedExceptionAction<Object>()
-                 {
-                     public Object run()
-                         throws StandardException
-                     {
-                         return Monitor.bootServiceModule( create, serviceModule, factoryInterface, properties );
-                     }
-                 }
-                 );
-        } catch (PrivilegedActionException pae)
-        {
-            throw StandardException.plainWrapException( pae );
-        }
+        return Monitor.bootServiceModule( create, serviceModule, factoryInterface, properties );
     }
 
     /**
-     * Privileged startup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private  static  Object findServiceModule( final Object serviceModule, final String factoryInterface)
         throws StandardException
     {
-        try {
-            return AccessController.doPrivileged
-                (
-                 new PrivilegedExceptionAction<Object>()
-                 {
-                     public Object run()
-                         throws StandardException
-                     {
-                         return Monitor.findServiceModule( serviceModule, factoryInterface );
-                     }
-                 }
-                 );
-        } catch (PrivilegedActionException pae)
-        {
-            throw StandardException.plainWrapException( pae );
-        }
+        return Monitor.findServiceModule( serviceModule, factoryInterface );
     }
 
 }

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java Tue Apr 19 14:49:30 2022
@@ -25,9 +25,6 @@ package org.apache.derby.impl.store.repl
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import javax.net.ServerSocketFactory;
 import org.apache.derby.shared.common.error.StandardException;
 import org.apache.derby.shared.common.reference.MessageId;
@@ -141,8 +138,6 @@ public class ReplicationMessageReceive {
      * @throws StandardException if an incompatible database version is found.
      *
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     public void initConnection(int timeout, long synchOnInstant, String dbname)
         throws
         IOException,
@@ -157,17 +152,8 @@ public class ReplicationMessageReceive {
         }
         serverSocket.setSoTimeout(timeout);
         Socket client = null;
-        try {
-            //Start listening on the socket and accepting the connection
-            client =
-                AccessController.doPrivileged(new PrivilegedExceptionAction<Socket>() {
-                    public Socket run() throws IOException {
-                        return serverSocket.accept();
-                    }
-                });
-        } catch(PrivilegedActionException pea) {
-            throw (IOException) pea.getException();
-        }
+        //Start listening on the socket and accepting the connection
+        client = serverSocket.accept();
 
         //create the SocketConnection object using the client connection.
         socketConn = new SocketConnection(client);
@@ -194,25 +180,14 @@ public class ReplicationMessageReceive {
      * @throws IOException if an exception occurs while trying
      *                                   to open a connection.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private ServerSocket createServerSocket() throws IOException {
         //create a ServerSocket at the specified host name and the
         //port number.
         ServerSocket ss = null;
-        try { 
-            ss = AccessController.doPrivileged
-            (new PrivilegedExceptionAction<ServerSocket>() {
-                public ServerSocket run() throws IOException  {
-                    ServerSocketFactory sf = ServerSocketFactory.getDefault();
-                    return sf.createServerSocket(slaveAddress.getPortNumber(),
-                            0, slaveAddress.getHostAddress());
-                }
-            });
-            return ss;
-        } catch(PrivilegedActionException pea) {
-            throw (IOException) pea.getException();
-        }
+        ServerSocketFactory sf = ServerSocketFactory.getDefault();
+        ss = sf.createServerSocket(slaveAddress.getPortNumber(),
+                                   0, slaveAddress.getHostAddress());
+        return ss;
     }
     
     /**

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java Tue Apr 19 14:49:30 2022
@@ -24,9 +24,6 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import javax.net.SocketFactory;
 import org.apache.derby.shared.common.error.StandardException;
 import org.apache.derby.shared.common.reference.SQLState;
@@ -110,8 +107,6 @@ public class ReplicationMessageTransmit
      * @throws ClassNotFoundException Class of a serialized object cannot
      *         be found.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     public void initConnection(int timeout, long synchOnInstant) throws
         IOException,
         StandardException,
@@ -120,22 +115,13 @@ public class ReplicationMessageTransmit
         Socket s = null;
         
         final int timeout_ = timeout;
-        try {
-            //create a connection to the slave.
-            s = AccessController.doPrivileged(new PrivilegedExceptionAction<Socket>() {
-                public Socket run() throws IOException {
-                    SocketFactory sf = SocketFactory.getDefault();
-                    InetSocketAddress sockAddr = new InetSocketAddress(
-                            slaveAddress.getHostAddress(), 
-                            slaveAddress.getPortNumber());
-                    Socket s_temp = sf.createSocket();
-                    s_temp.connect(sockAddr, timeout_);
-                    return s_temp;
-                }
-            });
-        } catch(PrivilegedActionException pea) {
-            throw (IOException) pea.getException();
-        }
+        SocketFactory sf = SocketFactory.getDefault();
+        InetSocketAddress sockAddr = new InetSocketAddress(
+            slaveAddress.getHostAddress(), 
+            slaveAddress.getPortNumber());
+        Socket s_temp = sf.createSocket();
+        s_temp.connect(sockAddr, timeout_);
+        s = s_temp;
         
         // keep socket alive even if no log is shipped for a long time
         s.setKeepAlive(true);

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Management.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Management.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Management.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Management.java Tue Apr 19 14:49:30 2022
@@ -21,9 +21,6 @@
 
 package org.apache.derby.mbeans;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
 import org.apache.derby.shared.common.reference.Module;
 import org.apache.derby.iapi.services.monitor.Monitor;
 
@@ -89,23 +86,12 @@ public class Management implements Manag
     }
     
     /**
-     * Privileged module lookup. Must be private so that user code
+     * Must be private so that user code
      * can't call this entry point.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  Object getSystemModule( final String factoryInterface )
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<Object>()
-             {
-                 public Object run()
-                 {
-                     return Monitor.getSystemModule( factoryInterface );
-                 }
-             }
-             );
+        return Monitor.getSystemModule( factoryInterface );
     }
 
 }

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Version.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Version.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Version.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/mbeans/Version.java Tue Apr 19 14:49:30 2022
@@ -21,9 +21,6 @@
 
 package org.apache.derby.mbeans;
 
-import java.security.AccessControlException;
-import java.security.AccessController;
-
 import org.apache.derby.mbeans.VersionMBean;
 import org.apache.derby.shared.common.info.ProductVersionHolder;
 import org.apache.derby.shared.common.security.SystemPermission;
@@ -55,23 +52,9 @@ public class Version implements VersionM
     */
     
     /**
-     * Ensure caller has permission to monitor Derby.
+     * Ensure caller has permission to monitor Derby. NOP now that Derby doesn't use the SecurityManager.
      */
-    // AccessController, AccessControlException, and SecurityManager deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private void checkMonitor() {
-
-        try {
-            if (System.getSecurityManager() != null)
-                AccessController.checkPermission(
-                        new SystemPermission(permissionName,
-                                SystemPermission.MONITOR));
-        } catch (AccessControlException e) {
-            // Need to throw a simplified version as AccessControlException
-            // will have a reference to Derby's SystemPermission which most likely
-            // will not be available on the client.
-            throw new SecurityException(e.getMessage());
-        }
     }
     
     // ------------------------- MBEAN ATTRIBUTES  ----------------------------

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/security/DatabasePermission.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/security/DatabasePermission.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/security/DatabasePermission.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/security/DatabasePermission.java Tue Apr 19 14:49:30 2022
@@ -22,10 +22,6 @@
 package org.apache.derby.security;
 
 import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.security.AccessController;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -260,8 +256,6 @@ final public class DatabasePermission ex
      * @throws IllegalArgumentException if the URL is not well-formed
      * @throws IOException if the location URL cannot be canonicalized
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     protected void initLocation(String url)
         throws IOException {
         // analog to java.security.BasicPermission, we check that URL
@@ -318,12 +312,7 @@ final public class DatabasePermission ex
             // doPrivileged() block to allow for confined codebase permission
             // grants
             if (p.startsWith(URL_PATH_RELATIVE_PREFIX)) {
-                final String cwd = AccessController.doPrivileged(
-                    new PrivilegedAction<String>() {
-                        public String run() {
-                            return System.getProperty("user.dir");
-                        }
-                    });
+                final String cwd = System.getProperty("user.dir");
                 // concatenated path "<cwd>/./<path>" will be canonicalized
                 p = cwd + URL_PATH_SEPARATOR_STRING + p;
             }
@@ -333,19 +322,7 @@ final public class DatabasePermission ex
             // may throw IOException; canonicalization reads the "user.dir"
             // system property, which we encapsulate in a doPrivileged()
             // block to allow for confined codebase permission grants
-            final File f;
-            try {
-                f = AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<File>() {
-                        public File run() throws IOException {
-                            return (new File(absPath)).getCanonicalFile();
-                        }
-                    });
-            } catch (PrivilegedActionException pae) {
-                // pae.getCause() should be an instance of IOException,
-                // as only checked exceptions will be wrapped
-                throw (IOException)pae.getCause();
-            }
+            final File f = (new File(absPath)).getCanonicalFile();
             path = f.getPath();
 
             // store canonicalized path of parent file as required for

Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/vti/XmlVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/vti/XmlVTI.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/vti/XmlVTI.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/vti/XmlVTI.java Tue Apr 19 14:49:30 2022
@@ -26,8 +26,6 @@ import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.text.DateFormat;
@@ -268,25 +266,15 @@ public  class   XmlVTI  extends StringCo
      * @return a VTI to turn the XML text into rows
      * @throws Exception on error
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     public  static  XmlVTI  xmlVTI
         ( final String fileName, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )
         throws Exception
     {
-        FileInputStream fis = AccessController.doPrivileged
-            (
-             new PrivilegedAction<FileInputStream>()
-             {
-                 public FileInputStream run()
-                 {
-                     try {
-                         return new FileInputStream( new File( fileName ) );
-                     }
-                     catch (IOException ioe) { throw new IllegalArgumentException( ioe.getMessage(), ioe ); }
-                 }  
-             }
-           );
+        FileInputStream fis = null;
+        try {
+            fis = new FileInputStream( new File( fileName ) );
+        }
+        catch (IOException ioe) { throw new IllegalArgumentException( ioe.getMessage(), ioe ); }
         return xmlVTI( fis, rowTag, parentTags, childTags );
     }
 
@@ -301,25 +289,15 @@ public  class   XmlVTI  extends StringCo
      * @return a VTI to turn the XML text into rows
      * @throws Exception on error
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     public  static  XmlVTI  xmlVTIFromURL
         ( final String urlString, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )
         throws Exception
     {
-        InputStream is = AccessController.doPrivileged
-            (
-             new PrivilegedAction<InputStream>()
-             {
-                 public InputStream run()
-                 {
-                     try {
-                         return (new URL( urlString )).openStream();
-                     }
-                     catch (IOException ioe) { throw new IllegalArgumentException( ioe.getMessage(), ioe ); }
-                 }  
-             }
-           );
+        InputStream is = null;
+        try {
+            is = (new URL( urlString )).openStream();
+        }
+        catch (IOException ioe) { throw new IllegalArgumentException( ioe.getMessage(), ioe ); }
         return xmlVTI( is, rowTag, parentTags, childTags );
     }
 

Modified: db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/api/SimpleJsonUtils.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/api/SimpleJsonUtils.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/api/SimpleJsonUtils.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/api/SimpleJsonUtils.java Tue Apr 19 14:49:30 2022
@@ -30,9 +30,6 @@ import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Connection;
@@ -221,8 +218,6 @@ public abstract class SimpleJsonUtils
      * @return a json array
      * @throws SQLException on error
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     public static JSONArray readArrayFromFile
         ( String fileName, String characterSetName )
         throws SQLException
@@ -231,17 +226,9 @@ public abstract class SimpleJsonUtils
         final String name_of_file = fileName;
         
         try {
-            fis = AccessController.doPrivileged(
-             new PrivilegedExceptionAction<FileInputStream>()
-             {
-                 public FileInputStream run() throws IOException
-                 {
-                     return new FileInputStream( name_of_file );
-                 }
-             }
-             );
+            fis = new FileInputStream( name_of_file );
         }
-        catch (PrivilegedActionException pae) { throw ToolUtilities.wrap( pae ); }
+        catch (Exception pae) { throw ToolUtilities.wrap( pae ); }
 
         return readArrayFromStream( fis, characterSetName );
     }
@@ -256,8 +243,6 @@ public abstract class SimpleJsonUtils
      * @return a json array
      * @throws SQLException on error
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     public static JSONArray readArrayFromURL
         ( String urlString, String characterSetName )
         throws SQLException
@@ -266,18 +251,10 @@ public abstract class SimpleJsonUtils
         final   String  url_string = urlString;
         
         try {
-            inputStream = AccessController.doPrivileged(
-             new PrivilegedExceptionAction<InputStream>()
-             {
-                 public InputStream run() throws IOException, MalformedURLException
-                 {
-                     URL url = new URL( url_string );
-                     return url.openStream();
-                 }
-             }
-             );
+            URL url = new URL( url_string );
+            inputStream = url.openStream();
         }
-        catch (PrivilegedActionException pae) { throw ToolUtilities.wrap( pae ); }
+        catch (Exception pae) { throw ToolUtilities.wrap( pae ); }
         
         return readArrayFromStream( inputStream, characterSetName );
     }

Modified: db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/dump/DataFileVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/dump/DataFileVTI.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/dump/DataFileVTI.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/dump/DataFileVTI.java Tue Apr 19 14:49:30 2022
@@ -33,7 +33,6 @@ import java.io.PrintWriter;
 import java.io.RandomAccessFile;
 import java.io.StringWriter;
 import java.math.BigDecimal;
-import java.security.AccessController;
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Connection;
@@ -553,16 +552,9 @@ public  class   DataFileVTI extends VTIT
     /**
      * Get system property.
      */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static String getSystemProperty( final String name)
-	{
-        return AccessController.doPrivileged
-            ( new java.security.PrivilegedAction<String>()
-                {
-                    public String run() { return System.getProperty( name ); }
-                }
-            );
+    {
+        return  System.getProperty( name );
     }
 
     /**

Modified: db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyIndexInput.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyIndexInput.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyIndexInput.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyIndexInput.java Tue Apr 19 14:49:30 2022
@@ -23,9 +23,6 @@ package org.apache.derby.optional.lucene
 
 import java.io.EOFException;
 import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 
 import org.apache.lucene.store.AlreadyClosedException;
@@ -106,28 +103,11 @@ class DerbyIndexInput   extends IndexInp
     }
 
     /** Set the constructor fields */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private void    setConstructorFields( final StorageFile file )
         throws IOException
     {
-        try {
-            AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<Void>()
-             {
-                public Void run() throws IOException
-                {
-                    _file = file;
-                    _sraf = _file.getRandomAccessFile( "r" );
-
-                    return null;
-                }
-             }
-             );
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
-        }
+        _file = file;
+        _sraf = _file.getRandomAccessFile( "r" );
     }
 
     /////////////////////////////////////////////////////////////////////

Modified: db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyLuceneDir.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyLuceneDir.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyLuceneDir.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/DerbyLuceneDir.java Tue Apr 19 14:49:30 2022
@@ -23,9 +23,6 @@ package org.apache.derby.optional.lucene
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.HashMap;
@@ -372,39 +369,25 @@ class DerbyLuceneDir extends Directory
         return indexDir;
     }
 
-	/**
-	 * Create the path if necessary.
-	 */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
+    /**
+     * Create the path if necessary.
+     */
     private static StorageFile createPathLeg
         ( final StorageFactory storageFactory, final StorageFile parentDir, final String fileName )
         throws SQLException
     {
-        try {
-            return AccessController.doPrivileged(
-             new PrivilegedExceptionAction<StorageFile>()
-             {
-                 public StorageFile run() throws SQLException
-                 {
-                     String         normalizedName = ToolUtilities.derbyIdentifier( fileName );
-                     StorageFile    file = parentDir == null ?
-                         storageFactory.newStorageFile( normalizedName  ) :
-                         storageFactory.newStorageFile( parentDir, normalizedName );
-
-                     if ( !file.exists() ) { file.mkdir(); }
-                     if ( !file.exists() )
-                     {
-                         throw ToolUtilities.newSQLException
-                             ( SQLState.SERVICE_DIRECTORY_CREATE_ERROR, normalizedName );
-                     }
-                     else { return file; }
-                 }
-             }
-             );
-        } catch (PrivilegedActionException pae) {
-            throw (SQLException) pae.getCause();
+        String         normalizedName = ToolUtilities.derbyIdentifier( fileName );
+        StorageFile    file = parentDir == null ?
+            storageFactory.newStorageFile( normalizedName  ) :
+            storageFactory.newStorageFile( parentDir, normalizedName );
+
+        if ( !file.exists() ) { file.mkdir(); }
+        if ( !file.exists() )
+        {
+            throw ToolUtilities.newSQLException
+                ( SQLState.SERVICE_DIRECTORY_CREATE_ERROR, normalizedName );
         }
+        else { return file; }
     }
     
 }

Modified: db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java Tue Apr 19 14:49:30 2022
@@ -22,10 +22,6 @@
 package org.apache.derby.optional.lucene;
 
 import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Timestamp;
@@ -212,61 +208,34 @@ class LuceneListIndexesVTI extends Strin
                 rowProperties = readIndexProperties( indexPropertiesFile );
             }
             catch (IOException ioe) { throw ToolUtilities.wrap( ioe ); }
-            catch (PrivilegedActionException pae) { throw ToolUtilities.wrap( pae ); }
         }
 
         return rowProperties;
     }
 
     /** List files */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  StorageFile[]  listDirectories( final StorageFactory storageFactory, final StorageFile dir )
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedAction<StorageFile[]>()
-             {
-                public StorageFile[] run()
-                {
-                    ArrayList<StorageFile>  subdirectories = new ArrayList<StorageFile>();
-                    String[]    fileNames = dir.list();
+        ArrayList<StorageFile>  subdirectories = new ArrayList<StorageFile>();
+        String[]    fileNames = dir.list();
 
-                    for ( String fileName : fileNames )
-                    {
-                        StorageFile candidate = storageFactory.newStorageFile( dir, fileName );
-                        if ( candidate.isDirectory() ) { subdirectories.add( candidate ); }
-                    }
+        for ( String fileName : fileNames )
+        {
+            StorageFile candidate = storageFactory.newStorageFile( dir, fileName );
+            if ( candidate.isDirectory() ) { subdirectories.add( candidate ); }
+        }
 
-                    StorageFile[]   result = new StorageFile[ subdirectories.size() ];
-                    subdirectories.toArray( result );
+        StorageFile[]   result = new StorageFile[ subdirectories.size() ];
+        subdirectories.toArray( result );
                     
-                    return result;
-                }
-             }
-             );
+        return result;
     }
 
     /** Read the index properties file */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  Properties readIndexProperties( final StorageFile file )
         throws IOException
     {
-        try {
-            return AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<Properties>()
-             {
-                public Properties run() throws IOException
-                {
-                    return LuceneSupport.readIndexPropertiesNoPrivs( file );
-                }
-             }
-             );
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
-        }
+        return LuceneSupport.readIndexPropertiesNoPrivs( file );
     }
 
 }

Modified: db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneQueryVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneQueryVTI.java?rev=1900040&r1=1900039&r2=1900040&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneQueryVTI.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.optionaltools/org/apache/derby/optional/lucene/LuceneQueryVTI.java Tue Apr 19 14:49:30 2022
@@ -24,9 +24,6 @@ package org.apache.derby.optional.lucene
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.SQLException;
@@ -488,7 +485,6 @@ class LuceneQueryVTI extends StringColum
         }
         catch (IOException ioe) { throw ToolUtilities.wrap( ioe ); }
         catch (ParseException pe) { throw ToolUtilities.wrap( pe ); }
-        catch (PrivilegedActionException pae) { throw ToolUtilities.wrap( pae ); }
     }
 
     /**
@@ -545,102 +541,45 @@ class LuceneQueryVTI extends StringColum
         return ( (columnid > 0) && (columnid <= _maxKeyID) );
     }
     
-	/**
-	 * Returns a Lucene IndexReader, which reads from the indicated Lucene index.
-	 * 
-	 * @param dir The directory holding the Lucene index.
-	 */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private static IndexReader getIndexReader( final DerbyLuceneDir dir )
-        throws IOException, PrivilegedActionException
+    /**
+     * Returns a Lucene IndexReader, which reads from the indicated Lucene index.
+     * 
+     * @param dir The directory holding the Lucene index.
+     */
+    private static IndexReader getIndexReader( final DerbyLuceneDir dir )
+        throws IOException
     {
-        try {
-            return AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<IndexReader>()
-             {
-                 public IndexReader run() throws IOException
-                 {
-                     return DirectoryReader.open( dir );
-                 }
-             }
-             );
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
-        }
-	}
+        return DirectoryReader.open( dir );
+    }
 	
     /** Read the index properties file */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private static  Properties readIndexProperties( final StorageFile file )
         throws IOException
     {
-        try {
-            return AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<Properties>()
-             {
-                public Properties run() throws IOException
-                {
-                    return LuceneSupport.readIndexPropertiesNoPrivs( file );
-                }
-             }
-             );
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
-        }
+        return LuceneSupport.readIndexPropertiesNoPrivs( file );
     }
 
-	/**
-	 * Invoke a static method (possibly supplied by the user) to instantiate an index descriptor.
+    /**
+     * Invoke a static method (possibly supplied by the user) to instantiate an index descriptor.
      * The method has no arguments.
-	 */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
-	private static LuceneIndexDescriptor getIndexDescriptor( final String indexDescriptorMaker )
-        throws PrivilegedActionException, SQLException
+     */
+    private static LuceneIndexDescriptor getIndexDescriptor( final String indexDescriptorMaker )
+        throws SQLException
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<LuceneIndexDescriptor>()
-             {
-                 public LuceneIndexDescriptor run()
-                     throws ClassNotFoundException, IllegalAccessException,
-                     InvocationTargetException, NoSuchMethodException,
-                     SQLException
-                 {
-                     return LuceneSupport.getIndexDescriptorNoPrivs( indexDescriptorMaker );
-                 }
-             }
-             );
-	}
+        try
+        {
+            return LuceneSupport.getIndexDescriptorNoPrivs( indexDescriptorMaker );
+        }
+        catch (Exception se) { throw ToolUtilities.wrap(se); }
+    }
 	
     /** Read the index properties file */
-    // AccessController.doPrivileged() deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
-    @SuppressWarnings("removal")
     private void    searchAndScore( final Query luceneQuery, final TopScoreDocCollector tsdc )
         throws IOException
     {
-        try {
-            AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<Object>()
-             {
-                public Object run() throws IOException
-                {
-                    _searcher.search( luceneQuery, tsdc );
-                    TopDocs topdocs = tsdc.topDocs();
-                    _hits = topdocs.scoreDocs;
-
-                    return null;
-                }
-             }
-             );
-        } catch (PrivilegedActionException pae) {
-            throw (IOException) pae.getCause();
-        }
+        _searcher.search( luceneQuery, tsdc );
+        TopDocs topdocs = tsdc.topDocs();
+        _hits = topdocs.scoreDocs;
     }
 
 }