public void getCompleteManifestClassPath(JarFile moduleFile, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
String manifestClassPath;
try {
manifestClassPath = factory.getManifestClassPath(moduleFile);
} catch (IOException e) {
problems.add(new DeploymentException(printInfo("Could not read manifest: " + moduleBaseUri, moduleBaseUri, classpath, exclusions), e));
return;
}
if (manifestClassPath == null) {
return;
}
for (StringTokenizer tokenizer = new StringTokenizer(manifestClassPath, " "); tokenizer.hasMoreTokens();) {
String path = tokenizer.nextToken();
URI pathUri;
try {
pathUri = new URI(path);
} catch (URISyntaxException e) {
problems.add(new DeploymentException(printInfo("Invalid manifest classpath entry, path=" + path, moduleBaseUri, classpath, exclusions)));
return;
}
if (!pathUri.getPath().endsWith(".jar")) {
problems.add(new DeploymentException(printInfo("Manifest class path entries must end with the .jar extension (J2EE 1.4 Section 8.2): path=" + path, moduleBaseUri, classpath, exclusions)));
return;
}
if (pathUri.isAbsolute()) {
problems.add(new DeploymentException(printInfo("Manifest class path entries must be relative (J2EE 1.4 Section 8.2): path=" + path, moduleBaseUri, classpath, exclusions)));
return;
}
URI targetUri = moduleBaseUri.resolve(pathUri);
if (targetUri.getPath().endsWith("/")) {
problems.add(new DeploymentException(printInfo("target path must not end with a '/' character: path=" + path + ", resolved to targetURI=" + targetUri, moduleBaseUri, classpath, exclusions)));
return;
}
String targetEntry = targetUri.toString();
if (exclusions.contains(targetEntry)) {
continue;
}
URI resolvedUri = resolutionUri.resolve(targetUri);
String classpathEntry = resolvedUri.toString();
//don't get caught in circular references
if (classpath.contains(classpathEntry)) {
continue;
}
classpath.add(classpathEntry);
JarFile classPathJarFile;
try {
classPathJarFile = factory.newJarFile(targetUri);
} catch (IOException e) {
problems.add(new DeploymentException(printInfo("Manifest class path entries must be a valid jar file (JAVAEE 5 Section 8.2): path=" + path + ", resolved to targetURI=" + targetUri, moduleBaseUri, classpath, exclusions), e));
return;
}
getCompleteManifestClassPath(classPathJarFile, targetUri, resolutionUri, classpath, exclusions, factory, problems);
}