Stefan Bodewig 7 years ago
parent
commit
ef858568ab
2 changed files with 8 additions and 7 deletions
  1. +3
    -0
      WHATSNEW
  2. +5
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/Cab.java

+ 3
- 0
WHATSNEW View File

@@ -26,6 +26,9 @@ Fixed bugs:
* The junit task when used with includeantruntime="no" was incorrectly
printing a warning about multiple versions of ant detected in path

* <cab> died with a NullPointerException since Ant 1.10.2.
Bugzilla Report 62335

Other changes:
--------------



+ 5
- 7
src/main/org/apache/tools/ant/taskdefs/optional/Cab.java View File

@@ -52,6 +52,7 @@ public class Cab extends MatchingTask {
private boolean doCompress = true;
private boolean doVerbose = false;
private String cmdOptions;
private boolean filesetAdded = false;

// CheckStyle:VisibilityModifier OFF - bc
protected String archiveType = "cab";
@@ -59,10 +60,6 @@ public class Cab extends MatchingTask {

private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();

{
fileset = null;
}

/**
* The name/location of where to create the .cab file.
* @param cabFile the location of the cab file.
@@ -108,9 +105,10 @@ public class Cab extends MatchingTask {
* @param fileset a set of files to archive.
*/
public void addFileset(FileSet fileset) {
if (fileset != null) {
if (filesetAdded) {
throw new BuildException("Only one nested fileset allowed");
}
filesetAdded = true;
this.fileset = fileset;
}

@@ -124,7 +122,7 @@ public class Cab extends MatchingTask {
* @throws BuildException on error.
*/
protected void checkConfiguration() throws BuildException {
if (baseDir == null && fileset == null) {
if (baseDir == null && !filesetAdded) {
throw new BuildException(
"basedir attribute or one nested fileset is required!",
getLocation());
@@ -132,7 +130,7 @@ public class Cab extends MatchingTask {
if (baseDir != null && !baseDir.exists()) {
throw new BuildException("basedir does not exist!", getLocation());
}
if (baseDir != null && fileset != null) {
if (baseDir != null && filesetAdded) {
throw new BuildException(
"Both basedir attribute and a nested fileset is not allowed");
}


Loading…
Cancel
Save