Browse Source

Bug 43348: add awareness of FileProvider to ZipScanner; lets us zip from other places.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@709763 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 16 years ago
parent
commit
d6cccd3f5e
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      src/main/org/apache/tools/ant/types/ZipScanner.java

+ 6
- 5
src/main/org/apache/tools/ant/types/ZipScanner.java View File

@@ -27,6 +27,7 @@ import java.util.zip.ZipException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.ZipResource;
import org.apache.tools.ant.types.resources.FileProvider;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipFile;

@@ -59,19 +60,19 @@ public class ZipScanner extends ArchiveScanner {
ZipFile zf = null;

File srcFile = null;
if (src instanceof FileResource) {
srcFile = ((FileResource) src).getFile();
if (src instanceof FileProvider) {
srcFile = ((FileProvider) src).getFile();
} else {
throw new BuildException("only file resources are supported");
throw new BuildException("Only file provider resources are supported");
}

try {
try {
zf = new ZipFile(srcFile, encoding);
} catch (ZipException ex) {
throw new BuildException("problem reading " + srcFile, ex);
throw new BuildException("Problem reading " + srcFile, ex);
} catch (IOException ex) {
throw new BuildException("problem opening " + srcFile, ex);
throw new BuildException("Problem opening " + srcFile, ex);
}
Enumeration e = zf.getEntries();
while (e.hasMoreElements()) {


Loading…
Cancel
Save