Java Code Examples for java.util.NoSuchElementException#getCause()

The following examples show how to use java.util.NoSuchElementException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Pool.java    From seppb with MIT License 5 votes vote down vote up
public T getResource() {
    try {
        return internalPool.borrowObject();
    } catch (NoSuchElementException nse) {
        if (null == nse.getCause()) {
            throw new SeppServerException(
                    "Could not get a resource since the pool is exhausted", nse);
        }
        throw new SeppServerException("Could not get a resource from the pool", nse);
    } catch (Exception e) {
        throw new SeppServerException("Could not get a resource from the pool", e);
    }
}