use of alien4cloud.tosca.parser.ParsingError in project yorc-a4c-plugin by ystia.
the class PluginArchiveService method parsePluginArchives.
public PluginArchive parsePluginArchives(String archiveRelativePath) {
// Parse the archives
ParsingResult<ArchiveRoot> result;
Path archivePath = selfContext.getPluginPath().resolve(archiveRelativePath);
try {
result = this.archiveParser.parseDir(archivePath, AlienConstants.GLOBAL_WORKSPACE_ID);
} catch (ParsingException e) {
log.error("Failed to parse archive, plugin won't work", e);
throw new RuntimeException("Failed to parse archive, plugin won't work", e);
}
if (result.getContext().getParsingErrors() != null && !result.getContext().getParsingErrors().isEmpty()) {
log.error("Parsing errors for " + archiveRelativePath);
for (ParsingError parsingError : result.getContext().getParsingErrors()) {
log.error(parsingError.toString());
}
throw new RuntimeException("Plugin archive is invalid, plugin won't work");
}
return new PluginArchive(result.getResult(), archivePath);
}
Aggregations