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

brooklyn.util.exceptions.CompoundRuntimeException Maven / Gradle / Ivy

Go to download

Utility classes and methods developed for Brooklyn but not dependendent on Brooklyn or much else

There is a newer version: 0.7.0-M1
Show newest version
package brooklyn.util.exceptions;

import java.util.Collections;
import java.util.List;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;

public class CompoundRuntimeException extends RuntimeException {

    private static final long serialVersionUID = 6110995537064639587L;

    private final List causes;

    public CompoundRuntimeException(String message) {
        super(message);
        this.causes = Collections.emptyList();
    }

    public CompoundRuntimeException(String message, Throwable cause) {
        super(message, cause);
        this.causes = (cause == null) ? Collections.emptyList() : Collections.singletonList(cause);
    }

    public CompoundRuntimeException(Throwable cause) {
        super(cause);
        this.causes = (cause == null) ? Collections.emptyList() : Collections.singletonList(cause);
    }

    public CompoundRuntimeException(String message, Iterable causes) {
        super(message, (Iterables.isEmpty(causes) ? null : Iterables.get(causes, 0)));
        this.causes = ImmutableList.copyOf(causes);
    }

    public List getAllCauses() {
        return causes;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy