db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1596552 - in /db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene: DerbyIndexInput.java DerbyLuceneDir.java LuceneListIndexesVTI.java LuceneQueryVTI.java LuceneSupport.java
Date Wed, 21 May 2014 12:21:44 GMT
Author: kahatlen
Date: Wed May 21 12:21:44 2014
New Revision: 1596552

URL: http://svn.apache.org/r1596552
Log:
DERBY-590: Remove handling of impossible exceptions

Modified:
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyIndexInput.java
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyLuceneDir.java
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyIndexInput.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyIndexInput.java?rev=1596552&r1=1596551&r2=1596552&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyIndexInput.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyIndexInput.java
Wed May 21 12:21:44 2014
@@ -25,7 +25,6 @@ import java.io.IOException;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import java.sql.SQLException;
 import java.util.ArrayList;
 
 import org.apache.lucene.store.AlreadyClosedException;
@@ -74,21 +73,19 @@ public  class DerbyIndexInput   extends 
     {
         super( file.getPath() );
 
-        try {
-            setConstructorFields( file );
-        }
-        catch (PrivilegedActionException pae) { wrapWithIOException( pae ); }
+        setConstructorFields( file );
     }
 
     /** Set the constructor fields */
     private void    setConstructorFields( final StorageFile file )
-        throws IOException, PrivilegedActionException
+        throws IOException
     {
-        AccessController.doPrivileged
+        try {
+            AccessController.doPrivileged
             (
-             new PrivilegedExceptionAction<Object>()
+             new PrivilegedExceptionAction<Void>()
              {
-                public Object run() throws IOException
+                public Void run() throws IOException
                 {
                     _file = file;
                     _sraf = _file.getRandomAccessFile( "r" );
@@ -97,6 +94,9 @@ public  class DerbyIndexInput   extends 
                 }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
     }
 
     /////////////////////////////////////////////////////////////////////

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyLuceneDir.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyLuceneDir.java?rev=1596552&r1=1596551&r2=1596552&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyLuceneDir.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/DerbyLuceneDir.java
Wed May 21 12:21:44 2014
@@ -31,8 +31,6 @@ import java.util.Collection;
 import java.util.HashMap;
 
 import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.Lock;
 import org.apache.lucene.store.LockFactory;
@@ -95,22 +93,18 @@ class DerbyLuceneDir extends Directory
         ( StorageFactory storageFactory, String schema, String table, String textcol )
         throws SQLException
     {
-        try {
-            DerbyLuceneDir  candidate = new DerbyLuceneDir( storageFactory, schema, table,
textcol );
-            String              key = getKey( candidate );
-            DerbyLuceneDir  result = _openDirectories.get( key );
-
-            if ( result == null )
-            {
-                result = candidate;
-                result.setLockFactory( new SingleInstanceLockFactory() );
-                _openDirectories.put( key, result );
-            }
+        DerbyLuceneDir  candidate = new DerbyLuceneDir( storageFactory, schema, table, textcol
);
+        String              key = getKey( candidate );
+        DerbyLuceneDir  result = _openDirectories.get( key );
 
-            return result;
+        if ( result == null )
+        {
+            result = candidate;
+            result.setLockFactory( new SingleInstanceLockFactory() );
+            _openDirectories.put( key, result );
         }
-        catch (IOException ioe) { throw LuceneSupport.wrap( ioe ); }
-        catch (PrivilegedActionException pae) { throw LuceneSupport.wrap( pae ); }
+
+        return result;
     }
 
     /**
@@ -137,7 +131,7 @@ class DerbyLuceneDir extends Directory
      * </p>
      */
     private DerbyLuceneDir( StorageFactory storageFactory, String schema, String table, String
textcol )
-        throws IOException, PrivilegedActionException, SQLException
+        throws SQLException
     {
         _storageFactory = storageFactory;
         _schema = schema;
@@ -366,7 +360,7 @@ class DerbyLuceneDir extends Directory
 	 */
     private static StorageFile createPath
         ( final StorageFactory storageFactory, final String schema, final String table, final
String textcol )
-        throws SQLException, IOException, PrivilegedActionException
+        throws SQLException
     {
         StorageFile    luceneDir = createPathLeg( storageFactory, null, Database.LUCENE_DIR
);
         StorageFile    schemaDir = createPathLeg( storageFactory, luceneDir, schema );
@@ -381,13 +375,13 @@ class DerbyLuceneDir extends Directory
 	 */
     private static StorageFile createPathLeg
         ( final StorageFactory storageFactory, final StorageFile parentDir, final String
fileName )
-        throws SQLException, IOException, PrivilegedActionException
+        throws SQLException
     {
-        return AccessController.doPrivileged
-            (
+        try {
+            return AccessController.doPrivileged(
              new PrivilegedExceptionAction<StorageFile>()
              {
-                 public StorageFile run() throws IOException, SQLException
+                 public StorageFile run() throws SQLException
                  {
                      String         normalizedName = LuceneSupport.derbyIdentifier( fileName
);
                      StorageFile    file = parentDir == null ?
@@ -403,6 +397,9 @@ class DerbyLuceneDir extends Directory
                  }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (SQLException) pae.getCause();
+        }
     }
     
 }

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java?rev=1596552&r1=1596551&r2=1596552&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java
Wed May 21 12:21:44 2014
@@ -23,12 +23,12 @@ 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;
-import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.Properties;
 
@@ -57,11 +57,9 @@ public class LuceneListIndexesVTI extend
 
 	/**
 	 * Return a new LuceneListIndexesVTI.
-	 * 
-	 * @throws IOException
 	 */
 	public LuceneListIndexesVTI()
-        throws IOException, PrivilegedActionException, SQLException
+        throws SQLException
     {
 		super
             ( new String[]
@@ -219,13 +217,12 @@ public class LuceneListIndexesVTI extend
 
     /** List files */
     private static  StorageFile[]  listDirectories( final StorageFactory storageFactory,
final StorageFile dir )
-        throws IOException, PrivilegedActionException
     {
         return AccessController.doPrivileged
             (
-             new PrivilegedExceptionAction<StorageFile[]>()
+             new PrivilegedAction<StorageFile[]>()
              {
-                public StorageFile[] run() throws IOException
+                public StorageFile[] run()
                 {
                     ArrayList<StorageFile>  subdirectories = new ArrayList<StorageFile>();
                     String[]    fileNames = dir.list();
@@ -247,9 +244,10 @@ public class LuceneListIndexesVTI extend
 
     /** Read the index properties file */
     private static  Properties readIndexProperties( final StorageFile file )
-        throws IOException, PrivilegedActionException
+        throws IOException
     {
-        return AccessController.doPrivileged
+        try {
+            return AccessController.doPrivileged
             (
              new PrivilegedExceptionAction<Properties>()
              {
@@ -259,6 +257,9 @@ public class LuceneListIndexesVTI extend
                 }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
     }
 
 }
\ No newline at end of file

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java?rev=1596552&r1=1596551&r2=1596552&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
Wed May 21 12:21:44 2014
@@ -29,7 +29,6 @@ import java.security.PrivilegedActionExc
 import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.Date;
-import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -38,15 +37,11 @@ import java.util.Properties;
 import org.apache.derby.io.StorageFile;
 import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.optional.api.LuceneUtils;
-import org.apache.derby.vti.RestrictedVTI;
-import org.apache.derby.vti.Restriction;
-import org.apache.derby.vti.Restriction.ColumnQualifier;
 import org.apache.derby.vti.StringColumnVTI;
 import org.apache.derby.vti.VTIContext;
 import org.apache.derby.vti.VTITemplate;
 
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexableField;
@@ -58,7 +53,6 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopScoreDocCollector;
-import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.Version;
 
@@ -461,10 +455,6 @@ public class LuceneQueryVTI extends Stri
         catch (IOException ioe) { throw LuceneSupport.wrap( ioe ); }
         catch (ParseException pe) { throw LuceneSupport.wrap( pe ); }
         catch (PrivilegedActionException pae) { throw LuceneSupport.wrap( pae ); }
-        catch (ClassNotFoundException cnfe) { throw LuceneSupport.wrap( cnfe ); }
-        catch (IllegalAccessException iae) { throw LuceneSupport.wrap( iae ); }
-        catch (InvocationTargetException ite) { throw LuceneSupport.wrap( ite ); }
-        catch (NoSuchMethodException nsme) { throw LuceneSupport.wrap( nsme ); }
     }
 
     /**
@@ -536,8 +526,7 @@ public class LuceneQueryVTI extends Stri
          final String fieldName,
          final Analyzer analyzer
          )
-        throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
-               NoSuchMethodException, PrivilegedActionException
+        throws PrivilegedActionException
     {
         return AccessController.doPrivileged
             (
@@ -565,23 +554,28 @@ public class LuceneQueryVTI extends Stri
 	private static IndexReader getIndexReader( final DerbyLuceneDir dir )
         throws IOException, PrivilegedActionException
     {
-        return AccessController.doPrivileged
+        try {
+            return AccessController.doPrivileged
             (
              new PrivilegedExceptionAction<IndexReader>()
              {
-                 public IndexReader run() throws SQLException, IOException
+                 public IndexReader run() throws IOException
                  {
                      return DirectoryReader.open( dir );
                  }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
 	}
 	
     /** Read the index properties file */
     private static  Properties readIndexProperties( final StorageFile file )
-        throws IOException, PrivilegedActionException
+        throws IOException
     {
-        return AccessController.doPrivileged
+        try {
+            return AccessController.doPrivileged
             (
              new PrivilegedExceptionAction<Properties>()
              {
@@ -591,6 +585,9 @@ public class LuceneQueryVTI extends Stri
                 }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
     }
 
 	/**
@@ -598,8 +595,7 @@ public class LuceneQueryVTI extends Stri
      * The method has no arguments.
 	 */
 	private static Analyzer getAnalyzer( final String analyzerMaker )
-        throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
-               NoSuchMethodException, PrivilegedActionException
+        throws PrivilegedActionException
     {
         return AccessController.doPrivileged
             (
@@ -616,9 +612,10 @@ public class LuceneQueryVTI extends Stri
 	
     /** Read the index properties file */
     private void    searchAndScore( final Query luceneQuery, final TopScoreDocCollector tsdc
)
-        throws IOException, PrivilegedActionException
+        throws IOException
     {
-        AccessController.doPrivileged
+        try {
+            AccessController.doPrivileged
             (
              new PrivilegedExceptionAction<Object>()
              {
@@ -632,6 +629,9 @@ public class LuceneQueryVTI extends Stri
                 }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
     }
 
 }

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java?rev=1596552&r1=1596551&r2=1596552&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
Wed May 21 12:21:44 2014
@@ -21,14 +21,13 @@
 
 package org.apache.derby.optional.lucene;
 
-import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.nio.charset.Charset;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
@@ -61,28 +60,18 @@ import org.apache.derby.io.StorageFactor
 import org.apache.derby.io.StorageFile;
 import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.optional.api.LuceneUtils;
-import org.apache.derby.vti.Restriction.ColumnQualifier;
 import org.apache.derby.vti.VTITemplate;
 
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.BinaryDocValuesField;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.document.StoredField;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryparser.classic.QueryParser;
 import org.apache.lucene.queryparser.classic.ParseException;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.Version;
 
@@ -299,13 +288,12 @@ public class LuceneSupport implements Op
         //
         // Now delete the Lucene subdirectory;
         //
-        try {
-            StorageFactory  storageFactory = getStorageFactory( conn );
-            StorageFile     luceneDir = storageFactory.newStorageFile( Database.LUCENE_DIR
);
-            if ( exists( luceneDir ) ) { deleteFile( luceneDir ); }
+        StorageFactory storageFactory = getStorageFactory(conn);
+        StorageFile luceneDir =
+                storageFactory.newStorageFile(Database.LUCENE_DIR);
+        if (exists(luceneDir)) {
+            deleteFile(luceneDir);
         }
-        catch (IOException ioe) { throw wrap( ioe ); }
-        catch (PrivilegedActionException pae) { throw wrap( pae ); }
 	}
 	
     /////////////////////////////////////////////////////////////////////
@@ -371,8 +359,7 @@ public class LuceneSupport implements Op
 	 * @throws IOException
 	 */
 	public static void updateIndex( String schema, String table, String textcol, String analyzerMaker
)
-        throws SQLException, IOException, PrivilegedActionException,
-               ClassNotFoundException, IllegalAccessException, InvocationTargetException,
NoSuchMethodException
+        throws SQLException, IOException, PrivilegedActionException
     {
         forbidReadOnlyConnections();
 
@@ -414,8 +401,7 @@ public class LuceneSupport implements Op
          String analyzerMaker,
          String... keyColumns
          )
-        throws SQLException, IOException, PrivilegedActionException,
-               ClassNotFoundException, IllegalAccessException, InvocationTargetException,
NoSuchMethodException
+        throws SQLException, IOException, PrivilegedActionException
     {
         forbidReadOnlyConnections();
         
@@ -449,8 +435,7 @@ public class LuceneSupport implements Op
          boolean create,
          String... keyColumns
          )
-        throws SQLException, IOException, PrivilegedActionException,
-               ClassNotFoundException, IllegalAccessException, InvocationTargetException,
NoSuchMethodException
+        throws SQLException, IOException, PrivilegedActionException
     {
         VTITemplate.ColumnDescriptor[] primaryKeys = new VTITemplate.ColumnDescriptor[ 0
];
 
@@ -597,10 +582,9 @@ public class LuceneSupport implements Op
 	 * @param textcol The column that is indexed
 	 * 
 	 * @throws SQLException
-	 * @throws IOException
 	 */
 	public static void dropIndex( String schema, String table, String textcol )
-        throws SQLException, IOException, PrivilegedActionException
+        throws SQLException
     {
         forbidReadOnlyConnections();
         
@@ -618,7 +602,7 @@ public class LuceneSupport implements Op
      * </p>
      */
 	private static void dropIndexDirectories( String schema, String table, String textcol )
-        throws SQLException, IOException, PrivilegedActionException
+        throws SQLException
     {
         DerbyLuceneDir  derbyLuceneDir = getDerbyLuceneDir( getDefaultConnection(), schema,
table, textcol );
 
@@ -1156,29 +1140,28 @@ public class LuceneSupport implements Op
     }
 
     /** Write the index properties file */
-    private static  void    writeIndexProperties( final StorageFile file, final Properties
properties )
-        throws IOException, PrivilegedActionException
+    private static  void    writeIndexProperties( final StorageFile file, Properties properties
)
+        throws IOException
     {
-        AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<Object>()
-             {
-                public Object run() throws IOException
-                {
-                    if ( (file == null) || (properties == null) ) { return null; }
-                    else
-                    {
-                        OutputStream    os = file.getOutputStream();
-
-                        properties.store( os, null );
-                        os.flush();
-                        os.close();
+        if (file == null || properties == null) {
+            return;
+        }
 
-                        return null;
-                    }
+        OutputStream os;
+        try {
+            os = AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<OutputStream>() {
+                public OutputStream run() throws IOException {
+                    return file.getOutputStream();
                 }
-             }
-             );
+            });
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
+
+        properties.store( os, null );
+        os.flush();
+        os.close();
     }
 
     /////////////////////////////////////////////////////////////////////
@@ -1532,13 +1515,12 @@ public class LuceneSupport implements Op
 
     /** Return true if the directory is empty */
     private static  boolean isEmpty( final StorageFile dir )
-        throws IOException, PrivilegedActionException
     {
         String[]  contents = AccessController.doPrivileged
             (
-             new PrivilegedExceptionAction<String[]>()
+             new PrivilegedAction<String[]>()
              {
-                 public String[] run() throws IOException, SQLException
+                 public String[] run()
                 {
                     return dir.list();
                 }
@@ -1552,13 +1534,12 @@ public class LuceneSupport implements Op
 
     /** Return true if the file exists */
     private static  boolean exists( final StorageFile file )
-        throws IOException, PrivilegedActionException
     {
         return AccessController.doPrivileged
             (
-             new PrivilegedExceptionAction<Boolean>()
+             new PrivilegedAction<Boolean>()
              {
-                 public Boolean run() throws IOException, SQLException
+                 public Boolean run()
                 {
                     return file.exists();
                 }
@@ -1568,25 +1549,21 @@ public class LuceneSupport implements Op
 
     /** Really delete a file */
     private static  boolean deleteFile( final StorageFile file )
-        throws IOException, SQLException, PrivilegedActionException
+        throws SQLException
     {
-        return AccessController.doPrivileged
-            (
-             new PrivilegedExceptionAction<Boolean>()
-             {
-                 public Boolean run() throws IOException, SQLException
-                {
-                    boolean result = file.isDirectory() ? file.deleteAll() : file.delete();
+        boolean result = AccessController.doPrivileged(
+                new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return file.isDirectory() ? file.deleteAll() : file.delete();
+            }
+        });
 
-                    if ( !result )
-                    {
-                        throw newSQLException( SQLState.UNABLE_TO_DELETE_FILE, file.getPath()
);
-                    }
+        if (!result) {
+            throw newSQLException(SQLState.UNABLE_TO_DELETE_FILE,
+                                  file.getPath());
+        }
 
-                    return result;
-                }
-             }
-             ).booleanValue();
+        return result;
     }
 
     /** Forbid invalid character */
@@ -1622,13 +1599,14 @@ public class LuceneSupport implements Op
          final  Analyzer    analyzer,
          final DerbyLuceneDir   derbyLuceneDir
          )
-        throws SQLException, IOException, PrivilegedActionException
+        throws IOException
     {
-        return AccessController.doPrivileged
+        try {
+            return AccessController.doPrivileged
             (
              new PrivilegedExceptionAction<IndexWriter>()
              {
-                 public IndexWriter run() throws SQLException, IOException
+                 public IndexWriter run() throws IOException
                  {
                      // allow this to be overridden in the configuration during load later.
                      IndexWriterConfig iwc = new IndexWriterConfig( luceneVersion, analyzer
);
@@ -1638,6 +1616,9 @@ public class LuceneSupport implements Op
                  }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
 	}
 	
 	/**
@@ -1648,13 +1629,14 @@ public class LuceneSupport implements Op
          final IndexWriter  indexWriter,
          final Document     document
          )
-        throws IOException, PrivilegedActionException
+        throws IOException
     {
-        AccessController.doPrivileged
+        try {
+            AccessController.doPrivileged
             (
-             new PrivilegedExceptionAction<Object>()
+             new PrivilegedExceptionAction<Void>()
              {
-                 public Object run() throws IOException
+                 public Void run() throws IOException
                  {
                      indexWriter.addDocument( document );
 		
@@ -1662,19 +1644,23 @@ public class LuceneSupport implements Op
                  }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
     }
 
 	/**
 	 * Close an IndexWriter.
 	 */
     private static void close( final IndexWriter  indexWriter )
-        throws IOException, PrivilegedActionException
+        throws IOException
     {
-        AccessController.doPrivileged
+        try {
+            AccessController.doPrivileged
             (
-             new PrivilegedExceptionAction<Object>()
+             new PrivilegedExceptionAction<Void>()
              {
-                 public Object run() throws IOException
+                 public Void run() throws IOException
                  {
                      indexWriter.close();
 		
@@ -1682,6 +1668,9 @@ public class LuceneSupport implements Op
                  }
              }
              );
+        } catch (PrivilegedActionException pae) {
+            throw (IOException) pae.getCause();
+        }
     }
 
 	/**
@@ -1689,8 +1678,7 @@ public class LuceneSupport implements Op
      * The method has no arguments.
 	 */
 	private static Analyzer getAnalyzer( final String analyzerMaker )
-        throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
-               NoSuchMethodException, PrivilegedActionException
+        throws PrivilegedActionException
     {
         return AccessController.doPrivileged
             (
@@ -1744,7 +1732,9 @@ public class LuceneSupport implements Op
                  }
                  );
         }
-        catch (PrivilegedActionException pae) { throw wrap( pae ); }
+        catch (PrivilegedActionException pae) {
+            throw (SQLException) pae.getCause();
+        }
     }
 
     /////////////////////////////////////////////////////////////////////



Mime
View raw message