}
String[] list = src.list();
for (int i = 0; i < list.length; i++) {
File srcDir = getProject().resolveFile(list[i]);
if (!srcDir.exists()) {
throw new BuildException(
"srcdir \"" + srcDir.getPath() + "\" does not exist!",
getLocation());
}
DirectoryScanner ds = this.getDirectoryScanner(srcDir);
String[] files = ds.getIncludedFiles();
int j;
for (j = 0; j < files.length; j++) {
String one = files[j];
File source = new File(srcDir, one);
File destination = new File(getDestDir(), one);
if (!destination.getParentFile().exists()) {
log("Making dir: "+destination.getParentFile(), Project.MSG_VERBOSE);
destination.getParentFile().mkdirs();
}
if (source.lastModified() <= destination.lastModified()) {
log(source+" omitted as "+destination+" is up to date", Project.MSG_VERBOSE);
continue;
}
if (one.endsWith(".class")) {
try {
log("source: "+source + " to "+destination, Project.MSG_VERBOSE);
JustLog.speedup(source, destination);
log("Payload: " + 100*(destination.length()-source.length())/source.length()+ "%");
} catch (ClassFormatException e) {
throw new BuildException(one + " is not a class file", e);
} catch (IOException e) {
throw new BuildException(one + " has an IO problem", e);
}
}
if (one.endsWith(".jar")
|| one.endsWith(".ear")
|| one.endsWith(".zip")
|| one.endsWith(".war")) {
try {
JustLog.speedupZip(new FileInputStream(source), new FileOutputStream(destination));
} catch (FileNotFoundException e) {
throw new BuildException(one + " is not found", e);
} catch (IOException e) {
StackTraceElement[] st=e.getStackTrace();
StringBuffer sb= new StringBuffer();
for(int h=0; h<st.length; h++) {
sb.append(st[h].toString());
sb.append("\n");
}
throw new BuildException(one + " has an IO problem: "+sb.toString(), e);
}
}
}
}