if (newExtension == null) {
final String err = "Unknown renderer: "
+ this.task.getRendererType();
throw new BuildException(err);
}
final GlobPatternMapper mapper = new GlobPatternMapper();
mapper.setFrom("*.fo");
mapper.setTo("*" + newExtension);
// deal with the filesets
for (int i = 0; i < this.task.getFilesets().size(); i++) {
final FileSet fs = this.task.getFilesets().get(i);
final DirectoryScanner ds = fs.getDirectoryScanner(
this.task.getProject());
final String[] files = ds.getIncludedFiles();
for (int j = 0; j < files.length; j++) {
final File f = new File(fs.getDir(this.task.getProject()),
files[j]);
File outf = null;
if (this.task.getOutdir() != null && files[j].endsWith(".fo")) {
final String[] sa = mapper.mapFileName(files[j]);
outf = new File(this.task.getOutdir(), sa[0]);
} else {
outf = replaceExtension(f, ".fo", newExtension);
if (this.task.getOutdir() != null) {
outf = new File(this.task.getOutdir(), outf.getName());