Actually allow the Sone to be missing in getOptionalSone().
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 4 Nov 2013 20:51:32 +0000 (21:51 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:52 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java

index a66fdae..62d6a53 100644 (file)
@@ -119,8 +119,8 @@ public abstract class AbstractSoneCommand extends AbstractCommand {
        }
 
        protected Optional<Sone> getOptionalSone(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
-               String soneId = getMandatoryParameter(simpleFieldSet, parameterName);
-               return core.getSone(soneId);
+               String soneId = getString(simpleFieldSet, parameterName, null);
+               return (soneId == null) ? Optional.<Sone>absent() : core.getSone(soneId);
        }
 
        protected Sone getMandatoryLocalSone(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {