X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=library%2FRemoteLibraryException.java;h=ff40960c58a4b24e93771c777f722e1378514e2b;hb=HEAD;hp=4cbb631cb3b0e916ae112b9148769e554c31ae93;hpb=5f3671e17febc5b7f6abbfc62c66c4045d47ec8d;p=nikiroo-utils.git diff --git a/library/RemoteLibraryException.java b/library/RemoteLibraryException.java deleted file mode 100644 index 4cbb631..0000000 --- a/library/RemoteLibraryException.java +++ /dev/null @@ -1,100 +0,0 @@ -package be.nikiroo.fanfix.library; - -import java.io.IOException; - -/** - * Exceptions sent from remote to local. - * - * @author niki - */ -public class RemoteLibraryException extends IOException { - private static final long serialVersionUID = 1L; - - private boolean wrapped; - - @SuppressWarnings("unused") - private RemoteLibraryException() { - // for serialization purposes - } - - /** - * Wrap an {@link IOException} to allow it to pass across the network. - * - * @param cause - * the exception to wrap - * @param remote - * this exception is used to send the contained - * {@link IOException} to the other end of the network - */ - public RemoteLibraryException(IOException cause, boolean remote) { - this(null, cause, remote); - } - - /** - * Wrap an {@link IOException} to allow it to pass across the network. - * - * @param message - * the error message - * @param wrapped - * this exception is used to send the contained - * {@link IOException} to the other end of the network - */ - public RemoteLibraryException(String message, boolean wrapped) { - this(message, null, wrapped); - } - - /** - * Wrap an {@link IOException} to allow it to pass across the network. - * - * @param message - * the error message - * @param cause - * the exception to wrap - * @param wrapped - * this exception is used to send the contained - * {@link IOException} to the other end of the network - */ - public RemoteLibraryException(String message, IOException cause, - boolean wrapped) { - super(message, cause); - this.wrapped = wrapped; - } - - /** - * Return the actual exception we should return to the client code. It can - * be: - * - * It is never NULL. - * - * @return the unwrapped exception or this, never NULL - */ - public synchronized IOException unwrapException() { - Throwable ex = super.getCause(); - if (!isWrapped() || !(ex instanceof IOException)) { - ex = this; - } - - return (IOException) ex; - } - - /** - * This exception is used to send the contained {@link IOException} to the - * other end of the network. - *

- * In other words, do not use this exception in client code when it - * has reached the other end of the network, but use its cause instead (see - * {@link RemoteLibraryException#unwrapException()}). - * - * @return TRUE if it is - */ - public boolean isWrapped() { - return wrapped; - } -}