boolean classPathHadVF = false;
List<ClassPathEntry> classPathEntries = contextInfo.getClassPath();
VFSDeploymentContext top = vfsContext.getTopLevel();
VirtualFile root = top.getRoot();
List<VirtualFile> classPath = new ArrayList<VirtualFile>();
if (classPathEntries != null)
{
for (ClassPathEntry entry : classPathEntries)
{
if (trace)
log.trace("Resolving classpath entry " + entry + " for " + context.getName());
String suffixes = entry.getSuffixes();
VirtualFile child;
if (entry.getPath().length() == 0)
{
child = root;
}
else
{
try
{
child = root.findChild(entry.getPath()); // leaving the findChild
}
catch (Throwable t)
{
throw DeploymentException.rethrowAsDeploymentException("Unable to find class path entry " + entry + " from " + root.getName(), t);
}
}
if (suffixes == null)
{
classPath.add(child);
if (classPathHadVF == false)
classPathHadVF = child.equals(root);
}
else
{
String[] suffs = suffixes.split(",");
SuffixMatchFilter filter = new SuffixMatchFilter(Arrays.asList(suffs), VisitorAttributes.DEFAULT);
List<VirtualFile> matches = child.getChildren(filter);
if( matches != null )
{
classPath.addAll(matches);
if (trace)
log.trace("Added classpath matches: " + matches);
// Process any Manifest Class-Path refs
for (VirtualFile file : matches)
{
VFSUtils.addManifestLocations(file, classPath);
if (classPathHadVF == false)
classPathHadVF = file.equals(root);
}
}
}
}
}
VirtualFile file = vfsContext.getRoot();
if (classPathHadVF == false && SecurityActions.isLeaf(file) == false)
VFSUtils.addManifestLocations(file, classPath);
if (classPath.isEmpty() == false)
vfsContext.setClassPath(classPath);