-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Open
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: documentationA documentation taskA documentation task
Milestone
Description
org.springframework.util.unit.DataSize.parse(String value)
does not parse KB and MB as described in java doc. In fact it parses KiB and MiB according [IEC 80000-13]
Currently the comment is:
Obtain a DataSize from a text string such as 12MB using DataUnit.BYTES if no unit is specified.
Examples:
"12KB" -- parses as "12 kilobytes"
"5MB" -- parses as "5 megabytes"
"20" -- parses as "20 bytes"
But that comment is wrong. It parses 12KB to 12288 bytes. This are not 12 KB. This are 12 KiB.
IEC 80000-13 defines:
1 KiB = 1024 bytes
1MiB = 1024KiB
1KB = 1000 bytes
1MB = 1000 KB
Please clarify the documentation for the Parse method to avoid confusion for developers and minimize the risk of errors. Note: The confusion could be avoided in the class documentation. It explains what KB and MB mean (regardless of the fact that this is not IEC-compliant). However, there is no reference to this documentation. I also suggest making a correction in the class documentation.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: documentationA documentation taskA documentation task