log("scanning "+ included[i],Project.MSG_VERBOSE); files.add(included[i]);
File parsefile = new File(scanner.getBasedir(),included[i]); log("scanning "+ parsefile,Project.MSG_VERBOSE); files.add(parsefile.toString());
    public void execute() throws BuildException {        List files=new LinkedList();        Iterator src=source.iterator();        while (src.hasNext()) {            FileSet set = (FileSet) src.next();            DirectoryScanner scanner = set.getDirectoryScanner(getProject());            String[] included=scanner.getIncludedFiles();            for(int i=0;i<included.length;i++) {                log("scanning "+ included[i],Project.MSG_VERBOSE);                files.add(included[i]);            }        }        //at this point the files are all scanned.        // Verify we have something interesting        if(files.isEmpty()) {            log("No source files");            return;        }        //now save them to a file.        File tempFile=FileUtils.newFileUtils().createTempFile("parse",".txt",null);        PrintWriter out=null;        int err;        try {            try {                out = new PrintWriter(new FileOutputStream(tempFile));                src=files.iterator();                while (src.hasNext()) {                    String s = (String) src.next();                    out.println(s);                }            } catch (IOException e) {                throw new BuildException("while saving to "+tempFile,e);            } finally {                if(out!=null) {                    try {                        out.close();                    } catch (Exception swallowed) {                    }                }            }            //now lets create the Java statement            String entryPoint = "org.smartfrog.SFParse";            Java java = createJavaTask(entryPoint, "sf-parse");            setupClasspath(java);            java.setFailonerror(true);            java.setFork(true);            //and add various options to it            java.createArg().setValue("-r");            if(quiet) {                java.createArg().setValue("-q");            }            if(verbose ) {                java.createArg().setValue("-v");            }            java.createArg().setValue("-f");            java.createArg().setFile(tempFile);            //run it            err = java.executeJava();        } finally {            tempFile.delete();        }        //process the results        switch(err) {            case 0:                //success                break;            case -1:                //parse fail                throw new BuildException("parse failure");            default:                //something else                throw new BuildException("Java application error code "+err);        }    }