lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [3/3] lucenenet git commit: Cleanup
Date Sat, 07 Feb 2015 22:58:21 GMT
Cleanup


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b7108d48
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b7108d48
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b7108d48

Branch: refs/heads/master
Commit: b7108d486d3b3bbe14fd6a3ae130fc208bb49b11
Parents: 513d91f
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Feb 8 00:58:01 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Feb 8 00:58:01 2015 +0200

----------------------------------------------------------------------
 .../core/Store/TestDirectory.cs                 | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7108d48/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
index 0795d3c..995f9fd 100644
--- a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
@@ -35,7 +35,7 @@ namespace Lucene.Net.Store
         [Test]
         public virtual void TestDetectClose()
         {
-            DirectoryInfo tempDir = new System.IO.DirectoryInfo(AppSettings.Get("tempDir",
System.IO.Path.GetTempPath()));//CreateTempDir(LuceneTestCase.TestClass.SimpleName);
+            DirectoryInfo tempDir = new System.IO.DirectoryInfo("TestDetectClose");// LUCENENET
TODO LuceneTestCase.TestClass.SimpleName
             Directory[] dirs = new Directory[] { new RAMDirectory(), new SimpleFSDirectory(tempDir),
new NIOFSDirectory(tempDir) };
 
             foreach (Directory dir in dirs)
@@ -82,8 +82,8 @@ namespace Lucene.Net.Store
 
         private class TheThread : ThreadClass
         {
-            private string name;
-            private BaseDirectoryWrapper outerBDWrapper;
+            private readonly string name;
+            private readonly BaseDirectoryWrapper outerBDWrapper;
 
             public TheThread(string name, BaseDirectoryWrapper baseDirectoryWrapper)
             {
@@ -99,8 +99,7 @@ namespace Lucene.Net.Store
 
                     try
                     {
-                        IndexOutput output = outerBDWrapper.CreateOutput(fileName, NewIOContext(Random()));
-                        output.Dispose();
+                        using (IndexOutput output = outerBDWrapper.CreateOutput(fileName,
NewIOContext(Random()))) { }
                         Assert.IsTrue(SlowFileExists(outerBDWrapper, fileName));
                     }
                     catch (IOException e)
@@ -113,12 +112,12 @@ namespace Lucene.Net.Store
 
         private class TheThread2 : ThreadClass
         {
-            private string name;
-            private BaseDirectoryWrapper outerBDWrapper;
+            private string _name;
+            private readonly BaseDirectoryWrapper outerBDWrapper;
 
             public TheThread2(string name, BaseDirectoryWrapper baseDirectoryWrapper)
             {
-                this.name = name;
+                this._name = name;
                 outerBDWrapper = baseDirectoryWrapper;
             }
 
@@ -133,8 +132,7 @@ namespace Lucene.Net.Store
                         {
                             try
                             {
-                                IndexInput input = outerBDWrapper.OpenInput(file, NewIOContext(Random()));
-                                input.Dispose();
+                                using (IndexInput input = outerBDWrapper.OpenInput(file,
NewIOContext(Random()))) { }
                             }
                             catch (FileNotFoundException fne)
                             {
@@ -339,7 +337,7 @@ namespace Lucene.Net.Store
                 Assert.IsTrue(SlowFileExists(fsDir, "afile"));
                 try
                 {
-                    new SimpleFSDirectory(new DirectoryInfo(Path.Combine(path.FullName, "afile")),
null);
+                    var d = new SimpleFSDirectory(new DirectoryInfo(Path.Combine(path.FullName,
"afile")), null);
                     Assert.Fail("did not hit expected exception");
                 }
                 catch (NoSuchDirectoryException nsde)


Mime
View raw message