public void execute() throws BuildException {

    if (_licenseFileName == null) {
      log.error("License file not specified");
      throw new BuildException("License file not specified");
    }
    File f = new File(_licenseFileName);
    if (!f.exists()) {
      log.error("License file doesn't exist");
      throw new BuildException("License file doesn't exist");
    }
    try {
      StringBuffer sb = new StringBuffer();
      BufferedReader br = new BufferedReader(new FileReader(f));
      String line = null;
      while ((line = br.readLine()) != null) {
        sb.append(line);
        sb.append("\n");
      }
      _updater.setText(sb.toString());
    } catch (Exception ex) {
      log.error("Error getting license text: " + ex.getMessage());
      throw new BuildException("Error getting license text: " + ex.getMessage(), ex);
    }

    try {
      _updater.validate();
    } catch (Exception ex) {
      log.error("Task not configured correctly: " + ex.getMessage());
      throw new BuildException("Task not configured correctly: " + ex.getMessage(), ex);
    }
    if (_fileSets.size() == 0) {
      log.error("A nested fileset element is required");
      throw new BuildException("A nested fileset element is required");
    }
    for (Iterator i = _fileSets.iterator(); i.hasNext(); ) {
      FileSet fileSet = (FileSet) i.next();
      DirectoryScanner ds = null;
      if (_outputDirName == null) {
        ds = fileSet.getDirectoryScanner(project);
      } else {
        File outputDir = new File(_outputDirName);
        if (!outputDir.exists()) {
          outputDir.mkdirs();
        }

        Copy copy = new Copy();
        copy.setProject(project);
        copy.addFileset(fileSet);
        copy.setTodir(outputDir);
        copy.setVerbose(false);
        copy.init();
        copy.execute();
        fileSet.setDir(outputDir);
        ds = fileSet.getDirectoryScanner(project);
      }
      String[] fileNames = ds.getIncludedFiles();
      String path = ds.getBasedir().getAbsolutePath();
      for (int j = 0; j < fileNames.length; j++) {
        _updater.getFiles().add(new File(path + "/" + fileNames[j]));
      }
    }

    try {
      _updater.run();
    } catch (Exception ex) {
      log.error("Error executing license updater: " + ex.getMessage());
      ex.printStackTrace();
      throw new BuildException("Error executing license updater: " + ex.getMessage(), ex);
    }
  }
 public void setEndPattern(String p_endPattern) {
   _updater.setEndPattern(p_endPattern);
 }
 public void setLogFile(String p_logFileName) {
   _updater.setLogFileName(p_logFileName);
 }
 public void setBeginPattern(String p_beginPattern) {
   _updater.setBeginPattern(p_beginPattern);
 }