From: David ‘Bombe’ Roden Date: Thu, 12 Jun 2014 05:11:39 +0000 (+0200) Subject: Actually use the default values. X-Git-Tag: 0.9-rc1^2~3^2~241 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=23a5166d65ff22ea319799fe9b6ca86e27bf9c51;p=Sone.git Actually use the default values. 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). --- 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);