[FIXED JENKINS-16630] Human readable file size method returns ",00" for

files with byte length 0
This commit is contained in:
Fred G committed 2013-02-05 01:26:50 +01:00
1 parent c9adc14485
commit f19f772322
1 file changed
+4 -1
+4 -1
View File
@@ -1548,6 +1548,9 @@ public class Functions {
*/
public static String humanReadableByteSize(long size){
String measure = "B";
if(size < 1024){
return size + " " + measure;
}
Double number = new Double(size);
if(number>=1024){
number = number/1024;
@@ -1561,7 +1564,7 @@ public class Functions {
}
}
}
DecimalFormat format = new DecimalFormat("##.00");
DecimalFormat format = new DecimalFormat("#0.00");
return format.format(number) + " " + measure;
}
}