From 35aeb7dde28426cb1b22c91d90444d95c22d4edc Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 8 Apr 2011 14:51:48 +0200 Subject: [PATCH] Allow a command to throw an exception. --- src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java | 4 +++- src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java index a4284aa..07fb7a4 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java @@ -39,8 +39,10 @@ public interface Command { * @param accessType * The access type * @return A reply to send back to the plugin + * @throws FcpException + * if an error processing the parameters occurs */ - public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType); + public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException; /** * The access type of the request. diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java index 3657f8f..de8718f 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java @@ -81,8 +81,8 @@ public class FcpInterface { /* TODO - return error? */ return; } - Reply reply = command.execute(parameters, data, AccessType.values()[accessType]); try { + Reply reply = command.execute(parameters, data, AccessType.values()[accessType]); SimpleFieldSet replyParameters = reply.getReplyParameters(); replyParameters.putOverwrite("Identifier", identifier); if (reply.hasData()) { @@ -92,6 +92,8 @@ public class FcpInterface { } else { pluginReplySender.send(replyParameters); } + } catch (FcpException fe1) { + /* TODO - log, report */ } catch (PluginNotFoundException pnfe1) { /* TODO - log */ } -- 2.7.4