ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r486168 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java
Date Tue, 12 Dec 2006 14:49:14 GMT
Author: kevj
Date: Tue Dec 12 06:49:13 2006
New Revision: 486168

URL: http://svn.apache.org/viewvc?view=rev&rev=486168
Log:
-fix as suggested by DD, should now compile on pre java6 rt.jar

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java?view=diff&rev=486168&r1=486167&r2=486168
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java Tue
Dec 12 06:49:13 2006
@@ -18,6 +18,8 @@
 
 package org.apache.tools.ant.taskdefs.condition;
 
+import java.io.File;
+
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.util.JavaEnvUtils;
 import org.apache.tools.ant.util.ReflectWrapper;
@@ -39,9 +41,9 @@
         try {
             if (JavaEnvUtils.isAtLeastJavaVersion("1.6")) {
                 //reflection to avoid bootstrap/build problems
-                String j6FileUtils = "org.apache.tools.ant.util.java16.Java6FileUtils";
-                ReflectWrapper w = new ReflectWrapper(getClass().getClassLoader(), j6FileUtils);
-                long free = ((Long)w.invoke("freeSpace", String.class, partition)).longValue();
+                File fs = new File(partition);
+                ReflectWrapper w = new ReflectWrapper(fs);
+                long free = ((Long)w.invoke("getFreeSpace")).longValue();
                 return free >= StringUtils.parseHumanSizes(needed);
             } else {
                 throw new BuildException("HasFreeSpace condition not supported on Java5 or
less.");



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message