tst2005googlecode / opendedup

Automatically exported from code.google.com/p/opendedup
1 stars 0 forks source link

java.lang.NumberFormatException: For input string: "40,05" #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Mount the sdfs partition
2. Try to get the statistics of the partition with sdfscli  --volume-info 
3. And volaa, you get the error

What is the expected output? What do you see instead?
Should see all the statistics of the partition, but all I see is:
root@ubuntucloud:/dedup/kari# sdfscli  --volume-info 
Volume Capacity : 20 GB 
Volume Current Size : 678,5 MB 
Volume Max Percentage Full : Unlimited 
Volume Duplicate Data Written : 271,9 MB 
Volume Unique Data Written: 407 MB 
Volume Data Read : 90,6 MB 
java.lang.NumberFormatException: For input string: "40,05" 
        at 
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java: 
1241) 
        at java.lang.Double.valueOf(Double.java:504) 
        at 
org.opendedup.sdfs.mgmt.cli.ProcessVolumeInfo.runCmd(ProcessVolumeInfo.java : 
48) 
        at 
org.opendedup.sdfs.mgmt.cli.SDFSCmdline.parseCmdLine(SDFSCmdline.java: 
37) 
        at 
org.opendedup.sdfs.mgmt.cli.SDFSCmdline.main(SDFSCmdline.java:176) 

What version of the product are you using? On what operating system?
1.0.7 Ubuntu Server 11.04 AMD64

Please provide any additional information below.
Well I think it might be something to do with the locales, because my locale is 
Fi (Finnish) so the Number format is different.. Maybe making some changes to 
the locale handling would fix this?

Original issue reported on code.google.com by kari.sky...@skoude.com on 8 Aug 2011 at 7:40

GoogleCodeExporter commented 9 years ago
Same issue occurs here on Windows 7 Home with German locale.

Original comment by mgroe...@gmx.net on 26 Dec 2011 at 9:55

GoogleCodeExporter commented 9 years ago
Just had a quick look at the source code. The reason for the error is most 
likely the use of DecimalFormatter in ProcessVolumeInfo.java:

DecimalFormat twoDForm = new DecimalFormat("#.##");
dedupRate = Double.valueOf(twoDForm.format(dedupRate));

This is ok if the locale specifies "." as the decimal separator (which valueOf 
can parse), but not for any other settings. Would it make sense to simply print

twoDForm.format(dedupRate)

as a string directly, rathern than converting it to double and back for the 
printf() statement?

Original comment by mgroe...@gmx.net on 5 Jan 2012 at 11:25