You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by an...@apache.org on 2003/08/22 17:25:45 UTC
cvs commit: ant/src/main/org/apache/tools/ant/util/regexp RegexpMatcherFactory.java
antoine 2003/08/22 08:25:45
Modified: src/main/org/apache/tools/ant/taskdefs Antlib.java
BuildNumber.java Classloader.java Concat.java
Definer.java Execute.java FixCRLF.java
MacroDef.java PreSetDef.java SQLExec.java
src/main/org/apache/tools/ant/taskdefs/optional
EchoProperties.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm
CCMCheck.java Continuus.java
src/main/org/apache/tools/ant/taskdefs/optional/i18n
Translate.java
src/main/org/apache/tools/ant/taskdefs/optional/javacc
JJTree.java
src/main/org/apache/tools/ant/taskdefs/optional/splash
SplashTask.java
src/main/org/apache/tools/ant/taskdefs/optional/unix
AbstractAccessTask.java Chgrp.java Chown.java
Symlink.java
src/main/org/apache/tools/ant/taskdefs/optional/windows
Attrib.java
src/main/org/apache/tools/ant/util FileUtils.java
src/main/org/apache/tools/ant/util/regexp
RegexpMatcherFactory.java
Log:
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)
Revision Changes Path
1.7 +0 -1 ant/src/main/org/apache/tools/ant/taskdefs/Antlib.java
Index: Antlib.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Antlib.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Antlib.java 13 Aug 2003 13:18:54 -0000 1.6
+++ Antlib.java 22 Aug 2003 15:25:44 -0000 1.7
@@ -123,7 +123,6 @@
// Instance
//
private ClassLoader classLoader;
- private String prefix;
private String uri = "";
private List tasks = new ArrayList();
1.13 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java
Index: BuildNumber.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- BuildNumber.java 24 Jul 2003 14:07:51 -0000 1.12
+++ BuildNumber.java 22 Aug 2003 15:25:44 -0000 1.13
@@ -126,7 +126,7 @@
final String header = "Build Number for ANT. Do not edit!";
- properties.save(output, header);
+ properties.store(output, header);
} catch (final IOException ioe) {
final String message = "Error while writing " + myFile;
1.8 +8 -8 ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java
Index: Classloader.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Classloader.java 6 Jul 2003 09:03:17 -0000 1.7
+++ Classloader.java 22 Aug 2003 15:25:44 -0000 1.8
@@ -153,7 +153,7 @@
* the path will be added to the loader.
*/
public void setClasspathRef(Reference pathRef) throws BuildException {
- classpath = (Path) pathRef.getReferencedObject(project);
+ classpath = (Path) pathRef.getReferencedObject(getProject());
}
/**
@@ -180,7 +180,7 @@
public void execute() {
try {
// 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))) {
log("Changing the system loader is disabled "
+ "by build.sysclasspath=only", Project.MSG_WARN);
@@ -189,7 +189,7 @@
String loaderName = (name == null) ? SYSTEM_LOADER_REF : name;
- Object obj = project.getReference(loaderName);
+ Object obj = getProject().getReference(loaderName);
if (reset) {
// Are any other references held ? Can we 'close' the loader
// so it removes the locks on jars ?
@@ -209,7 +209,7 @@
// Construct a new class loader
Object parent = null;
if (parentName != null) {
- parent = project.getReference(parentName);
+ parent = getProject().getReference(parentName);
if (!(parent instanceof ClassLoader)) {
parent = null;
}
@@ -223,20 +223,20 @@
// The core loader must be reverse
//reverse=true;
}
- project.log("Setting parent loader " + name + " "
+ getProject().log("Setting parent loader " + name + " "
+ parent + " " + parentFirst, Project.MSG_DEBUG);
// The param is "parentFirst"
acl = new AntClassLoader((ClassLoader) parent,
- project, classpath, parentFirst);
+ getProject(), classpath, parentFirst);
- project.addReference(loaderName, acl);
+ getProject().addReference(loaderName, acl);
if (name == null) {
// This allows the core loader to load optional tasks
// without delegating
acl.addLoaderPackageRoot("org.apache.tools.ant.taskdefs.optional");
- project.setCoreLoader(acl);
+ getProject().setCoreLoader(acl);
}
}
if (classpath != null) {
1.27 +0 -1 ant/src/main/org/apache/tools/ant/taskdefs/Concat.java
Index: Concat.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Concat.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Concat.java 13 Aug 2003 14:46:15 -0000 1.26
+++ Concat.java 22 Aug 2003 15:25:44 -0000 1.27
@@ -780,7 +780,6 @@
throws IOException {
int amountRead = 0;
- int iOff = off;
while (pos < sourceFiles.size() || (needAddSeparator)) {
if (needAddSeparator) {
cbuf[off] = eolString.charAt(lastPos++);
1.42 +0 -1 ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
Index: Definer.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Definer.java 13 Aug 2003 13:18:54 -0000 1.41
+++ Definer.java 22 Aug 2003 15:25:44 -0000 1.42
@@ -89,7 +89,6 @@
private int format = Format.PROPERTIES;
private boolean definerSet = false;
- private ClassLoader internalClassLoader;
private int onError = OnError.FAIL;
private String adapter;
private String adaptTo;
1.64 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- Execute.java 1 Aug 2003 10:08:12 -0000 1.63
+++ Execute.java 22 Aug 2003 15:25:44 -0000 1.64
@@ -677,7 +677,7 @@
throws IOException {
HashMap logicals = new HashMap();
String logName = null, logValue = null, newLogName;
- String line, lineSep = System.getProperty("line.separator");
+ String line = null;
while ((line = in.readLine()) != null) {
// parse the VMS logicals into required format ("VAR=VAL[,VAL2]")
if (line.startsWith("\t=")) {
1.53 +3 -4 ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
Index: FixCRLF.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- FixCRLF.java 19 Jul 2003 11:20:12 -0000 1.52
+++ FixCRLF.java 22 Aug 2003 15:25:44 -0000 1.53
@@ -437,9 +437,8 @@
} // end of try-catch
} else { // (tabs != ASIS)
- int ptr;
-
- while ((ptr = line.getNext()) < linelen) {
+
+ while (line.getNext() < linelen) {
switch (lines.getState()) {
1.5 +0 -1 ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
Index: MacroDef.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MacroDef.java 15 Aug 2003 15:04:29 -0000 1.4
+++ MacroDef.java 22 Aug 2003 15:25:44 -0000 1.5
@@ -79,7 +79,6 @@
public class MacroDef extends Task implements AntlibInterface, TaskContainer {
private UnknownElement nestedTask;
private String name;
- private String componentName;
private List attributes = new ArrayList();
private Map elements = new HashMap();
private String uri;
1.6 +0 -1 ant/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
Index: PreSetDef.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PreSetDef.java 15 Aug 2003 15:04:29 -0000 1.5
+++ PreSetDef.java 22 Aug 2003 15:25:44 -0000 1.6
@@ -80,7 +80,6 @@
public class PreSetDef extends Task implements AntlibInterface, TaskContainer {
private UnknownElement nestedTask;
private String name;
- private String componentName;
private String uri;
/**
1.60 +7 -7 ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
Index: SQLExec.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- SQLExec.java 19 Jul 2003 08:10:59 -0000 1.59
+++ SQLExec.java 22 Aug 2003 15:25:44 -0000 1.60
@@ -358,19 +358,19 @@
if (transactions.size() == 0) {
throw new BuildException("Source file or fileset, "
+ "transactions or sql statement "
- + "must be set!", location);
+ + "must be set!", getLocation());
}
}
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
for (int i = 0; i < filesets.size(); 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();
@@ -428,7 +428,7 @@
// ignore
}
}
- throw new BuildException(e, location);
+ throw new BuildException(e, getLocation());
} catch (SQLException e) {
if (!isAutocommit() && conn != null && onError.equals("abort")) {
try {
@@ -437,7 +437,7 @@
// ignore
}
}
- throw new BuildException(e, location);
+ throw new BuildException(e, getLocation());
} finally {
try {
if (statement != null) {
@@ -473,7 +473,7 @@
if (!keepformat) {
line = line.trim();
}
- line = project.replaceProperties(line);
+ line = getProject().replaceProperties(line);
if (!keepformat) {
if (line.startsWith("//")) {
continue;
1.22 +15 -42 ant/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
Index: EchoProperties.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- EchoProperties.java 13 Aug 2003 15:02:28 -0000 1.21
+++ EchoProperties.java 22 Aug 2003 15:25:44 -0000 1.22
@@ -418,58 +418,31 @@
/**
* JDK 1.2 allows for the safer method
* <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 os record the properties to this output stream
*@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,
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;
- }
+ try {
+ props.store(os, header);
- // 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);
- }
+ } 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.
1.16 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
Index: CCMCheck.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- CCMCheck.java 1 Aug 2003 10:08:12 -0000 1.15
+++ CCMCheck.java 22 Aug 2003 15:25:44 -0000 1.16
@@ -172,10 +172,10 @@
int sizeofFileSet = filesets.size();
for (int i = 0; i < sizeofFileSet; i++) {
FileSet fs = (FileSet) filesets.elementAt(i);
- DirectoryScanner ds = fs.getDirectoryScanner(project);
+ DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] srcFiles = ds.getIncludedFiles();
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);
doit();
}
1.11 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
Index: Continuus.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Continuus.java 10 Feb 2003 14:13:46 -0000 1.10
+++ Continuus.java 22 Aug 2003 15:25:44 -0000 1.11
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -103,7 +103,7 @@
* @param dir the directory containing the ccm executable
*/
public final void setCcmDir(String dir) {
- ccmDir = getProject().translatePath(dir);
+ ccmDir = Project.translatePath(dir);
}
/**
1.31 +0 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
Index: Translate.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Translate.java 23 Jul 2003 11:32:13 -0000 1.30
+++ Translate.java 22 Aug 2003 15:25:44 -0000 1.31
@@ -67,7 +67,6 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
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.types.FileSet;
import org.apache.tools.ant.util.FileUtils;
1.27 +3 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
Index: JJTree.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- JJTree.java 14 Aug 2003 14:52:42 -0000 1.26
+++ JJTree.java 22 Aug 2003 15:25:44 -0000 1.27
@@ -340,10 +340,12 @@
return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/');
}
+ /*
+ * Not used anymore
private boolean isAbsolute(String fileName) {
return (fileName.startsWith("/") || (new File(fileName).isAbsolute()));
}
-
+*/
/**
* When running JJTree from an Ant taskdesk the -OUTPUT_DIRECTORY must
* always be set. But when -OUTPUT_DIRECTORY is set, -OUTPUT_FILE is
1.9 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
Index: SplashTask.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SplashTask.java 19 Jul 2003 11:20:21 -0000 1.8
+++ SplashTask.java 22 Aug 2003 15:25:44 -0000 1.9
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -237,7 +237,7 @@
splash.toFront();
getProject().addBuildListener(splash);
try {
- Thread.currentThread().sleep(showDuration);
+ Thread.sleep(showDuration);
} catch (InterruptedException e) {
}
1.9 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
Index: AbstractAccessTask.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbstractAccessTask.java 19 Jul 2003 08:11:07 -0000 1.8
+++ AbstractAccessTask.java 22 Aug 2003 15:25:45 -0000 1.9
@@ -107,7 +107,7 @@
* @param cmdl A user supplied command line that we won't accept.
*/
public void setCommand(Commandline cmdl) {
- throw new BuildException(taskType
+ throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute",
getLocation());
}
@@ -119,7 +119,7 @@
* @param skip A user supplied boolean we won't accept.
*/
public void setSkipEmptyFilesets(boolean skip) {
- throw new BuildException(taskType + " doesn\'t support the "
+ throw new BuildException(getTaskType() + " doesn\'t support the "
+ "skipemptyfileset attribute",
getLocation());
}
1.5 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java
Index: Chgrp.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Chgrp.java 5 Jul 2003 14:34:13 -0000 1.4
+++ Chgrp.java 22 Aug 2003 15:25:45 -0000 1.5
@@ -116,7 +116,7 @@
* @param e User supplied executable that we won't accept.
*/
public void setExecutable(String e) {
- throw new BuildException(taskType
+ throw new BuildException(getTaskType()
+ " doesn\'t support the executable"
+ " attribute", getLocation());
}
1.6 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
Index: Chown.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Chown.java 19 Jul 2003 08:11:07 -0000 1.5
+++ Chown.java 22 Aug 2003 15:25:45 -0000 1.6
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -116,7 +116,7 @@
* @param e User supplied executable that we won't accept.
*/
public void setExecutable(String e) {
- throw new BuildException(taskType
+ throw new BuildException(getTaskType()
+ " doesn\'t support the executable"
+ " attribute", getLocation());
}
1.12 +10 -33 ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
Index: Symlink.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Symlink.java 19 Jul 2003 08:11:07 -0000 1.11
+++ Symlink.java 22 Aug 2003 15:25:45 -0000 1.12
@@ -67,10 +67,8 @@
import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.util.Vector;
@@ -78,9 +76,6 @@
import java.util.Enumeration;
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.BuildException;
import org.apache.tools.ant.DirectoryScanner;
@@ -457,13 +452,10 @@
/**
* 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.
- * 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 propertyfile The File to write to.
@@ -475,32 +467,17 @@
String comment)
throws BuildException {
- BufferedOutputStream bos = null;
+ FileOutputStream fos = null;
try {
- bos = new BufferedOutputStream(new FileOutputStream(propertyfile));
+ fos = new FileOutputStream(propertyfile);
+ properties.store(fos, comment);
- // 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);
} catch (IOException ioe) {
- throw new BuildException(ioe, location);
+ throw new BuildException(ioe, getLocation());
} finally {
- if (bos != null) {
+ if (fos != null) {
try {
- bos.close();
+ fos.close();
} catch (IOException ioex) {
log("Failed to close output stream");
}
1.6 +3 -3 ant/src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
Index: Attrib.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Attrib.java 19 Jul 2003 08:11:07 -0000 1.5
+++ Attrib.java 22 Aug 2003 15:25:45 -0000 1.6
@@ -124,7 +124,7 @@
* @ant.attribute ignore="true"
*/
public void setExecutable(String e) {
- throw new BuildException(taskType
+ throw new BuildException(getTaskType()
+ " doesn\'t support the executable attribute", getLocation());
}
@@ -132,7 +132,7 @@
* @ant.attribute ignore="true"
*/
public void setCommand(String e) {
- throw new BuildException(taskType
+ throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute", getLocation());
}
@@ -148,7 +148,7 @@
* @ant.attribute ignore="true"
*/
public void setSkipEmptyFilesets(boolean skip) {
- throw new BuildException(taskType + " doesn\'t support the "
+ throw new BuildException(getTaskType() + " doesn\'t support the "
+ "skipemptyfileset attribute",
getLocation());
}
1.54 +1 -2 ant/src/main/org/apache/tools/ant/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- FileUtils.java 23 Jul 2003 11:32:13 -0000 1.53
+++ FileUtils.java 22 Aug 2003 15:25:45 -0000 1.54
@@ -80,7 +80,6 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
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.types.FilterSetCollection;
import org.apache.tools.ant.launch.Locator;
1.12 +1 -1 ant/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java
Index: RegexpMatcherFactory.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RegexpMatcherFactory.java 19 Jul 2003 08:11:10 -0000 1.11
+++ RegexpMatcherFactory.java 22 Aug 2003 15:25:45 -0000 1.12
@@ -136,7 +136,7 @@
protected void testAvailability(String className) throws BuildException {
try {
- Class implClass = Class.forName(className);
+ Class.forName(className);
} catch (Throwable t) {
throw new BuildException(t);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org