From 23a5166d65ff22ea319799fe9b6ca86e27bf9c51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 12 Jun 2014 07:11:39 +0200 Subject: [PATCH] Actually use the default values. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit getParam(String) returns a default value of "" and not null so the previous detection of “no value is set” was actually never working, and the default in the web interface was the default used by the browser (i.e. the first element). --- src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java index f476bbb..beda638 100644 --- a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java +++ b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java @@ -66,11 +66,11 @@ public class KnownSonesPage extends SoneTemplatePage { @Override protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); - String sortField = request.getHttpRequest().getParam("sort"); - String sortOrder = request.getHttpRequest().getParam("order"); + String sortField = request.getHttpRequest().getParam("sort", defaultSortField); + String sortOrder = request.getHttpRequest().getParam("order", defaultSortOrder); String filter = request.getHttpRequest().getParam("filter"); - templateContext.set("sort", (sortField != null) ? sortField : defaultSortField); - templateContext.set("order", (sortOrder != null) ? sortOrder : defaultSortOrder); + templateContext.set("sort", sortField); + templateContext.set("order", sortOrder); templateContext.set("filter", filter); final Sone currentSone = getCurrentSone(request.getToadletContext(), false); Collection knownSones = Collections2.filter(webInterface.getCore().getSones(), Sone.EMPTY_SONE_FILTER); -- 2.7.4