cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gwesterfieldjr
Level 3

Console Installer: promptAndGetValue and reprompt if user enters wrong value?

I have a customCodeConsoleAction in which I am using the promptAndGetValue method from ConsoleUtils

I want to get the gmail account of the user. After prompting once I check to see if the gmail is a valid email address, if it is not I want to reprompt the user. This is my code. The installer is crashing when i try to call the method again.

Any ideas or other solutions?


HERE IS MY CODE:

@Override
public void executeConsoleAction() throws PreviousRequestException {
try {

promptForGoogleAccount();

} catch (PreviousRequestException e) {
cccp.setVariable("GMAIL_ACCOUNT", "");
throw new PreviousRequestException();
}

}

private void promptForGoogleAccount() throws PreviousRequestException {
ConsoleUtils cu = (ConsoleUtils) cccp.getService(ConsoleUtils.class);

String googleAccountQuestion = "Please enter your Google Email Account";

String googleAccount = cu.promptAndGetValue(googleAccountQuestion);

if (isValidGoogleAccount(googleAccount) == true) {

cccp.setVariable("GMAIL_ACCOUNT", googleAccount);

} else {
promptForGoogleAccount();
}

}
Labels (1)
0 Kudos
(1) Reply
gwesterfieldjr
Level 3

i figured it out...silly mistakes. It had to do with my boolean method
0 Kudos