use of org.ambraproject.rhino.rest.RestClientException in project rhino by PLOS.
the class IngestionService method getManifestXml.
@VisibleForTesting
ManifestXml getManifestXml(Archive archive) throws IOException {
String manifestEntry = null;
for (String entryName : archive.getEntryNames()) {
if (entryName.equalsIgnoreCase("manifest.xml")) {
manifestEntry = entryName;
}
}
if (manifestEntry == null) {
throw new RestClientException("Archive has no manifest file", HttpStatus.BAD_REQUEST);
}
ManifestXml manifestXml;
try (InputStream manifestStream = new BufferedInputStream(archive.openFile(manifestEntry))) {
manifestXml = new ManifestXml(AmbraService.parseXml(manifestStream));
}
return manifestXml;
}
Aggregations