} else {
indexIgnorePaths = null;
}
final VirtualFile virtualFile = resourceRoot.getRoot();
final Indexer indexer = new Indexer();
try {
final VisitorAttributes visitorAttributes = new VisitorAttributes();
visitorAttributes.setLeavesOnly(true);
visitorAttributes.setRecurseFilter(new VirtualFileFilter() {
public boolean accepts(VirtualFile file) {
return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));
}
});
final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class", visitorAttributes));
for (VirtualFile classFile : classChildren) {
InputStream inputStream = null;
try {
inputStream = classFile.openStream();
indexer.index(inputStream);
} catch (Exception e) {
ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(classFile.getPathNameRelativeTo(virtualFile), virtualFile.getPathName(), e);
} finally {
VFSUtils.safeClose(inputStream);
}
}
final Index index = indexer.complete();
resourceRoot.putAttachment(Attachments.ANNOTATION_INDEX, index);
ServerLogger.DEPLOYMENT_LOGGER.tracef("Generated index for archive %s", virtualFile);
} catch (Throwable t) {
throw new DeploymentUnitProcessingException("Failed to index deployment root for annotations", t);
}