[virtualcommons-svn] SF.net SVN: virtualcommons:[410] foraging/branches/deepak-branch-fall-09/ src
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2009-12-04 19:42:06
|
Revision: 410 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=410&view=rev Author: alllee Date: 2009-12-04 19:41:59 +0000 (Fri, 04 Dec 2009) Log Message: ----------- several NPE bug fixes: - added null check for active monitors - fixed NPE in sanction handling where ClientData.latestSanctions was null (http://opensource.asu.edu/jira/browse/COMMONS-9) Modified Paths: -------------- foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/SubjectView.java foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/event/SubmitRegulationRequest.java foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/model/ClientData.java Modified: foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java =================================================================== --- foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java 2009-12-04 18:32:03 UTC (rev 409) +++ foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java 2009-12-04 19:41:59 UTC (rev 410) @@ -63,7 +63,10 @@ } public Identifier getMonitorId() { - return groupDataModel.getActiveMonitor().getId(); + if (groupDataModel.getActiveMonitor() != null) { + return groupDataModel.getActiveMonitor().getId(); + } + return Identifier.NULL; } public boolean isSanctioningAllowed() { Modified: foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java =================================================================== --- foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2009-12-04 18:32:03 UTC (rev 409) +++ foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2009-12-04 19:41:59 UTC (rev 410) @@ -795,7 +795,7 @@ activeRegulation = "No regulation specified."; } setInstructions( - "<h3>The following regulation received the most votes:</h3><pre>" + activeRegulation + "</pre>"); + "<h3>The following regulation received the most votes:</h3><p>" + activeRegulation + "</p>"); addCenterComponent(instructionsScrollPane); startRegulationDisplayTimer(); } Modified: foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/SubjectView.java =================================================================== --- foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/SubjectView.java 2009-12-04 18:32:03 UTC (rev 409) +++ foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/client/SubjectView.java 2009-12-04 19:41:59 UTC (rev 410) @@ -180,14 +180,14 @@ graphics2D.fillRect(x, y, getCellWidth(), getCellHeight()); graphics2D.drawImage(scaledBeingSanctionedImage, x, y, this); } - else if (id.equals(dataModel.getMonitorId())) { - graphics2D.drawImage(scaledMonitorImage, x, y, this); - } else if (dataModel.isSanctioning(id)) { graphics2D.setColor(Color.WHITE); graphics2D.fillRect(x, y, getCellWidth(), getCellHeight()); graphics2D.drawImage(scaledSanctioningImage, x, y, this); } + else if (id.equals(dataModel.getMonitorId())) { + graphics2D.drawImage(scaledMonitorImage, x, y, this); + } else if (id.equals(dataModel.getId())) { if (dataModel.isExplicitCollectionMode()) { graphics2D.drawImage(scaledSelfExplicitCollectionModeImage, x, y, this); Modified: foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/event/SubmitRegulationRequest.java =================================================================== --- foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/event/SubmitRegulationRequest.java 2009-12-04 18:32:03 UTC (rev 409) +++ foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/event/SubmitRegulationRequest.java 2009-12-04 19:41:59 UTC (rev 410) @@ -13,7 +13,7 @@ * @version $Revision: 1 $ */ -public class SubmitRegulationRequest extends AbstractEvent { +public class SubmitRegulationRequest extends AbstractPersistableEvent { private static final long serialVersionUID = 475300882222383637L; Modified: foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/model/ClientData.java =================================================================== --- foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/model/ClientData.java 2009-12-04 18:32:03 UTC (rev 409) +++ foraging/branches/deepak-branch-fall-09/src/main/java/edu/asu/commons/foraging/model/ClientData.java 2009-12-04 19:41:59 UTC (rev 410) @@ -49,7 +49,7 @@ private volatile boolean collecting; private volatile boolean explicitCollectionMode; private Duration freezeDuration; - private LinkedList<RealTimeSanctionRequest> latestSanctions; + private LinkedList<RealTimeSanctionRequest> latestSanctions = new LinkedList<RealTimeSanctionRequest>(); private AnimationData animationData; private boolean subjectsFieldOfVisionEnabled; @@ -290,9 +290,7 @@ } public void resetLatestSanctions() { - if (latestSanctions != null) { - latestSanctions.clear(); - } + latestSanctions.clear(); } private void resetCurrentTokens() { @@ -397,9 +395,6 @@ if (tokensFieldOfVisionEnabled) { viewTokensRadius = roundConfiguration.getViewTokensRadius(); } - if (roundConfiguration.isRealTimeSanctioningEnabled()) { - latestSanctions = new LinkedList<RealTimeSanctionRequest>(); - } if (roundConfiguration.isPrivateProperty()) { setPosition (new Point(roundConfiguration.getResourceWidth() / 2, roundConfiguration.getResourceDepth() / 2)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |