brooklyn.util.exceptions.CompoundRuntimeException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-utils-common Show documentation
Show all versions of brooklyn-utils-common Show documentation
Utility classes and methods developed for Brooklyn but not dependendent on Brooklyn or much else
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 extends Throwable> causes) {
super(message, (Iterables.isEmpty(causes) ? null : Iterables.get(causes, 0)));
this.causes = ImmutableList.copyOf(causes);
}
public List getAllCauses() {
return causes;
}
}