use of org.graalvm.component.installer.InstallerStopException in project graal by oracle.
the class InfoCommand method printDetails.
@Override
void printDetails(ComponentParam param, ComponentInfo info) {
if (printTable) {
String line;
if (fullPath) {
line = String.format(feedback.l10n("INFO_ComponentLongList"), shortenComponentId(info), val(info.getVersion().displayString()), val(info.getName()), filePath(info), info.getStability().displayName(feedback));
} else {
line = String.format(feedback.l10n(noComponentPath ? "INFO_ComponentShortListNoFile" : "INFO_ComponentShortList"), shortenComponentId(info), val(info.getVersion().displayString()), val(info.getName()), filePath(info), info.getStability().displayName(feedback));
}
feedback.verbatimOut(line, false);
return;
} else {
feedback.output("INFO_ComponentBasicInfo", shortenComponentId(info), val(info.getVersion().displayString()), val(info.getName()), param.getFullPath(), findRequiredGraalVMVersion(info), info.getStability().displayName(feedback));
List<String> keys = new ArrayList<>(info.getRequiredGraalValues().keySet());
keys.remove(CommonConstants.CAP_GRAALVM_VERSION);
if (!keys.isEmpty() && feedback.verboseOutput("INFO_ComponentRequirementsHeader")) {
Collections.sort(keys);
for (String cap : keys) {
feedback.verboseOutput("INFO_ComponentRequirement", getRegistry().localizeCapabilityName(cap), info.getRequiredGraalValues().get(cap));
}
}
MetadataLoader ldr = map.get(info);
List<InstallerStopException> errs = ldr.getErrors();
if (!errs.isEmpty()) {
feedback.message("INFO_ComponentBroken", files.get(info));
for (InstallerStopException ex : errs) {
feedback.message("INFO_ComponentErrorIndent", ex.getLocalizedMessage());
}
}
Verifier vfy = new Verifier(feedback, input.getLocalRegistry(), catalog).collect(true).validateRequirements(info);
if (vfy.hasErrors()) {
feedback.message("INFO_ComponentWillNotInstall", shortenComponentId(info));
for (DependencyException ex : vfy.getErrors()) {
feedback.message("INFO_ComponentDependencyIndent", ex.getLocalizedMessage());
}
}
}
}
use of org.graalvm.component.installer.InstallerStopException in project graal by oracle.
the class UninstallCommand method execute.
@Override
public int execute() throws IOException {
registry.verifyAdministratorAccess();
if (input.optValue(Commands.OPTION_HELP) != null) {
feedback.output("UNINSTALL_Help");
return 0;
}
if (!input.hasParameter()) {
feedback.output("UNINSTALL_ParametersMissing");
return 1;
}
prepareUninstall();
checkBrokenDependencies();
includeAndOrderComponents();
try {
for (ComponentInfo info : uninstallSequence) {
try {
uninstallSingleComponent(info);
} catch (InstallerStopException | IOException ex) {
if (ignoreFailures) {
feedback.error("UNINSTALL_IgnoreFailed", ex, info.getId(), ex.getLocalizedMessage());
} else {
feedback.error("UNINSTALL_ErrorDuringProcessing", ex, info.getId());
throw ex;
}
}
}
} finally {
if (rebuildPolyglot && WARN_REBUILD_IMAGES) {
Path p = SystemUtils.fromCommonString(CommonConstants.PATH_JRE_BIN);
feedback.output("INSTALL_RebuildPolyglotNeeded", File.separator, input.getGraalHomePath().resolve(p).normalize());
}
}
return 0;
}
use of org.graalvm.component.installer.InstallerStopException in project graal by oracle.
the class MergeStorage method listComponentIDs.
@Override
public Set<String> listComponentIDs() throws IOException {
Set<String> ids = new HashSet<>();
List<Exception> savedEx = new ArrayList<>();
List<SoftwareChannel> errChannels = new ArrayList<>();
boolean oneSucceeded = false;
Exception toThrow = null;
for (SoftwareChannel del : new ArrayList<>(channels)) {
try {
ids.addAll(del.getStorage().listComponentIDs());
oneSucceeded = true;
} catch (IncompatibleException ex) {
savedEx.add(ex);
errChannels.add(del);
channels.remove(del);
} catch (IOException | FailedOperationException ex) {
if (!isIgnoreCatalogErrors()) {
throw ex;
}
if (!idsLoaded) {
reportError(ex, del);
}
toThrow = ex;
channels.remove(del);
}
}
if (!oneSucceeded || ids.isEmpty()) {
for (int i = 0; i < savedEx.size(); i++) {
reportError(toThrow = savedEx.get(i), errChannels.get(i));
}
if (toThrow instanceof IOException) {
throw (IOException) toThrow;
} else if (toThrow != null) {
throw (InstallerStopException) toThrow;
}
}
idsLoaded = true;
return ids;
}
use of org.graalvm.component.installer.InstallerStopException in project graal by oracle.
the class InstallCommand method executeStep.
void executeStep(Step s, boolean close) throws IOException {
boolean ok = false;
try {
s.execute();
ok = true;
} catch (ZipException ex) {
feedback.error("INSTALL_InvalidComponentArchive", ex, current);
throw ex;
} catch (UserAbortException ex) {
throw ex;
} catch (InstallerStopException | IOException ex) {
if (ignoreFailures) {
if (current == null) {
feedback.error("INSTALL_IgnoreFailedInstallation", ex, ex.getLocalizedMessage());
} else {
feedback.error("INSTALL_IgnoreFailedInstallation2", ex, current, ex.getLocalizedMessage());
}
} else {
if (current != null) {
feedback.error("INSTALL_ErrorDuringProcessing", ex, current, ex.getLocalizedMessage());
}
throw ex;
}
} finally {
if (!ok) {
for (Installer inst : executedInstallers) {
inst.revertInstall();
}
}
if (close || !ok) {
for (Installer inst : installers) {
try {
inst.close();
} catch (IOException ex) {
// expected
}
}
}
}
}
Aggregations