fixed: access to the static system messages from the StorageManage class, rather than its instance

vbdev2
Hai Brenner 2016-07-04 11:53:28 +03:00
parent 66e5db9f22
commit 7db6218735
1 changed files with 17 additions and 18 deletions

View File

@ -1,6 +1,5 @@
package meerkat.voting.controller;
import meerkat.protobuf.Crypto;
import meerkat.protobuf.Voting.*;
import meerkat.voting.controller.callbacks.*;
import meerkat.voting.controller.commands.*;
@ -153,7 +152,7 @@ public class VotingBoothImpl implements VotingBoothController {
}
else {
logger.error("handleSingleTask: unknown type of ControllerCommand received: " + task.getClass().getName());
doReportErrorAndForceRestart(systemMessages.get(storageManager.SOMETHING_WRONG_MESSAGE));
doReportErrorAndForceRestart(systemMessages.get(StorageManager.SOMETHING_WRONG_MESSAGE));
}
}
@ -182,7 +181,7 @@ public class VotingBoothImpl implements VotingBoothController {
queue.clear();
state.clearAndResetState(VBState.FATAL_ERROR_FORCE_NEW_VOTER);
ui.showErrorMessageWithButtons(errorMessage,
new UIElement[]{systemMessages.get(storageManager.RESTART_VOTING_BUTTON)},
new UIElement[]{systemMessages.get(StorageManager.RESTART_VOTING_BUTTON)},
new ErrorMessageRestartCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue));
@ -196,7 +195,7 @@ public class VotingBoothImpl implements VotingBoothController {
new ChannelChoiceCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.UNSUCCESSFUL_CHANNEL_CHOICE_MESSAGE)));
systemMessages.get(StorageManager.UNSUCCESSFUL_CHANNEL_CHOICE_MESSAGE)));
}
else {
logger.debug("doChooseChannel: current state is " + state.stateIdentifier);
@ -215,7 +214,7 @@ public class VotingBoothImpl implements VotingBoothController {
new VotingCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.UNSUCCESSFUL_VOTING_MESSAGE)));
systemMessages.get(StorageManager.UNSUCCESSFUL_VOTING_MESSAGE)));
}
else {
logger.debug("doSetChannelAndAskQuestions: current state is " + state.stateIdentifier);
@ -231,7 +230,7 @@ public class VotingBoothImpl implements VotingBoothController {
ui.castOrAudit(new CastOrAuditCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.UNRECOGNIZED_FINALIZE_RESPONSE_MESSAGE)));
systemMessages.get(StorageManager.UNRECOGNIZED_FINALIZE_RESPONSE_MESSAGE)));
}
else {
logger.debug("doChooseFinalizeOption: current state is " + state.stateIdentifier);
@ -243,25 +242,25 @@ public class VotingBoothImpl implements VotingBoothController {
logger.debug("doing commit");
try {
setBallotData(task);
ui.notifyVoterToWaitForFinish(systemMessages.get(storageManager.WAIT_FOR_COMMIT_MESSAGE),
ui.notifyVoterToWaitForFinish(systemMessages.get(StorageManager.WAIT_FOR_COMMIT_MESSAGE),
new WaitForFinishCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.SOMETHING_WRONG_MESSAGE)));
systemMessages.get(StorageManager.SOMETHING_WRONG_MESSAGE)));
outputDevice.commitToBallot(state.plaintextBallot,
state.signedEncryptedBallot,
new OutputDeviceCommitCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.OUTPUT_DEVICE_FAILURE_MESSAGE)));
systemMessages.get(StorageManager.OUTPUT_DEVICE_FAILURE_MESSAGE)));
state.stateIdentifier = VBState.COMMITTING_TO_BALLOT;
}
catch (SignatureException | IOException e) {
logger.error("doCommit: encryption failed. exception: " + e);
UIElement errorMessage = systemMessages.get(storageManager.ENCRYPTION_FAILED_MESSAGE);
UIElement errorMessage = systemMessages.get(StorageManager.ENCRYPTION_FAILED_MESSAGE);
UIElement[] buttons = new UIElement[]{
systemMessages.get(storageManager.RETRY_BUTTON),
systemMessages.get(storageManager.CANCEL_VOTE_BUTTON)};
systemMessages.get(StorageManager.RETRY_BUTTON),
systemMessages.get(StorageManager.CANCEL_VOTE_BUTTON)};
EncryptionFailedCallback callback = new EncryptionFailedCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
@ -294,28 +293,28 @@ public class VotingBoothImpl implements VotingBoothController {
logger.debug("finalizing");
state.stateIdentifier = VBState.FINALIZING;
if (auditRequested) {
ui.notifyVoterToWaitForFinish(systemMessages.get(storageManager.WAIT_FOR_AUDIT_MESSAGE),
ui.notifyVoterToWaitForFinish(systemMessages.get(StorageManager.WAIT_FOR_AUDIT_MESSAGE),
new WaitForFinishCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.SOMETHING_WRONG_MESSAGE)));
systemMessages.get(StorageManager.SOMETHING_WRONG_MESSAGE)));
outputDevice.audit(state.secrets,
new OutputDeviceFinalizeCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.OUTPUT_DEVICE_FAILURE_MESSAGE)));
systemMessages.get(StorageManager.OUTPUT_DEVICE_FAILURE_MESSAGE)));
}
else {
ui.notifyVoterToWaitForFinish(systemMessages.get(storageManager.WAIT_FOR_CAST_MESSAGE),
ui.notifyVoterToWaitForFinish(systemMessages.get(StorageManager.WAIT_FOR_CAST_MESSAGE),
new WaitForFinishCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.SOMETHING_WRONG_MESSAGE)));
systemMessages.get(StorageManager.SOMETHING_WRONG_MESSAGE)));
outputDevice.castBallot(
new OutputDeviceFinalizeCallback(generateRequestIdentifier(),
state.currentBallotSerialNumber,
this.queue,
systemMessages.get(storageManager.OUTPUT_DEVICE_FAILURE_MESSAGE)));
systemMessages.get(StorageManager.OUTPUT_DEVICE_FAILURE_MESSAGE)));
}
}
else {