make server-side check for no-content chat messages too

This commit is contained in:
Andy Janata 2012-03-12 21:05:57 -07:00
parent ae5bc1d594
commit 3273cfed12
1 changed files with 2 additions and 0 deletions

View File

@ -73,6 +73,8 @@ public class ChatHandler extends Handler {
final String message = request.getParameter(AjaxRequest.MESSAGE).trim(); final String message = request.getParameter(AjaxRequest.MESSAGE).trim();
if (message.length() > 200) { if (message.length() > 200) {
return error(ErrorCode.MESSAGE_TOO_LONG); return error(ErrorCode.MESSAGE_TOO_LONG);
} else if (message.length() == 0) {
return error(ErrorCode.NO_MSG_SPECIFIED);
} else { } else {
final HashMap<ReturnableData, Object> broadcastData = new HashMap<ReturnableData, Object>(); final HashMap<ReturnableData, Object> broadcastData = new HashMap<ReturnableData, Object>();
broadcastData.put(LongPollResponse.EVENT, LongPollEvent.CHAT.toString()); broadcastData.put(LongPollResponse.EVENT, LongPollEvent.CHAT.toString());