X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FImageBrowserPage.java;h=ea039ca5d2404199d4e1a02baf62e1e2cc5cb2e0;hb=d5efb086bee8f103cbe90c7a953ffbb7ff27b689;hp=da48ec5d262265b9d3231ed62dd4dc59681a8fb8;hpb=2a42179827de132c990409999d7d7dd013d69d03;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index da48ec5..ea039ca 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -1,5 +1,5 @@ /* - * Sone - ImageBrowserPage.java - Copyright © 2011–2012 David Roden + * Sone - ImageBrowserPage.java - Copyright © 2011–2013 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,10 +27,12 @@ import net.pterodactylus.sone.data.Image; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.collection.Pagination; -import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; +import com.google.common.base.Optional; +import com.google.common.primitives.Ints; + /** * The image browser page is the entry page for the image management. * @@ -90,7 +92,7 @@ public class ImageBrowserPage extends SoneTemplatePage { albums.addAll(sone.getAllAlbums()); } Collections.sort(albums, Album.TITLE_COMPARATOR); - Pagination albumPagination = new Pagination(albums, 12).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0)); + Pagination albumPagination = new Pagination(albums, 12).setPage(Optional.fromNullable(Ints.tryParse(request.getHttpRequest().getParam("page"))).or(0)); templateContext.set("albumPagination", albumPagination); templateContext.set("albums", albumPagination.getItems()); return;