Author: bodewig
Date: Sun Aug 23 05:46:19 2009
New Revision: 806930
URL: http://svn.apache.org/viewvc?rev=806930&view=rev
Log:
Make ar fail early if asked to add directories
Modified:
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
Modified:
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
URL:
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java?rev=806930&r1=806929&r2=806930&view=diff
==============================================================================
---
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
(original)
+++
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
Sun Aug 23 05:46:19 2009
@@ -29,6 +29,9 @@
*/
public class Ar extends ArchiveBase {
+ private static final String NO_DIRS_MESSAGE = "ar archives cannot store"
+ + " directory entries";
+
public Ar() {
super(new ArStreamFactory(),
new ArchiveBase.EntryBuilder() {
@@ -36,8 +39,7 @@
boolean isDir = r.getResource().isDirectory();
if (isDir) {
// REVISIT
- throw new BuildException("ar archives cannot store"
- + " directory entries");
+ throw new BuildException(NO_DIRS_MESSAGE);
}
int mode = ArchiveFileSet.DEFAULT_FILE_MODE;
@@ -74,4 +76,9 @@
});
}
+ public void setFilesOnly(boolean b) {
+ if (!b) {
+ throw new BuildException(NO_DIRS_MESSAGE);
+ }
+ }
}
\ No newline at end of file