mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-03 07:05:55 +00:00
[FIXED JENKINS-16630] Human readable file size method returns ",00" for
files with byte length 0
This commit is contained in:
1 parent
c9adc14485
commit
f19f772322
1 file changed
+4
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user