Browse Source

Remove direct call to deprecated project, location, tasktype Task field,

replaced by an accessor way into tasks.
Remove too some unused variable declaration and some unused imports.
PR: 22515
Submitted by: Emmanuel Feller ( Emmanuel dot Feller at free dot fr)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275133 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
3396e7c321
23 changed files with 63 additions and 119 deletions
  1. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Antlib.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/BuildNumber.java
  3. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/Classloader.java
  4. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  5. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Definer.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  7. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  8. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  9. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
  10. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  11. +16
    -43
      src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
  12. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
  13. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  14. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  15. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  16. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
  17. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
  18. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java
  19. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
  20. +10
    -33
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
  21. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
  22. +0
    -1
      src/main/org/apache/tools/ant/util/FileUtils.java
  23. +1
    -1
      src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java

+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/Antlib.java View File

@@ -123,7 +123,6 @@ public class Antlib extends Task implements TaskContainer {
// Instance // Instance
// //
private ClassLoader classLoader; private ClassLoader classLoader;
private String prefix;
private String uri = ""; private String uri = "";
private List tasks = new ArrayList(); private List tasks = new ArrayList();




+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/BuildNumber.java View File

@@ -126,7 +126,7 @@ public class BuildNumber


final String header = "Build Number for ANT. Do not edit!"; final String header = "Build Number for ANT. Do not edit!";


properties.save(output, header);
properties.store(output, header);
} catch (final IOException ioe) { } catch (final IOException ioe) {
final String message = "Error while writing " + myFile; final String message = "Error while writing " + myFile;




+ 8
- 8
src/main/org/apache/tools/ant/taskdefs/Classloader.java View File

@@ -153,7 +153,7 @@ public class Classloader extends Task {
* the path will be added to the loader. * the path will be added to the loader.
*/ */
public void setClasspathRef(Reference pathRef) throws BuildException { public void setClasspathRef(Reference pathRef) throws BuildException {
classpath = (Path) pathRef.getReferencedObject(project);
classpath = (Path) pathRef.getReferencedObject(getProject());
} }


/** /**
@@ -180,7 +180,7 @@ public class Classloader extends Task {
public void execute() { public void execute() {
try { try {
// Gump friendly - don't mess with the core loader if only classpath // Gump friendly - don't mess with the core loader if only classpath
if ("only".equals(project.getProperty("build.sysclasspath"))
if ("only".equals(getProject().getProperty("build.sysclasspath"))
&& (name == null || SYSTEM_LOADER_REF.equals(name))) { && (name == null || SYSTEM_LOADER_REF.equals(name))) {
log("Changing the system loader is disabled " log("Changing the system loader is disabled "
+ "by build.sysclasspath=only", Project.MSG_WARN); + "by build.sysclasspath=only", Project.MSG_WARN);
@@ -189,7 +189,7 @@ public class Classloader extends Task {


String loaderName = (name == null) ? SYSTEM_LOADER_REF : name; String loaderName = (name == null) ? SYSTEM_LOADER_REF : name;


Object obj = project.getReference(loaderName);
Object obj = getProject().getReference(loaderName);
if (reset) { if (reset) {
// Are any other references held ? Can we 'close' the loader // Are any other references held ? Can we 'close' the loader
// so it removes the locks on jars ? // so it removes the locks on jars ?
@@ -209,7 +209,7 @@ public class Classloader extends Task {
// Construct a new class loader // Construct a new class loader
Object parent = null; Object parent = null;
if (parentName != null) { if (parentName != null) {
parent = project.getReference(parentName);
parent = getProject().getReference(parentName);
if (!(parent instanceof ClassLoader)) { if (!(parent instanceof ClassLoader)) {
parent = null; parent = null;
} }
@@ -223,20 +223,20 @@ public class Classloader extends Task {
// The core loader must be reverse // The core loader must be reverse
//reverse=true; //reverse=true;
} }
project.log("Setting parent loader " + name + " "
getProject().log("Setting parent loader " + name + " "
+ parent + " " + parentFirst, Project.MSG_DEBUG); + parent + " " + parentFirst, Project.MSG_DEBUG);


// The param is "parentFirst" // The param is "parentFirst"
acl = new AntClassLoader((ClassLoader) parent, acl = new AntClassLoader((ClassLoader) parent,
project, classpath, parentFirst);
getProject(), classpath, parentFirst);


project.addReference(loaderName, acl);
getProject().addReference(loaderName, acl);


if (name == null) { if (name == null) {
// This allows the core loader to load optional tasks // This allows the core loader to load optional tasks
// without delegating // without delegating
acl.addLoaderPackageRoot("org.apache.tools.ant.taskdefs.optional"); acl.addLoaderPackageRoot("org.apache.tools.ant.taskdefs.optional");
project.setCoreLoader(acl);
getProject().setCoreLoader(acl);
} }
} }
if (classpath != null) { if (classpath != null) {


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -780,7 +780,6 @@ public class Concat extends Task {
throws IOException { throws IOException {


int amountRead = 0; int amountRead = 0;
int iOff = off;
while (pos < sourceFiles.size() || (needAddSeparator)) { while (pos < sourceFiles.size() || (needAddSeparator)) {
if (needAddSeparator) { if (needAddSeparator) {
cbuf[off] = eolString.charAt(lastPos++); cbuf[off] = eolString.charAt(lastPos++);


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/Definer.java View File

@@ -89,7 +89,6 @@ public abstract class Definer extends DefBase {


private int format = Format.PROPERTIES; private int format = Format.PROPERTIES;
private boolean definerSet = false; private boolean definerSet = false;
private ClassLoader internalClassLoader;
private int onError = OnError.FAIL; private int onError = OnError.FAIL;
private String adapter; private String adapter;
private String adaptTo; private String adaptTo;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -677,7 +677,7 @@ public class Execute {
throws IOException { throws IOException {
HashMap logicals = new HashMap(); HashMap logicals = new HashMap();
String logName = null, logValue = null, newLogName; String logName = null, logValue = null, newLogName;
String line, lineSep = System.getProperty("line.separator");
String line = null;
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
// parse the VMS logicals into required format ("VAR=VAL[,VAL2]") // parse the VMS logicals into required format ("VAR=VAL[,VAL2]")
if (line.startsWith("\t=")) { if (line.startsWith("\t=")) {


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -437,9 +437,8 @@ public class FixCRLF extends MatchingTask {
} // end of try-catch } // end of try-catch


} else { // (tabs != ASIS) } else { // (tabs != ASIS)
int ptr;

while ((ptr = line.getNext()) < linelen) {
while (line.getNext() < linelen) {


switch (lines.getState()) { switch (lines.getState()) {




+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/MacroDef.java View File

@@ -79,7 +79,6 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
public class MacroDef extends Task implements AntlibInterface, TaskContainer { public class MacroDef extends Task implements AntlibInterface, TaskContainer {
private UnknownElement nestedTask; private UnknownElement nestedTask;
private String name; private String name;
private String componentName;
private List attributes = new ArrayList(); private List attributes = new ArrayList();
private Map elements = new HashMap(); private Map elements = new HashMap();
private String uri; private String uri;


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/PreSetDef.java View File

@@ -80,7 +80,6 @@ import org.apache.tools.ant.UnknownElement;
public class PreSetDef extends Task implements AntlibInterface, TaskContainer { public class PreSetDef extends Task implements AntlibInterface, TaskContainer {
private UnknownElement nestedTask; private UnknownElement nestedTask;
private String name; private String name;
private String componentName;
private String uri; private String uri;


/** /**


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -358,19 +358,19 @@ public class SQLExec extends JDBCTask {
if (transactions.size() == 0) { if (transactions.size() == 0) {
throw new BuildException("Source file or fileset, " throw new BuildException("Source file or fileset, "
+ "transactions or sql statement " + "transactions or sql statement "
+ "must be set!", location);
+ "must be set!", getLocation());
} }
} }


if (srcFile != null && !srcFile.exists()) { if (srcFile != null && !srcFile.exists()) {
throw new BuildException("Source file does not exist!", location);
throw new BuildException("Source file does not exist!", getLocation());
} }


// deal with the filesets // deal with the filesets
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File srcDir = fs.getDir(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File srcDir = fs.getDir(getProject());


String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();


@@ -428,7 +428,7 @@ public class SQLExec extends JDBCTask {
// ignore // ignore
} }
} }
throw new BuildException(e, location);
throw new BuildException(e, getLocation());
} catch (SQLException e) { } catch (SQLException e) {
if (!isAutocommit() && conn != null && onError.equals("abort")) { if (!isAutocommit() && conn != null && onError.equals("abort")) {
try { try {
@@ -437,7 +437,7 @@ public class SQLExec extends JDBCTask {
// ignore // ignore
} }
} }
throw new BuildException(e, location);
throw new BuildException(e, getLocation());
} finally { } finally {
try { try {
if (statement != null) { if (statement != null) {
@@ -473,7 +473,7 @@ public class SQLExec extends JDBCTask {
if (!keepformat) { if (!keepformat) {
line = line.trim(); line = line.trim();
} }
line = project.replaceProperties(line);
line = getProject().replaceProperties(line);
if (!keepformat) { if (!keepformat) {
if (line.startsWith("//")) { if (line.startsWith("//")) {
continue; continue;


+ 16
- 43
src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java View File

@@ -418,59 +418,32 @@ public class EchoProperties extends Task {
/** /**
* JDK 1.2 allows for the safer method * JDK 1.2 allows for the safer method
* <tt>Properties.store(OutputStream, String)</tt>, which throws an * <tt>Properties.store(OutputStream, String)</tt>, which throws an
* <tt>IOException</tt> on an output error. This method attempts to
* use the JDK 1.2 method first, and if that does not exist, then the
* JDK 1.0 compatible method
* <tt>Properties.save(OutputStream, String)</tt> is used instead.
* <tt>IOException</tt> on an output error.
* *
*@param props the properties to record *@param props the properties to record
*@param os record the properties to this output stream *@param os record the properties to this output stream
*@param header prepend this header to the property output *@param header prepend this header to the property output
*@exception IOException on an I/O error during a write. Only thrown
* for JDK 1.2+.
*@exception IOException on an I/O error during a write.
*/ */
protected void jdkSaveProperties(Properties props, OutputStream os, protected void jdkSaveProperties(Properties props, OutputStream os,
String header) throws IOException { String header) throws IOException {
try {
java.lang.reflect.Method m = props.getClass().getMethod(
"store", new Class[]{OutputStream.class, String.class});
m.invoke(props, new Object[]{os, header});
} catch (java.lang.reflect.InvocationTargetException ite) {
Throwable t = ite.getTargetException();
if (t instanceof IOException) {
throw (IOException) t;
}
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
}

// not an expected exception. Resort to JDK 1.0 to execute
// this method
jdk10SaveProperties(props, os, header);
} catch (ThreadDeath td) {
// don't trap thread death errors.
throw td;
} catch (Throwable ex) {
// this 'store' method is not available, so resort to the JDK 1.0
// compatible method.
jdk10SaveProperties(props, os, header);
}
try {
props.store(os, header);

} catch (IOException ioe) {
throw new BuildException(ioe, getLocation());
} finally {
if (os != null) {
try {
os.close();
} catch (IOException ioex) {
log("Failed to close output stream");
}
}
}
} }




/**
* Save the properties to the output stream using the JDK 1.0 compatible
* method. This won't throw an <tt>IOException</tt> on an output error.
*
*@param props the properties to record
*@param os record the properties to this output stream
*@param header prepend this header to the property output
*/
protected void jdk10SaveProperties(Properties props, OutputStream os,
String header) {
props.save(os, header);
}

/** /**
* Uses the DocumentBuilderFactory to get a DocumentBuilder instance. * Uses the DocumentBuilderFactory to get a DocumentBuilder instance.
* *


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java View File

@@ -172,10 +172,10 @@ public class CCMCheck extends Continuus {
int sizeofFileSet = filesets.size(); int sizeofFileSet = filesets.size();
for (int i = 0; i < sizeofFileSet; i++) { for (int i = 0; i < sizeofFileSet; i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();
for (int j = 0; j < srcFiles.length; j++) { for (int j = 0; j < srcFiles.length; j++) {
File src = new File(fs.getDir(project), srcFiles[j]);
File src = new File(fs.getDir(getProject()), srcFiles[j]);
setFile(src); setFile(src);
doit(); doit();
} }


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -103,7 +103,7 @@ public abstract class Continuus extends Task {
* @param dir the directory containing the ccm executable * @param dir the directory containing the ccm executable
*/ */
public final void setCcmDir(String dir) { public final void setCcmDir(String dir) {
ccmDir = getProject().translatePath(dir);
ccmDir = Project.translatePath(dir);
} }


/** /**


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java View File

@@ -67,7 +67,6 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.filters.TokenFilter;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;


+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -340,10 +340,12 @@ public class JJTree extends Task {
return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/'); return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/');
} }


/*
* Not used anymore
private boolean isAbsolute(String fileName) { private boolean isAbsolute(String fileName) {
return (fileName.startsWith("/") || (new File(fileName).isAbsolute())); return (fileName.startsWith("/") || (new File(fileName).isAbsolute()));
} }
*/
/** /**
* When running JJTree from an Ant taskdesk the -OUTPUT_DIRECTORY must * When running JJTree from an Ant taskdesk the -OUTPUT_DIRECTORY must
* always be set. But when -OUTPUT_DIRECTORY is set, -OUTPUT_FILE is * always be set. But when -OUTPUT_DIRECTORY is set, -OUTPUT_FILE is


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -237,7 +237,7 @@ public class SplashTask extends Task {
splash.toFront(); splash.toFront();
getProject().addBuildListener(splash); getProject().addBuildListener(splash);
try { try {
Thread.currentThread().sleep(showDuration);
Thread.sleep(showDuration);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java View File

@@ -107,7 +107,7 @@ public abstract class AbstractAccessTask
* @param cmdl A user supplied command line that we won't accept. * @param cmdl A user supplied command line that we won't accept.
*/ */
public void setCommand(Commandline cmdl) { public void setCommand(Commandline cmdl) {
throw new BuildException(taskType
throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute", + " doesn\'t support the command attribute",
getLocation()); getLocation());
} }
@@ -119,7 +119,7 @@ public abstract class AbstractAccessTask
* @param skip A user supplied boolean we won't accept. * @param skip A user supplied boolean we won't accept.
*/ */
public void setSkipEmptyFilesets(boolean skip) { public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(taskType + " doesn\'t support the "
throw new BuildException(getTaskType() + " doesn\'t support the "
+ "skipemptyfileset attribute", + "skipemptyfileset attribute",
getLocation()); getLocation());
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java View File

@@ -116,7 +116,7 @@ public class Chgrp extends AbstractAccessTask {
* @param e User supplied executable that we won't accept. * @param e User supplied executable that we won't accept.
*/ */
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(taskType
throw new BuildException(getTaskType()
+ " doesn\'t support the executable" + " doesn\'t support the executable"
+ " attribute", getLocation()); + " attribute", getLocation());
} }


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -116,7 +116,7 @@ public class Chown extends AbstractAccessTask {
* @param e User supplied executable that we won't accept. * @param e User supplied executable that we won't accept.
*/ */
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(taskType
throw new BuildException(getTaskType()
+ " doesn\'t support the executable" + " doesn\'t support the executable"
+ " attribute", getLocation()); + " attribute", getLocation());
} }


+ 10
- 33
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -67,10 +67,8 @@ package org.apache.tools.ant.taskdefs.optional.unix;


import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;


import java.util.Vector; import java.util.Vector;
@@ -78,9 +76,6 @@ import java.util.Properties;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;


import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
@@ -457,13 +452,10 @@ public class Symlink extends Task {
/** /**
* Writes a properties file. * Writes a properties file.
* *
* In jdk 1.2+ this method will use <code>Properties.store</code>
* This method use <code>Properties.store</code>
* and thus report exceptions that occur while writing the file. * and thus report exceptions that occur while writing the file.
* In jdk 1.1 we are forced to use <code>Properties.save</code>
* and therefore all exceptions are masked. This method was lifted
* directly from the Proertyfile task with only slight editing.
* sticking something like this in FileUtils might be
* a good idea to avoid duplication.
*
* This is not jdk 1.1 compatible, but ant 1.6 is not anymore.
* *
* @param properties The properties object to be written. * @param properties The properties object to be written.
* @param propertyfile The File to write to. * @param propertyfile The File to write to.
@@ -475,32 +467,17 @@ public class Symlink extends Task {
String comment) String comment)
throws BuildException { throws BuildException {


BufferedOutputStream bos = null;
FileOutputStream fos = null;
try { try {
bos = new BufferedOutputStream(new FileOutputStream(propertyfile));

// Properties.store is not available in JDK 1.1
Method m =
Properties.class.getMethod("store",
new Class[] {
OutputStream.class,
String.class});
m.invoke(properties, new Object[] {bos, comment});

} catch (NoSuchMethodException nsme) {
properties.save(bos, comment);
} catch (InvocationTargetException ite) {
Throwable t = ite.getTargetException();
throw new BuildException(t, location);
} catch (IllegalAccessException iae) {
// impossible
throw new BuildException(iae, location);
fos = new FileOutputStream(propertyfile);
properties.store(fos, comment);

} catch (IOException ioe) { } catch (IOException ioe) {
throw new BuildException(ioe, location);
throw new BuildException(ioe, getLocation());
} finally { } finally {
if (bos != null) {
if (fos != null) {
try { try {
bos.close();
fos.close();
} catch (IOException ioex) { } catch (IOException ioex) {
log("Failed to close output stream"); log("Failed to close output stream");
} }


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java View File

@@ -124,7 +124,7 @@ public class Attrib extends ExecuteOn {
* @ant.attribute ignore="true" * @ant.attribute ignore="true"
*/ */
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(taskType
throw new BuildException(getTaskType()
+ " doesn\'t support the executable attribute", getLocation()); + " doesn\'t support the executable attribute", getLocation());
} }


@@ -132,7 +132,7 @@ public class Attrib extends ExecuteOn {
* @ant.attribute ignore="true" * @ant.attribute ignore="true"
*/ */
public void setCommand(String e) { public void setCommand(String e) {
throw new BuildException(taskType
throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute", getLocation()); + " doesn\'t support the command attribute", getLocation());
} }


@@ -148,7 +148,7 @@ public class Attrib extends ExecuteOn {
* @ant.attribute ignore="true" * @ant.attribute ignore="true"
*/ */
public void setSkipEmptyFilesets(boolean skip) { public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(taskType + " doesn\'t support the "
throw new BuildException(getTaskType() + " doesn\'t support the "
+ "skipemptyfileset attribute", + "skipemptyfileset attribute",
getLocation()); getLocation());
} }


+ 0
- 1
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -80,7 +80,6 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.filters.util.ChainReaderHelper; import org.apache.tools.ant.filters.util.ChainReaderHelper;
import org.apache.tools.ant.filters.TokenFilter;
import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.FilterSetCollection; import org.apache.tools.ant.types.FilterSetCollection;
import org.apache.tools.ant.launch.Locator; import org.apache.tools.ant.launch.Locator;


+ 1
- 1
src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java View File

@@ -136,7 +136,7 @@ public class RegexpMatcherFactory {


protected void testAvailability(String className) throws BuildException { protected void testAvailability(String className) throws BuildException {
try { try {
Class implClass = Class.forName(className);
Class.forName(className);
} catch (Throwable t) { } catch (Throwable t) {
throw new BuildException(t); throw new BuildException(t);
} }


Loading…
Cancel
Save