From 054d49663e87a3d273e0bd28839531ca2cafa4cf Mon Sep 17 00:00:00 2001 From: Jacobus Martinus Kruithof Date: Thu, 16 Aug 2007 13:33:00 +0000 Subject: [PATCH] Pr 43016 improved error reporting on nothing to compress. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@566707 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Pack.java | 9 +++-- src/tests/antunit/taskdefs/gzip-test.xml | 36 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/tests/antunit/taskdefs/gzip-test.xml diff --git a/src/main/org/apache/tools/ant/taskdefs/Pack.java b/src/main/org/apache/tools/ant/taskdefs/Pack.java index 00dac9644..09c4bc398 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Pack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Pack.java @@ -88,9 +88,14 @@ public abstract class Pack extends Task { * @param a the resource to pack as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { + if (a.size() == 0) { + throw new BuildException("No resource selected, " + getTaskName() + + " needs exactly one resource."); + } if (a.size() != 1) { - throw new BuildException("only single argument resource collections" - + " are supported as archives"); + throw new BuildException(getTaskName() + + " cannot handle multiple resources at once. (" + a.size() + + " resources were selected.)"); } setSrcResource((Resource) a.iterator().next()); } diff --git a/src/tests/antunit/taskdefs/gzip-test.xml b/src/tests/antunit/taskdefs/gzip-test.xml new file mode 100644 index 000000000..72bd673c8 --- /dev/null +++ b/src/tests/antunit/taskdefs/gzip-test.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +