diff --git a/src/tinystruct/examples/smalltalk.java b/src/tinystruct/examples/smalltalk.java index daaa3a6..ab4bc4e 100644 --- a/src/tinystruct/examples/smalltalk.java +++ b/src/tinystruct/examples/smalltalk.java @@ -213,7 +213,8 @@ public String update() throws ApplicationException, IOException { public String update(String meetingCode, String sessionId) throws ApplicationException, IOException { String error = "{ \"error\": \"expired\" }"; if (this.meetings.containsKey(meetingCode)) { - if(sessions.get(meetingCode) != null && sessions.get(meetingCode).contains(sessionId)) { + List list; + if((list = sessions.get(meetingCode)) != null && list.contains(sessionId)) { return this.update(sessionId); } error = "{ \"error\": \"session-timeout\" }"; @@ -330,7 +331,7 @@ public void sessionDestroyed(HttpSessionEvent arg0) { Queue messages; List session_ids; - synchronized (this.meetings) { + synchronized (this.meetings) { if((session_ids = this.sessions.get(meetingCode)) != null) { session_ids.remove(arg0.getSession().getId()); } diff --git a/src/tinystruct/examples/talk.java b/src/tinystruct/examples/talk.java index 6897252..61b607e 100644 --- a/src/tinystruct/examples/talk.java +++ b/src/tinystruct/examples/talk.java @@ -125,11 +125,11 @@ public void run() { * @throws IOException */ public final String update(final String sessionId) throws ApplicationException, IOException { - Builder message = null; + Builder message; Queue messages; synchronized (this.list) { messages = this.list.get(sessionId); - while(messages != null && (message = messages.poll()) == null) { + while((message = messages.poll()) == null) { try { this.list.wait(TIMEOUT); } catch (InterruptedException e) { @@ -137,7 +137,7 @@ public final String update(final String sessionId) throws ApplicationException, } } - return message != null ? message.toString() : ""; + return message.toString(); } }