A cancel by the voter is now sent to the execution flow as a Throwable

rather than an Exception.
vbdev2
Hai Brenner 2016-06-28 11:28:14 +03:00
parent 438df78e36
commit 3a5908ac49
3 changed files with 7 additions and 7 deletions

View File

@ -35,8 +35,8 @@ public class ChannelChoiceCallback extends ControllerCallback<List<BallotAnswer>
@Override
public void onFailure(Throwable t) {
if (t instanceof VoterCancelException) {
// voter has cancelled during the UI channel choice process. A VoterCancelException is thrown
if (t instanceof VoterCancelThrowable) {
// voter has cancelled during the UI channel choice process. A VoterCancelThrowable is thrown
logger.debug("ChannelChoiceCallback got a cancellation response");
enqueueCommand(new RestartVotingCommand(getRequestIdentifier(), getBallotSerialNumber()));
}

View File

@ -34,7 +34,7 @@ public class VotingCallback extends ControllerCallback<List<BallotAnswer>> {
@Override
public void onFailure(Throwable t) {
if (t instanceof VoterCancelException) {
if (t instanceof VoterCancelThrowable) {
logger.debug("VotingCallback got a cancellation response");
enqueueCommand(new RestartVotingCommand(getRequestIdentifier(), getBallotSerialNumber()));
}

View File

@ -155,7 +155,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable {
List<BallotAnswer> answers = askVoterForAnswers(command.getQuestions());
command.getCallback().onSuccess(answers);
}
catch (VoterCancelException e) {
catch (VoterCancelThrowable e) {
command.getCallback().onFailure(e);
}
catch (IOException e) {
@ -179,7 +179,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable {
List<BallotAnswer> answers = askVoterForAnswers(command.getQuestions());
command.getCallback().onSuccess(answers);
}
catch (VoterCancelException e) {
catch (VoterCancelThrowable e) {
command.getCallback().onFailure(e);
}
catch (IOException e) {
@ -339,7 +339,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable {
}
}
private List<BallotAnswer> askVoterForAnswers(List<BallotQuestion> questions) throws VoterCancelException, IOException {
private List<BallotAnswer> askVoterForAnswers(List<BallotQuestion> questions) throws VoterCancelThrowable, IOException {
assertQuestionsAreValid (questions);
@ -354,7 +354,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable {
String s = readInputLine();
if ((s.equals("cancel") || s.equals("c")) || (index == 0 && (s.equals("back") || s.equals("b")))) {
throw new VoterCancelException();
throw new VoterCancelThrowable();
}
else if (s.equals("back") || s.equals("b")) {
--index;