You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/12/16 13:17:01 UTC
svn commit: r487797 -
/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java
Author: peterreilly
Date: Sat Dec 16 04:17:00 2006
New Revision: 487797
URL: http://svn.apache.org/viewvc?view=rev&rev=487797
Log:
checkstyle
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=487797&r1=487796&r2=487797
==============================================================================
--- 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 Sat Dec 16 04:17:00 2006
@@ -27,7 +27,7 @@
/**
* <hasfreespace>
- * <p>Condition returns true if selected partition
+ * <p>Condition returns true if selected partition
* has the requested space, false otherwise.</p>
* @since Ant 1.7
*/
@@ -36,6 +36,11 @@
private String partition;
private String needed;
+ /**
+ * Evaluate the condition.
+ * @return true if there enough free space.
+ * @throws BuildException if there is a problem.
+ */
public boolean eval() throws BuildException {
validate();
try {
@@ -43,7 +48,7 @@
//reflection to avoid bootstrap/build problems
File fs = new File(partition);
ReflectWrapper w = new ReflectWrapper(fs);
- long free = ((Long)w.invoke("getFreeSpace")).longValue();
+ long free = ((Long) w.invoke("getFreeSpace")).longValue();
return free >= StringUtils.parseHumanSizes(needed);
} else {
throw new BuildException("HasFreeSpace condition not supported on Java5 or less.");
@@ -54,22 +59,26 @@
}
private void validate() throws BuildException {
- if(null == partition) {
+ if (null == partition) {
throw new BuildException("Please set the partition attribute.");
}
- if(null == needed) {
+ if (null == needed) {
throw new BuildException("Please set the needed attribute.");
}
}
-
+
/**
* The partition/device to check
- * @return
+ * @return the partition.
*/
public String getPartition() {
return partition;
}
+ /**
+ * Set the partition name.
+ * @param partition the name to use.
+ */
public void setPartition(String partition) {
this.partition = partition;
}
@@ -82,7 +91,11 @@
return needed;
}
+ /**
+ * Set the amount of space required.
+ * @param needed the amount required.
+ */
public void setNeeded(String needed) {
this.needed = needed;
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org