Skip to content

Commit b3bfa4c

Browse files
authored
Merge pull request #163 from policeman-tools/dev/emptyclasseswarning
Hides the warning if the classes directory/fileset is missing
2 parents 4416a82 + 8c5bb00 commit b3bfa4c

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/main/java/de/thetaphi/forbiddenapis/ant/AntTask.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void error(String msg) {
8383
@Override
8484
public void warn(String msg) {
8585
// ANT has no real log levels printed, so prefix with "WARNING":
86-
log("WARNING: " + msg, Project.MSG_WARN);
86+
log("WARNING: ".concat(msg), Project.MSG_WARN);
8787
}
8888

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

344-
/** Ignore empty fileset/resource collection and print a warning instead.
343+
/** Ignore empty fileset/resource collection.
345344
* Defaults to {@code false}.
346345
*/
347346
public void setIgnoreEmptyFileSet(boolean ignoreEmptyFileset) {

src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public void info(String msg) {
336336
log.info("Scanning for classes to check...");
337337
final File classesDirectory = getClassesDirectory();
338338
if (!classesDirectory.exists()) {
339-
log.warn("Classes directory does not exist, forbiddenapis check skipped: " + classesDirectory);
339+
log.info("Classes directory does not exist, forbiddenapis check skipped: " + classesDirectory);
340340
return;
341341
}
342342
final DirectoryScanner ds = new DirectoryScanner();
@@ -348,7 +348,7 @@ public void info(String msg) {
348348
ds.scan();
349349
final String[] files = ds.getIncludedFiles();
350350
if (files.length == 0) {
351-
log.warn(String.format(Locale.ENGLISH,
351+
log.info(String.format(Locale.ENGLISH,
352352
"No classes found in '%s' (includes=%s, excludes=%s), forbiddenapis check skipped.",
353353
classesDirectory.toString(), Arrays.toString(includes), Arrays.toString(excludes)));
354354
return;

0 commit comments

Comments
 (0)