Merge pull request #177 from mikeprimm/master

Avoid exception in JSON handling for web chat messages without timestanp
This commit is contained in:
mikeprimm 2011-05-30 08:52:06 -07:00
commit 74fb60718d

View File

@ -136,7 +136,9 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
Iterator<?> iter = jsonMsgs.iterator(); Iterator<?> iter = jsonMsgs.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
JSONObject o = (JSONObject) iter.next(); JSONObject o = (JSONObject) iter.next();
if (Long.parseLong(String.valueOf(o.get("timestamp"))) >= (lastTimestamp)) { String ts = String.valueOf(o.get("timestamp"));
if(ts.equals("null")) ts = "0";
if (Long.parseLong(ts) >= (lastTimestamp)) {
String name = String.valueOf(o.get("name")); String name = String.valueOf(o.get("name"));
String message = String.valueOf(o.get("message")); String message = String.valueOf(o.get("message"));
webChat(name, message); webChat(name, message);