Browse Source

refine

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@549683 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
4b18adb729
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/main/org/apache/tools/ant/util/StringUtils.java

+ 3
- 2
src/main/org/apache/tools/ant/util/StringUtils.java View File

@@ -217,6 +217,7 @@ public final class StringUtils {
//last character isn't a digit //last character isn't a digit
char c = humanSize.charAt(humanSize.length() - 1); char c = humanSize.charAt(humanSize.length() - 1);
if (!Character.isDigit(c)) { if (!Character.isDigit(c)) {
int trim = 1;
switch (c) { switch (c) {
case 'K': case 'K':
factor *= KILOBYTE; factor *= KILOBYTE;
@@ -234,9 +235,9 @@ public final class StringUtils {
factor *= PETABYTE; factor *= PETABYTE;
break; break;
default: default:
break;
trim = 0;
} }
humanSize = humanSize.substring(0, humanSize.length() - 1);
humanSize = humanSize.substring(0, humanSize.length() - trim);
} }
return factor * Long.parseLong(humanSize); return factor * Long.parseLong(humanSize);
} }


Loading…
Cancel
Save