String itemURL = relativePath(base, f);
if (f.isDirectory()) {
processDir(base, f, urls, msgs, token);
} else if (f.isFile()) {
try {
DeploymentMessage msg = null;
InputStream input = new FileInputStream(f);
try {
if (f.getName().endsWith(".pipa")) {
msg = processPipa(token, input, itemURL, urls);
}
if (msg != null)
msgs.add(msg);
} finally {
close(input);
}
} catch (Exception e) {
// this shouldn't happen but if it does, fail fast
LOG.error("Error while processing PIPA: " + f, e);
DeploymentMessage msg = new DeploymentMessage(Level.ERROR, e.toString());
msg.setResource(itemURL);
msgs.add(msg);
break;
}
} else {
DeploymentMessage msg = new DeploymentMessage(Level.WARNING, "Unknown file type: " + f);
msg.setResource(itemURL);
msgs.add(msg);
}
}
}