diff --git a/src/main/org/apache/tools/ant/taskdefs/Unpack.java b/src/main/org/apache/tools/ant/taskdefs/Unpack.java index fd29676be..6c8c65ef0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Unpack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Unpack.java @@ -58,11 +58,12 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.SrcFile; /** * Abstract Base class for unpack tasks. * - * @author Magesh Umasankar + * @author Magesh Umasankar */ public abstract class Unpack extends Task { @@ -72,14 +73,16 @@ public abstract class Unpack extends Task { /** * @deprecated setSrc(String) is deprecated and is replaced with - * setSrc(File) to make Ant's Introspection + * setSrc(SrcFile) to make Ant's Introspection * mechanism do the work and also to encapsulate operations on * the type in its own class. */ public void setSrc(String src) { log("DEPRECATED - The setSrc(String) method has been deprecated." - + " Use setSrc(File) instead."); - setSrc(project.resolveFile(src)); + + " Use setSrc(SrcFile) instead."); + SrcFile sf = new SrcFile(); + sf.setFile(project.resolveFile(src)); + setSrc(sf); } /** @@ -94,8 +97,8 @@ public abstract class Unpack extends Task { setDest(project.resolveFile(dest)); } - public void setSrc(File src) { - source = src; + public void setSrc(SrcFile srcFile) { + source = srcFile.getFile(); } public void setDest(File dest) { @@ -107,14 +110,6 @@ public abstract class Unpack extends Task { throw new BuildException("No Src specified", location); } - if (!source.exists()) { - throw new BuildException("Src doesn't exist", location); - } - - if (source.isDirectory()) { - throw new BuildException("Cannot expand a directory", location); - } - if (dest == null) { dest = new File(source.getParent()); }