From 37d7a6b6798a55e87f08273bb3b451939bb0dcb1 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 31 Jul 2009 20:04:31 +0000 Subject: [PATCH] provide access to encoding stuff in unzip, hide it in untar git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@799730 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Expand.java | 37 +++++++++++++++++++ .../org/apache/tools/ant/taskdefs/Untar.java | 13 ++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java index aa57176ae..8fe44dd4d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -439,12 +439,30 @@ public class Expand extends Task { * @since Ant 1.6 */ public void setEncoding(String encoding) { + internalSetEncoding(encoding); + } + + /** + * Supports grand-children that want to support the attribute + * where the child-class doesn't (i.e. Unzip in the compress + * Antlib). + * + * @since Ant 1.8.0 + */ + protected void internalSetEncoding(String encoding) { if (NATIVE_ENCODING.equals(encoding)) { encoding = null; } this.encoding = encoding; } + /** + * @since Ant 1.8.0 + */ + public String getEncoding() { + return encoding; + } + /** * Whether leading path separators should be stripped. * @@ -460,6 +478,25 @@ public class Expand extends Task { * @since Ant 1.8.0 */ public void setScanForUnicodeExtraFields(boolean b) { + internalSetScanForUnicodeExtraFields(b); + } + + /** + * Supports grand-children that want to support the attribute + * where the child-class doesn't (i.e. Unzip in the compress + * Antlib). + * + * @since Ant 1.8.0 + */ + protected void internalSetScanForUnicodeExtraFields(boolean b) { scanForUnicodeExtraFields = b; } + + /** + * @since Ant 1.8.0 + */ + public boolean getScanForUnicodeExtraFields() { + return scanForUnicodeExtraFields; + } + } diff --git a/src/main/org/apache/tools/ant/taskdefs/Untar.java b/src/main/org/apache/tools/ant/taskdefs/Untar.java index b07caf768..5e033f7fb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -42,7 +42,7 @@ import org.apache.tools.tar.TarInputStream; *

PatternSets are used to select files to extract * from the archive. If no patternset is used, all files are extracted. *

- *

FileSet>s may be used to select archived files + *

FileSets may be used to select archived files * to perform unarchival upon. *

*

File permissions will not be restored on extracted files.

@@ -86,6 +86,17 @@ public class Untar extends Expand { + " attribute", getLocation()); } + /** + * No unicode extra fields in tar. + * + * @since Ant 1.8.0 + */ + public void setScanForUnicodeExtraFields(boolean b) { + throw new BuildException("The " + getTaskName() + + " task doesn't support the encoding" + + " attribute", getLocation()); + } + /** * @see Expand#expandFile(FileUtils, File, File) */