This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit a2758d6fc47c66f2d1ef35a047395605f3dd807d
Author: Thomas Mathew <[email protected]>
AuthorDate: Fri Jun 7 13:37:47 2019 -0700

    Use AddValueFactory
---
 src/Lucene.Net/Support/IO/FileSupport.cs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net/Support/IO/FileSupport.cs 
b/src/Lucene.Net/Support/IO/FileSupport.cs
index dacba8b..dd89e32 100644
--- a/src/Lucene.Net/Support/IO/FileSupport.cs
+++ b/src/Lucene.Net/Support/IO/FileSupport.cs
@@ -298,8 +298,9 @@ namespace Lucene.Net.Support.IO
             newResult[newLength] = 0;
             //newResult = getCanonImpl(newResult);
             newLength = newResult.Length;
-            canonPath = Encoding.UTF8.GetString(newResult, 0, 
newLength).TrimEnd('\0'); // LUCENENET: Eliminate null terminator char
-            canonPath = fileCanonPathCache.GetOrAdd(absPath, canonPath); // 
It's possible that a concurrent call may have already added it to the cache.
+            canonPath = fileCanonPathCache.GetOrAdd(
+                absPath,
+                k => Encoding.UTF8.GetString(newResult, 0, 
newLength).TrimEnd('\0')); // LUCENENET: Eliminate null terminator char
             return canonPath;
         }
     }

Reply via email to