- remove deprecated calls
- added constructor that sets up a private variable to hold the current
project instead of calling getProject everytime it's needed
Kev
Index:
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
===================================================================
---
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
(revision 344889)
+++
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
(working copy)
@@ -48,7 +48,6 @@
import org.apache.tools.tar.TarConstants;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarOutputStream;
-import org.apache.tools.zip.UnixStat;
/**
* Creates a tar archive.
@@ -58,7 +57,7 @@
* @ant.task category="packaging"
*/
public class Tar extends MatchingTask {
-
+
/**
* @deprecated Tar.WARN is deprecated and is replaced with
* Tar.TarLongFileMode.WARN
@@ -88,6 +87,13 @@
File tarFile;
File baseDir;
+ private Project project;
+
+ public Tar() {
+ project = this.getProject();
+ }
+
+
private TarLongFileMode longFileMode = new TarLongFileMode();
// need to keep the package private version for backwards compatibility
@@ -298,14 +304,7 @@
String msg = "Problem creating TAR: " + ioe.getMessage();
throw new BuildException(msg, ioe, getLocation());
} finally {
- if (tOut != null) {
- try {
- // close up
- tOut.close();
- } catch (IOException e) {
- // ignore
- }
- }
+ FileUtils.close(tOut);
}
} finally {
filesets = savedFileSets;
@@ -356,7 +355,7 @@
}
if (tarFileSet != null) {
- String fullpath = tarFileSet.getFullpath();
+ String fullpath = tarFileSet.getFullpath(project);
if (fullpath.length() > 0) {
vPath = fullpath;
} else {
@@ -365,7 +364,7 @@
return;
}
- String prefix = tarFileSet.getPrefix();
+ String prefix = tarFileSet.getPrefix(project);
// '/' is appended for compatibility with the zip task.
if (prefix.length() > 0 && !prefix.endsWith("/")) {
prefix = prefix + "/";
@@ -436,7 +435,7 @@
}
} else if (tarFileSet != null && tarFileSet.hasDirModeBeenSet()) {
// override permissions if set explicitly
- te.setMode(tarFileSet.getDirMode());
+ te.setMode(tarFileSet.getDirMode(project));
}
if (tarFileSet != null) {
@@ -627,7 +626,7 @@
afs = (ArchiveFileSet) rc;
}
if (afs != null && afs.size() > 1
- && afs.getFullpath().length() > 0) {
+ && afs.getFullpath(project).length() > 0) {
throw new BuildException("fullpath attribute may only "
+ "be specified for "
+ "filesets that specify a "
@@ -793,7 +792,7 @@
* @return the current mode.
*/
public int getMode() {
- return getFileMode();
+ return getFileMode(this.getProject());
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]