X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FRescuePage.java;h=8599a3198051c987e2dca4b36676fe859fbccb10;hp=feeb0bf0c6457c46661ab99f07021594b92e26ac;hb=419098bcd6215125408b29e60bd888e60979d37b;hpb=d5efb086bee8f103cbe90c7a953ffbb7ff27b689 diff --git a/src/main/java/net/pterodactylus/sone/web/RescuePage.java b/src/main/java/net/pterodactylus/sone/web/RescuePage.java index feeb0bf..8599a31 100644 --- a/src/main/java/net/pterodactylus/sone/web/RescuePage.java +++ b/src/main/java/net/pterodactylus/sone/web/RescuePage.java @@ -1,5 +1,5 @@ /* - * Sone - RescuePage.java - Copyright © 2011–2013 David Roden + * Sone - RescuePage.java - Copyright © 2011–2015 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 @@ -17,6 +17,8 @@ package net.pterodactylus.sone.web; +import static net.pterodactylus.sone.utils.NumberParsers.parseLong; + import net.pterodactylus.sone.core.SoneRescuer; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.FreenetRequest; @@ -24,9 +26,6 @@ import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; import net.pterodactylus.util.web.Method; -import com.google.common.base.Optional; -import com.google.common.primitives.Longs; - /** * Page that lets the user control the rescue mode for a Sone. * @@ -61,7 +60,7 @@ public class RescuePage extends SoneTemplatePage { SoneRescuer soneRescuer = webInterface.getCore().getSoneRescuer(currentSone); if (request.getMethod() == Method.POST) { if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("fetch", 4))) { - long edition = Optional.fromNullable(Longs.tryParse(request.getHttpRequest().getPartAsStringFailsafe("edition", 8))).or(-1L); + long edition = parseLong(request.getHttpRequest().getPartAsStringFailsafe("edition", 8), -1L); if (edition > -1) { soneRescuer.setEdition(edition); }