Browse Source

setSrc(File) has been replaced with setSrc(SrcFile). No backwards

compatibilty issues here as setSrc(File) was introduced Post 1.4.1.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270378 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
0320691179
1 changed files with 9 additions and 14 deletions
  1. +9
    -14
      src/main/org/apache/tools/ant/taskdefs/Unpack.java

+ 9
- 14
src/main/org/apache/tools/ant/taskdefs/Unpack.java View File

@@ -58,11 +58,12 @@ package org.apache.tools.ant.taskdefs;
import java.io.File; import java.io.File;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.SrcFile;


/** /**
* Abstract Base class for unpack tasks. * Abstract Base class for unpack tasks.
* *
* @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
*/ */


public abstract class Unpack extends Task { 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 * @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 * mechanism do the work and also to encapsulate operations on
* the type in its own class. * the type in its own class.
*/ */
public void setSrc(String src) { public void setSrc(String src) {
log("DEPRECATED - The setSrc(String) method has been deprecated." 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)); setDest(project.resolveFile(dest));
} }


public void setSrc(File src) {
source = src;
public void setSrc(SrcFile srcFile) {
source = srcFile.getFile();
} }


public void setDest(File dest) { public void setDest(File dest) {
@@ -107,14 +110,6 @@ public abstract class Unpack extends Task {
throw new BuildException("No Src specified", location); 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) { if (dest == null) {
dest = new File(source.getParent()); dest = new File(source.getParent());
} }


Loading…
Cancel
Save