lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Aroush (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (LUCENENET-15) The RenameFile function in FSDirectory has a small bug if old.MoveTo throws an exception
Date Sat, 30 Sep 2006 03:33:23 GMT
     [ http://issues.apache.org/jira/browse/LUCENENET-15?page=all ]

George Aroush resolved LUCENENET-15.
------------------------------------

    Resolution: Fixed

Fixed in Lucene.Net 1.9, 1.9.1 and 2.0

> The RenameFile function in FSDirectory has a small bug if old.MoveTo throws an exception
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-15
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-15
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: All
>            Reporter: Asgeir Halldorsson
>         Assigned To: George Aroush
>
> If an Exception is caught in old.MoveTo it will go thru a "Backup" action (Copy).  But
there is a small issue in this line
>                         int len;
>                         len = in_Renamed.Read(buffer, 0, buffer.Length);
>                         out_Renamed.Write(buffer, 0, len);
> The while loop is missing so it would only copy first 1024 bytes max.
> Solution:
>                         int len;
>                         while ((len = in_Renamed.Read(buffer, 0, buffer.Length)) >
0) {
>                                                 out_Renamed.Write(buffer, 0, len);
>                         }
> I am wondering about 2 things why is the default buffer only 1024bytes?  Does it hurt
to have 4k buffer?
> Also in the "Backup" action why not use:  old.CopyTo(nu.FullName);
> Also as a final thought the backup action ends with a attempt to delete the old file.
 But if MoveTo fails due to Source being locked I would guess that this method would fail
also due to locking issue.  Why not just try to Delete if fail then resume.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message