Example usage for java.lang IllegalStateException addSuppressed

List of usage examples for java.lang IllegalStateException addSuppressed

Introduction

In this page you can find the example usage for java.lang IllegalStateException 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:org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.java

@Override
public void close() throws ResourceException {
    if (managedConnection == null) {
        IllegalStateException error = new IllegalStateException("connection already closed " + this);
        error.addSuppressed(closeTrace);
        throw error;
    }//  w w  w.  j  a  v a  2s.  c o  m
    try {
        managedConnection.close(this);
    } finally {
        closeTrace = new Throwable("close stack trace");
        managedConnection = null;
    }
}