ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1028755 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/util/StringUtils.java
Date Fri, 29 Oct 2010 14:05:06 GMT
Author: stevel
Date: Fri Oct 29 14:05:05 2010
New Revision: 1028755

URL: http://svn.apache.org/viewvc?rev=1028755&view=rev
Log:
Bugzilla Report 48835 StringUtils.parseHumanSizes() should turn parse failures into  BuildExceptions.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1028755&r1=1028754&r2=1028755&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Oct 29 14:05:05 2010
@@ -254,6 +254,10 @@ Other changes:
    in verbose runs.
    Bugzilla Report 48836.
 
+ * StringUtils.parseHumanSizes() should turn parse failures into
+   BuildExceptions.
+   Bugzilla Report 48835.
+
 Changes from Ant 1.8.0 TO Ant 1.8.1 
 ===================================
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java?rev=1028755&r1=1028754&r2=1028755&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java Fri Oct 29 14:05:05
2010
@@ -17,6 +17,8 @@
  */
 package org.apache.tools.ant.util;
 
+import org.apache.tools.ant.BuildException;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Vector;
@@ -239,7 +241,11 @@ public final class StringUtils {
             }
             humanSize = humanSize.substring(0, humanSize.length() - trim);
         }
-        return factor * Long.parseLong(humanSize);
+        try {
+            return factor * Long.parseLong(humanSize);
+        } catch (NumberFormatException e) {
+            throw new BuildException("Failed to parse \"" + humanSize + "\"", e);
+        }
     }
 
     /**



Mime
View raw message