use of org.apache.tools.ant.BuildException in project processdash by dtuma.
the class SVGToImage method execute.
public void execute() {
if (verbose)
log("Building SVG images");
for (Iterator it = filesets.iterator(); it.hasNext(); ) {
FileSet fs = (FileSet) it.next();
FileScanner scanner = fs.getDirectoryScanner(getProject());
String[] files = scanner.getIncludedFiles();
try {
File basedir = scanner.getBasedir();
if (verbose)
log("Scanning " + basedir);
for (int i = 0; i < files.length; i++) {
translate(basedir, files[i]);
}
} catch (Exception e) {
throw new BuildException(e);
}
}
}
use of org.apache.tools.ant.BuildException in project processdash by dtuma.
the class AddTranslations method getExternalFileLocations.
private Map<String, String> getExternalFileLocations() {
Map<String, String> result = new HashMap();
if (externalDirs == null)
return result;
for (String oneDirName : externalDirs.split(",")) {
oneDirName = oneDirName.trim();
File oneDir = calcPossiblyRelativeFile(oneDirName);
try {
oneDir = oneDir.getCanonicalFile();
} catch (IOException e) {
throw new BuildException(e);
}
oneDir = new File(oneDir, "Templates/resources");
if (!oneDir.isDirectory()) {
System.out.println("Directory '" + oneDir + "' does not exist - skipping.");
continue;
}
for (String oneFile : oneDir.list()) {
if (oneFile.endsWith(".properties") && oneFile.indexOf('_') == -1) {
String baseName = oneFile.substring(0, oneFile.length() - 11);
result.put(baseName, oneDir.getPath() + File.separatorChar);
}
}
}
return result;
}
use of org.apache.tools.ant.BuildException in project processdash by dtuma.
the class CVSZip method execute.
public void execute() throws BuildException {
validate();
try {
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(destFile));
writeFiles(out);
out.close();
} catch (IOException ioe) {
throw new BuildException("could not write to \"" + destFile + "\"");
}
}
use of org.apache.tools.ant.BuildException in project processdash by dtuma.
the class MaybeSign method propagateProperty.
protected void propagateProperty(String propName) {
String fullPropName = prefix + "." + propName;
String propValue = getProject().getProperty(fullPropName);
if (!hasValue(propValue))
return;
try {
String setterMethodName = "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1);
Method m = getClass().getMethod(setterMethodName, String.class);
m.invoke(this, propValue);
} catch (Exception e) {
throw new BuildException("Unexpected internal error", e);
}
}
use of org.apache.tools.ant.BuildException in project processdash by dtuma.
the class MergeJars method validate.
private void validate() throws BuildException {
if (outputFile == null)
throw new BuildException("dest must be specified.");
if (outputFile.exists() && !outputFile.canWrite())
throw new BuildException("cannot write to file '" + outputFile + "'.");
if (jarFiles.isEmpty())
throw new BuildException("no input jar files were specified.");
openedJarFiles = new LinkedList();
for (Iterator i = jarFiles.iterator(); i.hasNext(); ) {
File f = (File) i.next();
if (!f.exists())
throw new BuildException("input jarfile '" + f + "' does not exist.");
if (!f.canRead())
throw new BuildException("input jarfile '" + f + "' can not be read.");
try {
JarFile jf = new JarFile(f);
openedJarFiles.add(jf);
} catch (IOException ioe) {
throw new BuildException("the input file '" + f + "' does not appear to be a valid jarfile.");
}
}
if (openedJarFiles.size() < 2)
mergeManifests = false;
}
Aggregations