Return-Path: X-Original-To: apmail-lucenenet-commits-archive@www.apache.org Delivered-To: apmail-lucenenet-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50CFF17AAB for ; Sat, 2 May 2015 19:49:59 +0000 (UTC) Received: (qmail 67279 invoked by uid 500); 2 May 2015 19:49:59 -0000 Delivered-To: apmail-lucenenet-commits-archive@lucenenet.apache.org Received: (qmail 67251 invoked by uid 500); 2 May 2015 19:49:59 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 67242 invoked by uid 99); 2 May 2015 19:49:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 May 2015 19:49:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E71ACE0779; Sat, 2 May 2015 19:49:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: synhershko@apache.org To: commits@lucenenet.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: lucenenet git commit: Fixing test failures relating to folders existence checks Date: Sat, 2 May 2015 19:49:58 +0000 (UTC) Repository: lucenenet Updated Branches: refs/heads/master 7a1f331a1 -> df753f9c8 Fixing test failures relating to folders existence checks Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/df753f9c Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/df753f9c Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/df753f9c Branch: refs/heads/master Commit: df753f9c8729fe1bbad9c2245d68efd7813778ab Parents: 7a1f331 Author: Itamar Syn-Hershko Authored: Sat May 2 22:49:39 2015 +0300 Committer: Itamar Syn-Hershko Committed: Sat May 2 22:49:39 2015 +0300 ---------------------------------------------------------------------- src/Lucene.Net.Core/Store/FileSwitchDirectory.cs | 2 +- src/Lucene.Net.Tests/core/Store/TestDirectory.cs | 6 ++++-- .../core/Store/TestFileSwitchDirectory.cs | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/df753f9c/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs b/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs index 0e4468f..362bf5c 100644 --- a/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs +++ b/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs @@ -112,7 +112,7 @@ namespace Lucene.Net.Store files.Add(f); } } - catch (NoSuchDirectoryException e) + catch (NoSuchDirectoryException) { // we got NoSuchDirectoryException from both dirs // rethrow the first. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/df753f9c/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 995f9fd..5d4f01e 100644 --- a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs +++ b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs @@ -1,6 +1,7 @@ using Lucene.Net.Attributes; using Lucene.Net.Randomized.Generators; using Lucene.Net.Support; +using Lucene.Net.Util; using NUnit.Framework; using System; using System.IO; @@ -258,7 +259,8 @@ namespace Lucene.Net.Store [Test] public virtual void TestDontCreate() { - var path = new DirectoryInfo(Path.Combine(AppSettings.Get("tmpDir", ""), "doesnotexist")); + var parentFolder = CreateTempDir(this.GetType().Name.ToLowerInvariant()); + var path = new DirectoryInfo(Path.Combine(parentFolder.FullName, "doesnotexist")); try { Assert.IsTrue(!path.Exists); @@ -268,7 +270,7 @@ namespace Lucene.Net.Store } finally { - System.IO.Directory.Delete(path.FullName, true); + if (path.Exists) System.IO.Directory.Delete(path.FullName, true); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/df753f9c/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs index 6cfa6f0..8228e10 100644 --- a/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs +++ b/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs @@ -113,17 +113,18 @@ namespace Lucene.Net.Store DirectoryInfo secondDir = CreateTempDir("bar"); System.IO.Directory.Delete(primDir.FullName, true); System.IO.Directory.Delete(secondDir.FullName, true); - Directory dir = NewFSSwitchDirectory(primDir, secondDir, new HashSet()); - try - { - DirectoryReader.Open(dir); - Assert.Fail("did not hit expected exception"); - } - catch (IndexNotFoundException nsde) + using (Directory dir = NewFSSwitchDirectory(primDir, secondDir, new HashSet())) { - // expected + try + { + DirectoryReader.Open(dir); + Assert.Fail("did not hit expected exception"); + } + catch (NoSuchDirectoryException) + { + // expected + } } - dir.Dispose(); } // LUCENE-3380 test that we can add a file, and then when we call list() we get it back