You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2009/11/14 23:36:19 UTC
svn commit: r836278 -
/incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
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;
+ }
}
}