You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "George Aroush (JIRA)" <ji...@apache.org> on 2006/09/30 03:51:21 UTC
[jira] Assigned: (LUCENENET-15) The RenameFile function in
FSDirectory has a small bug if old.MoveTo throws an exception
[ http://issues.apache.org/jira/browse/LUCENENET-15?page=all ]
George Aroush reassigned LUCENENET-15:
--------------------------------------
Assignee: George Aroush
> 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