public override string[] ListAll() { lock (this) { ISet <string> files = new HashSet <string>(); foreach (string f in cache.ListAll()) { files.Add(f); } // LUCENE-1468: our NRTCachingDirectory will actually exist (RAMDir!), // but if the underlying delegate is an FSDir and mkdirs() has not // yet been called, because so far everything is a cached write, // in this case, we don't want to throw a NoSuchDirectoryException try { foreach (string f in @delegate.ListAll()) { // Cannot do this -- if lucene calls createOutput but // file already exists then this falsely trips: //assert !files.contains(f): "file \"" + f + "\" is in both dirs"; files.Add(f); } } catch (DirectoryNotFoundException /*ex*/) { // however, if there are no cached files, then the directory truly // does not "exist" if (files.Count == 0) { throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) } } return(files.ToArray()); } }
public override string[] ListAll() { lock (this) { ISet <string> files = new HashSet <string>(); foreach (string f in Cache.ListAll()) { files.Add(f); } // LUCENE-1468: our NRTCachingDirectory will actually exist (RAMDir!), // but if the underlying delegate is an FSDir and mkdirs() has not // yet been called, because so far everything is a cached write, // in this case, we don't want to throw a NoSuchDirectoryException try { foreach (string f in @delegate.ListAll()) { // Cannot do this -- if lucene calls createOutput but // file already exists then this falsely trips: //assert !files.contains(f): "file \"" + f + "\" is in both dirs"; files.Add(f); } } catch (NoSuchDirectoryException ex) { // however, if there are no cached files, then the directory truly // does not "exist" if (files.Count == 0) { throw ex; } } return(files.ToArray()); } }