try {
for (final File file : source) {
completionService.submit(new Runnable() {
public void run() {
Document document = documentFactory.createDocuments(file);
logger.debug("Selected file: {} [header style: {}]", DocumentFactory.getRelativeFile(rootDir, document),
document.getHeaderDefinition());
if (document.isNotSupported()) {
logger.warn("Unknown file extension: {}", DocumentFactory.getRelativeFile(rootDir, document));
} else if (document.is(h)) {
logger.debug("Skipping header file: {}", DocumentFactory.getRelativeFile(rootDir, document));
} else if (document.hasHeader(h, strictCheck)) {
callback.onExistingHeader(document, h);
} else {
boolean headerFound = false;
for (Header validHeader : validHeaders) {
headerFound = document.hasHeader(validHeader, strictCheck);
if (headerFound) {
callback.onExistingHeader(document, h);
break;
}
}