@Override
    public Throwable getCause() { // NOPMD
        lock();
        try {
            if (cause == null) {
                final String separator = System.getProperty("line.separator");
                if (exceptions.size() > 1) {
                    final Map<Throwable, Boolean> seenCauses = new IdentityHashMap<>();

                    final StringBuilder aggregateMessage = new StringBuilder();
                    aggregateMessage.append("Multiple exceptions (").append(exceptions.size())
                                    .append(')').append(separator);

                    for (Throwable inner : exceptions) {
                        int depth = 0;
                        while (inner != null) {
                            final Class<? extends Throwable> innerClass = inner.getClass();
                            for (int i = 0; i < depth; i++) {
                                aggregateMessage.append("  ");
                            }
                            aggregateMessage.append("|-- ");
                            aggregateMessage.append(innerClass.getCanonicalName()).append(": ");
                            final String innerMessage = inner.getMessage();
                            final String messagePadding = Strings.repeat("  ", depth + 2);
                            if (innerMessage != null && innerMessage.contains(separator)) {
                                aggregateMessage.append(separator);
                                for (String line : innerMessage.split(separator)) {
                                    aggregateMessage.append(messagePadding).append(line).append(separator);
                                }
                            } else {
                                aggregateMessage.append(innerMessage);
                                aggregateMessage.append(separator);
                            }

                            final StackTraceElement[] st = inner.getStackTrace();
                            if (st.length > 0) {
                                final int maxStackTraceSize =
                                        isVerboseException ? st.length
                                                           : Math.min(DEFAULT_MAX_NUM_STACK_TRACES, st.length);
                                for (int i = 0; i < maxStackTraceSize; i++) {
                                    aggregateMessage.append(messagePadding).append("at ")
                                                    .append(st[i]).append(separator);
                                }
                            }

                            if (!seenCauses.containsKey(inner)) {
                                seenCauses.put(inner, true);

                                inner = inner.getCause();
                                depth++;
                            } else {
                                inner = inner.getCause();
                                if (inner != null) {
                                    aggregateMessage.append(messagePadding);
                                    aggregateMessage.append("|-- ");
                                    aggregateMessage.append("(cause not expanded again) ");
                                    aggregateMessage.append(inner.getClass().getCanonicalName()).append(": ");
                                    aggregateMessage.append(inner.getMessage());
                                    aggregateMessage.append(separator);
                                }
                                break;
                            }
                        }
                    }

                    cause = new ExceptionOverview(aggregateMessage.toString().trim());
                } else {
                    cause = exceptions.get(0);
                }
            }
            return cause;
        } finally {
            unlock();
        }
    }
Retrieves the list of exceptions that make up the {@code CompositeException}.

@return the exceptions that make up the {@code CompositeException},
        as a {@link List} of {@link Throwable}s
core/src/main/java/com/linecorp/armeria/common/util/CompositeException.java