@Test public void testMissingFile() { tried.expect(BuildException.class); tried.expectMessage("file not set"); Find find = new Find(); find.execute(); }
public void execute() { validate(); for (Path path : paths) { for (String includedFile : path.list()) { String filename = includedFile.replace('\\', '/'); filename = filename.substring(filename.lastIndexOf("/") + 1); if (file.equals(filename) && !foundFiles.contains(includedFile)) { foundFiles.add(includedFile); } } } String rv = null; if (!foundFiles.isEmpty()) { if (delimiter == null) { rv = foundFiles.get(0); } else { StringBuilder list = new StringBuilder(); for (String file : foundFiles) { if (list.length() > 0) { list.append(delimiter); } list.append(file); } rv = list.toString(); } } if (rv != null) getProject().setNewProperty(location, rv); }
Find extends Task { public void execute() { validate(); for (Path path : paths) { for (String includedFile : path.list()) { String filename = includedFile.replace('\\', '/'); filename = filename.substring(filename.lastIndexOf("/") + 1); if (file.equals(filename) && !foundFiles.contains(includedFile)) { foundFiles.add(includedFile); } } } String rv = null; if (!foundFiles.isEmpty()) { if (delimiter == null) { rv = foundFiles.get(0); } else { StringBuilder list = new StringBuilder(); for (String file : foundFiles) { if (list.length() > 0) { list.append(delimiter); } list.append(file); } rv = list.toString(); } } if (rv != null) getProject().setNewProperty(location, rv); } }
Find extends Task { public void execute() { validate(); for (Path path : paths) { for (String includedFile : path.list()) { String filename = includedFile.replace('\\', '/'); filename = filename.substring(filename.lastIndexOf("/") + 1); if (file.equals(filename) && !foundFiles.contains(includedFile)) { foundFiles.add(includedFile); } } } String rv = null; if (!foundFiles.isEmpty()) { if (delimiter == null) { rv = foundFiles.get(0); } else { StringBuilder list = new StringBuilder(); for (String file : foundFiles) { if (list.length() > 0) { list.append(delimiter); } list.append(file); } rv = list.toString(); } } if (rv != null) getProject().setNewProperty(location, rv); }  }
Find extends Task { public void execute() { validate(); for (Path path : paths) { for (String includedFile : path.list()) { String filename = includedFile.replace('\\', '/'); filename = filename.substring(filename.lastIndexOf("/") + 1); if (file.equals(filename) && !foundFiles.contains(includedFile)) { foundFiles.add(includedFile); } } } String rv = null; if (!foundFiles.isEmpty()) { if (delimiter == null) { rv = foundFiles.get(0); } else { StringBuilder list = new StringBuilder(); for (String file : foundFiles) { if (list.length() > 0) { list.append(delimiter); } list.append(file); } rv = list.toString(); } } if (rv != null) getProject().setNewProperty(location, rv); }  void setFile(String file); void setLocation(String location); void addPath(Path path); void setDelimiter(String delim); void execute(); }
Find extends Task { public void execute() { validate(); for (Path path : paths) { for (String includedFile : path.list()) { String filename = includedFile.replace('\\', '/'); filename = filename.substring(filename.lastIndexOf("/") + 1); if (file.equals(filename) && !foundFiles.contains(includedFile)) { foundFiles.add(includedFile); } } } String rv = null; if (!foundFiles.isEmpty()) { if (delimiter == null) { rv = foundFiles.get(0); } else { StringBuilder list = new StringBuilder(); for (String file : foundFiles) { if (list.length() > 0) { list.append(delimiter); } list.append(file); } rv = list.toString(); } } if (rv != null) getProject().setNewProperty(location, rv); }  void setFile(String file); void setLocation(String location); void addPath(Path path); void setDelimiter(String delim); void execute();  }