@@ -317,33 +317,33 @@ public override void DeleteFile(string name)
317317 EnsureOpen ( ) ;
318318 string file = Path . Combine ( m_directory . FullName , name ) ;
319319
320- // LUCENENET specific: We need to explicitly throw when the file has already been deleted,
321- // since FileInfo doesn't do that for us.
322- // (An enhancement carried over from Lucene 8.2.0)
323- if ( ! File . Exists ( file ) )
324- {
325- throw new FileNotFoundException ( "Cannot delete " + file + " because it doesn't exist." ) ;
326- }
320+ // LUCENENET specific: We need to explicitly throw when the file has already been deleted,
321+ // since FileInfo doesn't do that for us.
322+ // (An enhancement carried over from Lucene 8.2.0)
323+ if ( ! File . Exists ( file ) )
324+ {
325+ throw new FileNotFoundException ( "Cannot delete " + file + " because it doesn't exist." ) ;
326+ }
327327
328- // LUCENENET specific : Do NOT hold m_syncLock while deleting. On a network share (SMB),
328+ // LUCENENET NOTE : Do NOT hold m_syncLock while deleting. On a network share (SMB),
329329 // File.Delete can block for a long time (e.g. waiting for the server to break an
330330 // oplock/lease on a file this client still has open). Holding m_syncLock here would
331331 // block every concurrent Sync() and IndexOutput.Dispose() on this directory behind
332332 // a single stalled delete, freezing the whole writer. Only the m_staleFiles
333333 // bookkeeping below needs the lock (see remarks for the m_staleFiles field);
334334 // upstream Java likewise performs the delete without any directory-wide lock.
335- try
336- {
337- File . Delete ( file ) ;
338- if ( File . Exists ( file ) )
339- {
340- throw new IOException ( "Cannot delete " + file ) ;
341- }
342- }
343- catch ( Exception e )
335+ try
336+ {
337+ File . Delete ( file ) ;
338+ if ( File . Exists ( file ) )
344339 {
345- throw new IOException ( "Cannot delete " + file , e ) ;
340+ throw new IOException ( "Cannot delete " + file ) ;
346341 }
342+ }
343+ catch ( Exception e )
344+ {
345+ throw new IOException ( "Cannot delete " + file , e ) ;
346+ }
347347
348348 UninterruptableMonitor . Enter ( m_syncLock ) ;
349349 try
0 commit comments