lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r836278 - /incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
Date Sat, 14 Nov 2009 22:36:19 GMT
Author: aroush
Date: Sat Nov 14 22:36:19 2009
New Revision: 836278

URL: http://svn.apache.org/viewvc?rev=836278&view=rev
Log:
Reintroduced Lucene exceptions that were remove.

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/FSDirectory.cs?rev=836278&r1=836277&r2=836278&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs Sat Nov 14 22:36:19
2009
@@ -411,7 +411,14 @@
 			{
                 if (!this.directory.Exists)
                 {
-                    this.directory.Create();
+                    try
+                    {
+                        this.directory.Create();
+                    }
+                    catch (Exception)
+                    {
+                        throw new System.IO.IOException("Cannot create directory: " + directory);
+                    }
                     this.directory.Refresh(); // need to see the creation
                 }
 				
@@ -427,9 +434,16 @@
 			EnsureOpen();
 			CreateDir();
 			System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName,
name));
-            if (file.Exists)
+            if (file.Exists) // delete existing, if any
             {
-                file.Delete(); // handled by caller if error
+                try
+                {
+                    file.Delete();
+                }
+                catch (Exception)
+                {
+                    throw new System.IO.IOException("Cannot overwrite: " + file);
+                }
             }
 		}
 		
@@ -738,7 +752,14 @@
 		{
 			EnsureOpen();
 			System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName,
name));
-            file.Delete();
+            try
+            {
+                file.Delete();
+            }
+            catch (Exception)
+            {
+                throw new System.IO.IOException("Cannot delete " + file);
+            }
 		}
 		
 		/// <summary>Renames an existing file in the directory. 
@@ -752,7 +773,15 @@
 			{
 				EnsureOpen();
                 System.IO.FileInfo old = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName,
from));
-                old.MoveTo(System.IO.Path.Combine(directory.FullName, to));
+                try
+                {
+                    old.MoveTo(System.IO.Path.Combine(directory.FullName, to));
+                }
+                catch (System.IO.IOException ioe)
+                {
+                    System.IO.IOException newExc = new System.IO.IOException("Cannot rename
" + old + " to " + directory, ioe);
+                    throw newExc;
+                }
 			}
 		}
 		



Mime
View raw message