Browse Source

AbstractFileSet should check whether it is a reference in a couple of places

Triggered by PR: 12838


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273339 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
8dd879b20a
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      src/main/org/apache/tools/ant/types/AbstractFileSet.java

+ 24
- 0
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -308,6 +308,9 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
* sensitive, "false"|"off"|"no" when not. * sensitive, "false"|"off"|"no" when not.
*/ */
public void setCaseSensitive(boolean isCaseSensitive) { public void setCaseSensitive(boolean isCaseSensitive) {
if (isReference()) {
throw tooManyAttributes();
}
this.isCaseSensitive = isCaseSensitive; this.isCaseSensitive = isCaseSensitive;
} }


@@ -317,6 +320,9 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
* @param followSymlinks whether or not symbolic links should be followed * @param followSymlinks whether or not symbolic links should be followed
*/ */
public void setFollowSymlinks(boolean followSymlinks) { public void setFollowSymlinks(boolean followSymlinks) {
if (isReference()) {
throw tooManyAttributes();
}
this.followSymlinks = followSymlinks; this.followSymlinks = followSymlinks;
} }


@@ -375,6 +381,11 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
} }


public void setupDirectoryScanner(FileScanner ds, Project p) { public void setupDirectoryScanner(FileScanner ds, Project p) {
if (isReference()) {
getRef(p).setupDirectoryScanner(ds, p);
return;
}

if (ds == null) { if (ds == null) {
throw new IllegalArgumentException("ds cannot be null"); throw new IllegalArgumentException("ds cannot be null");
} }
@@ -432,6 +443,9 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
* @return whether any selectors are in this container * @return whether any selectors are in this container
*/ */
public boolean hasSelectors() { public boolean hasSelectors() {
if (isReference() && getProject() != null) {
return getRef(getProject()).hasSelectors();
}
return !(selectors.isEmpty()); return !(selectors.isEmpty());
} }


@@ -441,6 +455,10 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
* @return whether any patterns are in this container * @return whether any patterns are in this container
*/ */
public boolean hasPatterns() { public boolean hasPatterns() {
if (isReference() && getProject() != null) {
return getRef(getProject()).hasPatterns();
}

if (defaultPatterns.hasPatterns(getProject())) { if (defaultPatterns.hasPatterns(getProject())) {
return true; return true;
} }
@@ -462,6 +480,9 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
* @return the number of selectors in this container * @return the number of selectors in this container
*/ */
public int selectorCount() { public int selectorCount() {
if (isReference() && getProject() != null) {
return getRef(getProject()).selectorCount();
}
return selectors.size(); return selectors.size();
} }


@@ -486,6 +507,9 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
* @return an enumerator that goes through each of the selectors * @return an enumerator that goes through each of the selectors
*/ */
public Enumeration selectorElements() { public Enumeration selectorElements() {
if (isReference() && getProject() != null) {
return getRef(getProject()).selectorElements();
}
return selectors.elements(); return selectors.elements();
} }




Loading…
Cancel
Save