Example usage for java.lang IllegalArgumentException addSuppressed

List of usage examples for java.lang IllegalArgumentException addSuppressed

Introduction

In this page you can find the example usage for java.lang IllegalArgumentException addSuppressed.

Prototype

public final synchronized void addSuppressed(Throwable exception) 

Source Link

Document

Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.

Usage

From source file:fi.jumi.core.api.StackTraceTest.java

@Test
public void creating_a_StackTrace_is_idempotent() {
    IllegalArgumentException original = new IllegalArgumentException("original message",
            new NullPointerException("cause message"));
    original.addSuppressed(new IOException("suppressed 1"));

    StackTrace st1 = StackTrace.from(original);
    StackTrace st2 = StackTrace.from(st1);

    assertThat(st2.getExceptionClass(), is(st1.getExceptionClass()));
    assertTrue(EqualsBuilder.reflectionEquals(st1, st2));
}

From source file:org.nuxeo.runtime.jtajca.NuxeoConnectionManagerFactory.java

public static NuxeoConnectionManagerConfiguration getConfig(Reference ref) {
    NuxeoConnectionManagerConfiguration config = new NuxeoConnectionManagerConfiguration();
    IllegalArgumentException errors = new IllegalArgumentException("wrong naming config");
    for (RefAddr addr : Collections.list(ref.getAll())) {
        String name = addr.getType();
        String value = (String) addr.getContent();
        try {//  w  w  w  .j  a va 2s .  co  m
            BeanUtils.setProperty(config, name, value);
        } catch (ReflectiveOperationException cause) {
            errors.addSuppressed(cause);
        }
    }
    if (errors.getSuppressed().length > 0) {
        throw errors;
    }
    return config;
}