diff --git a/src/net/socialgamer/cah/data/Game.java b/src/net/socialgamer/cah/data/Game.java index 7893332..d66ec96 100644 --- a/src/net/socialgamer/cah/data/Game.java +++ b/src/net/socialgamer/cah/data/Game.java @@ -36,6 +36,7 @@ import java.util.Set; import java.util.Timer; import java.util.TimerTask; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.socialgamer.cah.Constants.BlackCardData; @@ -1210,6 +1211,7 @@ public class Game { * User whose hand to convert to client data. * @return Client representation of {@code user}'s hand. */ + @Nonnull public List> getHand(final User user) { final Player player = getPlayerForUser(user); if (player != null) { @@ -1218,7 +1220,7 @@ public class Game { return getWhiteCardData(hand); } } else { - return null; + return new ArrayList>(0); } } diff --git a/src/net/socialgamer/cah/handlers/GetCardsHandler.java b/src/net/socialgamer/cah/handlers/GetCardsHandler.java index 6c87bee..ab1780e 100644 --- a/src/net/socialgamer/cah/handlers/GetCardsHandler.java +++ b/src/net/socialgamer/cah/handlers/GetCardsHandler.java @@ -23,7 +23,6 @@ package net.socialgamer.cah.handlers; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -56,18 +55,13 @@ public class GetCardsHandler extends GameWithPlayerHandler { public static final String OP = AjaxOperation.GET_CARDS.toString(); - @SuppressWarnings("unchecked") @Override public Map handleWithUserInGame(final RequestWrapper request, final HttpSession session, final User user, final Game game) { final Map data = new HashMap(); final List> hand = game.getHand(user); - if (hand != null) { - data.put(AjaxResponse.HAND, hand); - } else { - data.put(AjaxResponse.HAND, Arrays.asList(new HashMap())); - } + data.put(AjaxResponse.HAND, hand); data.put(AjaxResponse.BLACK_CARD, game.getBlackCard()); data.put(AjaxResponse.WHITE_CARDS, game.getWhiteCards(user)); data.put(AjaxResponse.GAME_ID, game.getId());