FileStoreSpaceAttributeView#readAttributes("totalSpace") does not return totalSpace
Alan Bateman
Alan.Bateman at Sun.COM
Thu Sep 4 01:14:30 PDT 2008
Rémi Forax wrote:
> Rajendra Gutupalli a écrit :
>> Hi Alan,
>>
>> Spec for FileStoreSpaceAttributeView#readAttributes says
>> "totalSpace/usableSpace/unallocatedSpace" can be retrieved by passing
>> the respective string parameter, but it does not return as expected.
>> I just saw the code to see what happening for this input I think
>> comparison might be like this.
>>
>> -- if (attribute.equals("total")) {
>> ++ if (attribute.equals("totalSapce")
>>
>> Could you please tell me if this is correct.
>>
>> Thanks
>> Rajendra.
> it's not correct, you made a typo :)
> totalSapce <=> totalSpace
>
> by the way using String here is really error prone.
Yes, it can be error prone as you have to get the name and the type
right. The typesafe way to do this (for this example) is to use
Attributes.readFileStoreSpaceAttributes. We'd like to have the
Attributes class define methods to cover the common cases for the well
defined attributes. Once you go beyond this, and need to access highly
provider or platform specific attributes, then the choice is to make use
of a provider/platform specific attribute view that provides typed
access or else to use the methods that provide dynamic access. Each has
their downsides.
-Alan.
More information about the nio-dev
mailing list