Example usage for java.lang AbstractMethodError getStackTrace

List of usage examples for java.lang AbstractMethodError getStackTrace

Introduction

In this page you can find the example usage for java.lang AbstractMethodError getStackTrace.

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

Provides programmatic access to the stack trace information printed by #printStackTrace() .

Usage

From source file:org.ofbiz.core.entity.transaction.DBCPConnectionFactory.java

@VisibleForTesting
static boolean checkIfProblemMayBeCausedByIsValidMethod(final BasicDataSource dataSource,
        final AbstractMethodError error) {
    final String validationQuery = dataSource.getValidationQuery();
    if (validationQuery == null || validationQuery.isEmpty()) {
        final List<StackTraceElement> stackTraceElements = Lists.newArrayList(error.getStackTrace());
        return stackTraceElements.stream()
                .anyMatch(stackTraceElement -> stackTraceElement.getMethodName().contains("isValid"));
    }//  w  w w.  j  a  v a2s .  c  om
    return false;
}