NamedAttributeView#write does not replace the value for an existing subfile(named attr) instead it overwrites?
Alan Bateman
Alan.Bateman at Sun.COM
Mon Jun 9 02:38:04 PDT 2008
Rajendra Gutupalli wrote:
> Hi Alan,
>
> The spec for NamedAttributeView#write says
> "If an attribute of the given name already exists then its value is
> replaced. If the attribute does not exist then it is created."
> But I observed if an attribute of the given name already exists then
> its value is overwriting on the previous value instead of replacing
> entire value.
> First I have written "stream file" value to the subfile "txt" for a
> file c:\testf, again I tried adding value "r" to the subfile "txt"
> which already exists.
> Instead of chainging the subfile value to "r" it overwrites as "rtream
> file". Please see the following result and program.
> Please tell me what is the expected output for this scenario.
>
> Tried in Windows XP.
When emulated on file systems that provide named subfiles rather than
named attributes then the existing subfile is supposed to be truncated.
The bug here is that the truncate flag is getting overridden in the
translation (Windows only, Solaris is okay). I'm happy you've found this
as it highlights that the unit test I included for this part of the API
is insufficient. I've fixed it in my repository so it will be in the
next build.
-Alan.
More information about the nio-dev
mailing list