Skip to content
Permalink
Browse files
[FIXED JENKINS-16630] Human readable file size method returns ",00" for
files with byte length 0
  • Loading branch information
fredg02 committed Feb 5, 2013
1 parent c9adc14 commit f19f772322ab3645d4f0784f28acdccc5b8ea582
Showing with 4 additions and 1 deletion.
  1. +4 −1 core/src/main/java/hudson/Functions.java
@@ -1548,6 +1548,9 @@ public String getUserAvatar(User user, String avatarSize) {
*/
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 static String humanReadableByteSize(long size){
}
}
}
DecimalFormat format = new DecimalFormat("##.00");
DecimalFormat format = new DecimalFormat("#0.00");
return format.format(number) + " " + measure;
}
}

0 comments on commit f19f772

Please sign in to comment.