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