Skip to content

Commit

Permalink
Merge pull request #163 from policeman-tools/dev/emptyclasseswarning
Browse files Browse the repository at this point in the history
Hides the warning if the classes directory/fileset is missing
  • Loading branch information
uschindler authored Apr 13, 2020
2 parents 4416a82 + 8c5bb00 commit b3bfa4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/main/java/de/thetaphi/forbiddenapis/ant/AntTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void error(String msg) {
@Override
public void warn(String msg) {
// ANT has no real log levels printed, so prefix with "WARNING":
log("WARNING: " + msg, Project.MSG_WARN);
log("WARNING: ".concat(msg), Project.MSG_WARN);
}

@Override
Expand Down Expand Up @@ -188,8 +188,7 @@ public void info(String msg) {
}
if (!foundClass) {
if (ignoreEmptyFileset) {
log.warn("There is no <fileset/> or other resource collection given, or the collection does not contain any class files to check.");
log.info("Scanned 0 class files.");
log.info("Resource collection of class files is empty. Scanned 0 class files.");
return;
} else {
throw new BuildException("There is no <fileset/> or other resource collection given, or the collection does not contain any class files to check.");
Expand Down Expand Up @@ -341,7 +340,7 @@ public void setRestrictClassFilename(boolean restrictClassFilename) {
this.restrictClassFilename = restrictClassFilename;
}

/** Ignore empty fileset/resource collection and print a warning instead.
/** Ignore empty fileset/resource collection.
* Defaults to {@code false}.
*/
public void setIgnoreEmptyFileSet(boolean ignoreEmptyFileset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public void info(String msg) {
log.info("Scanning for classes to check...");
final File classesDirectory = getClassesDirectory();
if (!classesDirectory.exists()) {
log.warn("Classes directory does not exist, forbiddenapis check skipped: " + classesDirectory);
log.info("Classes directory does not exist, forbiddenapis check skipped: " + classesDirectory);
return;
}
final DirectoryScanner ds = new DirectoryScanner();
Expand All @@ -348,7 +348,7 @@ public void info(String msg) {
ds.scan();
final String[] files = ds.getIncludedFiles();
if (files.length == 0) {
log.warn(String.format(Locale.ENGLISH,
log.info(String.format(Locale.ENGLISH,
"No classes found in '%s' (includes=%s, excludes=%s), forbiddenapis check skipped.",
classesDirectory.toString(), Arrays.toString(includes), Arrays.toString(excludes)));
return;
Expand Down

0 comments on commit b3bfa4c

Please sign in to comment.