Repository: lucenenet
Updated Branches:
  refs/heads/api-work 077b57fae -> d0d2c3029


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/api-work
Commit: c62a45b09af5da3d5bbab24ebe46555c09ef96ad
Parents: 077b57f
Author: Shad Storhaug <[email protected]>
Authored: Tue Apr 18 13:40:26 2017 +0700
Committer: Shad Storhaug <[email protected]>
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;

Reply via email to