lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [06/52] [abbrv] lucenenet git commit: BUG: Lucene.Net.TestFramework.Util.LuceneTestCase.CreateTempFile(): Method of getting file name is not thread-safe and causing file locking between tests. Cascading call to FileSuppport.CreateTempFile() instead.
Date Tue, 25 Apr 2017 11:50:47 GMT
BUG: Lucene.Net.TestFramework.Util.LuceneTestCase.CreateTempFile(): Method of getting file
name is not thread-safe and causing file locking between tests. Cascading call to FileSuppport.CreateTempFile()
instead.


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

Branch: refs/heads/master
Commit: c62a45b09af5da3d5bbab24ebe46555c09ef96ad
Parents: 077b57f
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Apr 18 13:40:26 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Tue Apr 18 13:40:26 2017 +0700

----------------------------------------------------------------------
 .../Util/LuceneTestCase.cs                      | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c62a45b0/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 386b006..d16f04a 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2787,16 +2787,17 @@ namespace Lucene.Net.Util
         {
             //DirectoryInfo @base = BaseTempDirForTestClass();
 
-            int attempt = 0;
-            FileInfo f;
-            do
-            {
-                if (attempt++ >= TEMP_NAME_RETRY_THRESHOLD)
-                {
-                    throw new Exception("Failed to get a temporary name too many times, check
your temp directory and consider manually cleaning it: " + System.IO.Path.GetTempPath());
-                }
-                f = new FileInfo(Path.Combine(System.IO.Path.GetTempPath(), prefix + "-"
+ string.Format(CultureInfo.InvariantCulture, "%03d", attempt) + suffix));
-            } while (f.Create() == null);
+            //int attempt = 0;
+            FileInfo f = FileSupport.CreateTempFile(prefix, suffix, new DirectoryInfo(System.IO.Path.GetTempPath()));
+            //do
+            //{
+            //    if (attempt++ >= TEMP_NAME_RETRY_THRESHOLD)
+            //    {
+            //        throw new Exception("Failed to get a temporary name too many times,
check your temp directory and consider manually cleaning it: " + System.IO.Path.GetTempPath());
+            //    }
+            //    //f = new FileInfo(Path.Combine(System.IO.Path.GetTempPath(), prefix +
"-" + string.Format(CultureInfo.InvariantCulture, "{0:D3}", attempt) + suffix));
+            //    f = FileSupport.CreateTempFile(prefix, suffix, new DirectoryInfo(System.IO.Path.GetTempPath()));
+            //} while (f.Create() == null);
 
             RegisterToRemoveAfterSuite(f);
             return f;


Mime
View raw message