logger.log(TreeLogger.DEBUG, "Reading user-provided manifest", null);
in = userManifest.getContents(logger);
if (in == null) {
logger.log(TreeLogger.ERROR,
"Unable to read contents of user manifest", null);
throw new UnableToCompleteException();
}
} else {
// Fall back to the built-in manifest
String packagePath = getClass().getPackage().getName().replace('.', '/');
String resourceName = packagePath + "/" + GEARS_MANIFEST;
in = getClass().getClassLoader().getResourceAsStream(resourceName);
if (in == null) {
logger.log(TreeLogger.ERROR, "Could not load built-in manifest from "
+ resourceName, null);
throw new UnableToCompleteException();
}
}
StringBuffer out = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
try {
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
out.append(line).append("\n");
}
} catch (IOException e) {
logger.log(TreeLogger.ERROR, "Unable to read manifest template", e);
throw new UnableToCompleteException();
}
return out;
}