@@ -34,6 +34,7 @@ import org.apache.tools.ant.types.ResourceCollection;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.resources.Resources;
import org.apache.tools.ant.types.resources.Resources;
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.PropertyOutputStream;
import org.apache.tools.ant.util.PropertyOutputStream;
/**
/**
@@ -184,13 +185,13 @@ public class Length extends Task implements Condition {
if (length == null) {
if (length == null) {
throw new BuildException(LENGTH_REQUIRED);
throw new BuildException(LENGTH_REQUIRED);
}
}
Long ell = null ;
Long ell;
if (STRING.equals(mode)) {
if (STRING.equals(mode)) {
ell = new Long(getLength(string, getTrim()));
ell = new Long(getLength(string, getTrim()));
} else {
ConditionHandler h = new Condition Handler();
} else {
AccumHandler h = new Accum Handler();
handleResources(h);
handleResources(h);
ell = new Long(h.getLength ());
ell = new Long(h.getAccum ());
}
}
return when.evaluate(ell.compareTo(length));
return when.evaluate(ell.compareTo(length));
}
}
@@ -273,7 +274,7 @@ public class Length extends Task implements Condition {
protected abstract void handle(Resource r);
protected abstract void handle(Resource r);
void complete() {
void complete() {
ps.close( );
FileUtils.close(ps );
}
}
}
}
@@ -294,9 +295,13 @@ public class Length extends Task implements Condition {
}
}
}
}
private class All Handler extends Handler {
private class Accum Handler extends Handler {
private long accum = 0L;
private long accum = 0L;
AllHandler(PrintStream ps) {
AccumHandler() {
super(null);
}
protected AccumHandler(PrintStream ps) {
super(ps);
super(ps);
}
}
protected long getAccum() {
protected long getAccum() {
@@ -310,20 +315,16 @@ public class Length extends Task implements Condition {
accum += size;
accum += size;
}
}
}
}
void complete() {
getPs().print(accum);
super.complete();
}
}
}
private class ConditionHandler extends All Handler {
ConditionHandler( ) {
super(null );
private class AllHandler extends AccumHandler {
AllHandler(PrintStream ps) {
super(ps );
}
}
void complete() {
void complete() {
}
long getLength() {
return getAccum();
getPs().print(getAccum());
super.complete();
}
}
}
}
}
}