Update years in copyright line
[Sone.git] / src / main / java / net / pterodactylus / sone / fcp / LockSoneCommand.java
index 2a0c81a..287ec91 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - LockSoneCommand.java - Copyright © 2013 David Roden
+ * Sone - LockSoneCommand.java - Copyright © 2013–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
@@ -25,6 +25,8 @@ import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import freenet.support.api.Bucket;
 
+import com.google.common.base.Optional;
+
 /**
  * Implements the “LockSone” FCP command. If a valid local Sone was given as
  * parameter “Sone,” this command will always lock the Sone and reply with
@@ -50,9 +52,9 @@ public class LockSoneCommand extends AbstractSoneCommand {
 
        @Override
        public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
-               Sone sone = getSone(parameters, "Sone", true, true);
-               getCore().lockSone(sone);
-               return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.getId()).get());
+               Optional<Sone> sone = getSone(parameters, "Sone", true, true);
+               getCore().lockSone(sone.get());
+               return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get());
        }
 
 }