All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kiwiproject.base.UncheckedInterruptedException Maven / Gradle / Ivy

Go to download

Kiwi is a utility library. We really like Google's Guava, and also use Apache Commons. But if they don't have something we need, and we think it is useful, this is where we put it.

There is a newer version: 4.4.0
Show newest version
package org.kiwiproject.base;

import static java.util.Objects.requireNonNull;

/**
 * Wraps an {@link InterruptedException} with an unchecked exception. Basically, copied Java's
 * {@link java.io.UncheckedIOException}, renamed it, and modified it.
 */
public class UncheckedInterruptedException extends RuntimeException {

    /**
     * Constructs an instance of this class.
     *
     * @param message the detail message, can be null
     * @param cause   the {@code InterruptedException}
     * @throws NullPointerException if the cause is {@code null}
     */
    public UncheckedInterruptedException(String message, InterruptedException cause) {
        super(message, requireNonNull(cause, "cause cannot be null"));
    }

    /**
     * Constructs an instance of this class.
     *
     * @param cause the {@code InterruptedException}
     * @throws NullPointerException if the cause is {@code null}
     */
    public UncheckedInterruptedException(InterruptedException cause) {
        super(requireNonNull(cause, "cause cannot be null"));
    }

    /**
     * Returns the cause of this exception.
     *
     * @return the {@link InterruptedException} which is the cause of this exception
     */
    @Override
    public synchronized InterruptedException getCause() {
        return (InterruptedException) super.getCause();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy