Always use the current session to prevent timeouts.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Nov 2010 15:07:06 +0000 (16:07 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Nov 2010 15:07:06 +0000 (16:07 +0100)
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java

index c556314..ae3dfc2 100644 (file)
@@ -22,6 +22,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -62,7 +63,10 @@ public class GetStatusAjaxPage extends JsonPage {
        protected JsonObject createJsonObject(Request request) {
                /* load Sones. */
                boolean loadAllSones = Boolean.parseBoolean(request.getHttpRequest().getParam("loadAllSones", "true"));
-               Set<Sone> sones = loadAllSones ? webInterface.getCore().getSones() : Collections.singleton(getCurrentSone(request.getToadletContext()));
+               Set<Sone> sones = new HashSet<Sone>(Collections.singleton(getCurrentSone(request.getToadletContext())));
+               if (loadAllSones) {
+                       sones.addAll(webInterface.getCore().getSones());
+               }
                JsonArray jsonSones = new JsonArray();
                for (Sone sone : sones) {
                        JsonObject jsonSone = createJsonSone(sone);