use of org.graalvm.component.installer.UserAbortException in project graal by oracle.
the class LicensePresenter method displaySingleLicense.
void displaySingleLicense() {
String licId = licensesToAccept.keySet().iterator().next();
MetadataLoader ldr = licensesToAccept.get(licId).get(0);
String type = ldr.getLicenseType();
String compList = formatComponentList(licId);
feedback.output("INSTALL_AcceptLicense", compList, type);
feedback.outputPart("INSTALL_AcceptSingleLicense");
String input = feedback.acceptLine(true);
if (isYes(input)) {
acceptLicense(licId);
return;
} else if (isRead(input)) {
displayLicenseId = licId;
state = State.LICENSE;
} else {
throw new UserAbortException();
}
}
use of org.graalvm.component.installer.UserAbortException in project graal by oracle.
the class LicensePresenter method processUserInputForList.
int processUserInputForList() {
String userInput = feedback.acceptLine(true);
Pattern p = Pattern.compile(feedback.l10n("INSTALL_AcceptPromptResponseAbort@"), Pattern.CASE_INSENSITIVE);
if (p.matcher(userInput).matches()) {
throw new UserAbortException();
}
if (isYes(userInput)) {
acceptAllLicenses();
state = State.NONE;
return 0;
}
if (!ALL_NUMBERS.matcher(userInput).matches()) {
feedback.output("INSTALL_LicenseNumberInvalidEntry", licensesToAccept.size());
return -1;
}
int n = Integer.parseInt(userInput);
if (n < 0 || n > licensesToAccept.size()) {
feedback.output("INSTALL_LicenseNumberOutOfRange", licensesToAccept.size());
return -1;
}
return n;
}
use of org.graalvm.component.installer.UserAbortException in project graal by oracle.
the class LicensePresenter method displayLicenseText.
void displayLicenseText() throws IOException {
String text = loadLicenseText(displayLicenseId);
feedback.verbatimOut(text, false);
feedback.output("INSTALL_AcceptLicensePrompt");
String input = feedback.acceptLine(true);
if (isYes(input)) {
acceptLicense(displayLicenseId);
state = multiLicenses ? State.LIST : State.SINGLE;
} else if (!multiLicenses) {
throw new UserAbortException();
} else {
state = State.LIST;
}
}
use of org.graalvm.component.installer.UserAbortException 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