From 72fa147608d530a273c8165d2036e6fc1b8511a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 19 May 2008 08:39:42 +0000 Subject: [PATCH] add not-conncted exception git-svn-id: http://trooper/svn/projects/jFCPlib/branch/high-level-client@917 c3eda9e8-030b-0410-8277-bc7414b0a119 --- .../fcp/highlevel/HighLevelClient.java | 6 +-- .../fcp/highlevel/NotConnectedException.java | 54 ++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/net/pterodactylus/fcp/highlevel/NotConnectedException.java diff --git a/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java b/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java index e263454..14aa5f3 100644 --- a/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java +++ b/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java @@ -533,13 +533,13 @@ public class HighLevelClient { * Checks whether the client is already connected and throws an exception if * it is not. * - * @throws HighLevelException + * @throws NotConnectedException * if the client is not connected */ - private void checkConnection() throws HighLevelException { + private void checkConnection() throws NotConnectedException { synchronized (this) { if (fcpConnection == null) { - throw new HighLevelException("client is not connected"); + throw new NotConnectedException("client is not connected"); } } } diff --git a/src/net/pterodactylus/fcp/highlevel/NotConnectedException.java b/src/net/pterodactylus/fcp/highlevel/NotConnectedException.java new file mode 100644 index 0000000..9902591 --- /dev/null +++ b/src/net/pterodactylus/fcp/highlevel/NotConnectedException.java @@ -0,0 +1,54 @@ +/** + * + */ +package net.pterodactylus.fcp.highlevel; + +/** + * Exception that is thrown when an operation is tried on a not connected + * connection. + * + * @author David Roden + * @version $Id$ + */ +public class NotConnectedException extends HighLevelException { + + /** + * Creates a new not-connected exception. + */ + public NotConnectedException() { + super(); + } + + /** + * Creates a new not-connected exception with the given message. + * + * @param message + * The message of the exception + */ + public NotConnectedException(String message) { + super(message); + } + + /** + * Creates a new not-connected exception with the given cause. + * + * @param cause + * The cause of the exception + */ + public NotConnectedException(Throwable cause) { + super(cause); + } + + /** + * Creates a new not-connected exception with the given message and cause. + * + * @param message + * The message of the exception + * @param cause + * The cause of the exception + */ + public NotConnectedException(String message, Throwable cause) { + super(message, cause); + } + +} -- 2.7.4