Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 f19f772
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/Functions.java
Expand Up @@ -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;
Expand All @@ -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.