}
@SuppressWarnings("unchecked")
final Iterator<Resource> iter = (Iterator<Resource>) apiSignatures.iterator();
while (iter.hasNext()) {
final Resource r = iter.next();
if (r instanceof StringResource) {
final String s = ((StringResource) r).getValue();
if (s != null && s.trim().length() > 0) {
log("Reading inline API signatures...", Project.MSG_INFO);
checker.parseSignaturesString(s);
}
} else {
log("Reading API signatures: " + r, Project.MSG_INFO);
checker.parseSignaturesFile(r.getInputStream());
}
}
} catch (IOException ioe) {
throw new BuildException("IO problem while reading files with API signatures: " + ioe);
} catch (ParseException pe) {
throw new BuildException("Parsing signatures failed: " + pe.getMessage());
}
if (checker.hasNoSignatures()) {
throw new BuildException("No API signatures found; use signaturesFile=, <signaturesFileSet/>, <bundledSignatures/> or inner text to define those!");
}
log("Loading classes to check...", Project.MSG_INFO);
try {
@SuppressWarnings("unchecked")
final Iterator<Resource> iter = (Iterator<Resource>) classFiles.iterator();
boolean foundClass = false;
while (iter.hasNext()) {
final Resource r = iter.next();
final String name = r.getName();
if (restrictClassFilename && name != null && !name.endsWith(".class")) {
continue;
}
checker.addClassToCheck(r.getInputStream());
foundClass = true;
}
if (!foundClass) {
if (ignoreEmptyFileset) {
log("There is no <fileset/> or other resource collection given, or the collection does not contain any class files to check.", Project.MSG_WARN);