@Override public final ExecutionException remoteInvFailed(final Throwable cause) { final ExecutionException result = new ExecutionException(String.format(getLoggingLocale(), remoteInvFailed$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String oneWayInvocation = "EJBCLIENT000401: Result was discarded (one-way invocation)";
private static int findStackFrame(ExecutionException e, String clazz, String method) { StackTraceElement[] elements = e.getStackTrace(); for (int i = 0; i < elements.length; i++) { StackTraceElement element = elements[i]; if (element.getClassName().equals(clazz) && element.getMethodName().equals(method)) { return i; } } AssertionFailedError failure = new AssertionFailedError( "Expected element " + clazz + "." + method + " not found in stack trace"); failure.initCause(e); throw failure; }
@Override public final ExecutionException operationFailed(final Throwable cause) { final ExecutionException result = new ExecutionException(String.format(getLoggingLocale(), operationFailed$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotAddThread = "JBTHR00006: Unable to add new thread to the running set";
private void checkStackTrace(ExecutionException e) { // Our call site for get() should be in the trace. int index = findStackFrame(e, getClass().getName(), "getExpectingExecutionException"); assertThat(index).isNotEqualTo(0); // Above our method should be the call to get(). Don't assert on the class // because it could be some superclass. assertThat(e.getStackTrace()[index - 1].getMethodName()).isEqualTo("get"); }
private static ExecutionException filterTrace(ExecutionException e) { StackTraceElement[] withoutHere = filterTrace(e.getStackTrace()); e.setStackTrace(withoutHere); return e; }
@Override public final ExecutionException operationFailed(final Throwable cause) { final ExecutionException result = new ExecutionException(String.format(getLoggingLocale(), operationFailed$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotAddThread = "JBTHR00006: Unable to add new thread to the running set";
private static ExecutionException filterTrace(ExecutionException e) { StackTraceElement[] withoutHere = filterTrace(e.getStackTrace()); e.setStackTrace(withoutHere); return e; }
@Override public final ExecutionException remoteInvFailed(final Throwable cause) { final ExecutionException result = new ExecutionException(String.format(getLoggingLocale(), remoteInvFailed$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String oneWayInvocation = "EJBCLIENT000401: Result was discarded (one-way invocation)";
@Override public final ExecutionException operationFailed(final Throwable cause) { final ExecutionException result = new ExecutionException(String.format(getLoggingLocale(), operationFailed$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotAddThread = "JBTHR00006: Unable to add new thread to the running set";
private static ExecutionException filterTrace(ExecutionException e) { StackTraceElement[] withoutHere = filterTrace(e.getStackTrace()); e.setStackTrace(withoutHere); return e; }
@Override public final ExecutionException remoteInvFailed(final Throwable cause) { final ExecutionException result = new ExecutionException(String.format(getLoggingLocale(), remoteInvFailed$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String oneWayInvocation = "EJBCLIENT000401: Result was discarded (one-way invocation)";
private static ExecutionException filterTrace(ExecutionException e) { StackTraceElement[] withoutHere = filterTrace(e.getStackTrace()); e.setStackTrace(withoutHere); return e; }
private static ExecutionException filterTrace(ExecutionException e) { StackTraceElement[] withoutHere = filterTrace(e.getStackTrace()); e.setStackTrace(withoutHere); return e; }
private static ExecutionException filterTrace(ExecutionException e) { StackTraceElement[] withoutHere = filterTrace(e.getStackTrace()); e.setStackTrace(withoutHere); return e; }
private static int findStackFrame( ExecutionException e, String clazz, String method) { StackTraceElement[] elements = e.getStackTrace(); for (int i = 0; i < elements.length; i++) { StackTraceElement element = elements[i]; if (element.getClassName().equals(clazz) && element.getMethodName().equals(method)) { return i; } } AssertionFailedError failure = new AssertionFailedError("Expected element " + clazz + "." + method + " not found in stack trace"); failure.initCause(e); throw failure; }
private void checkStackTrace(ExecutionException e) { // Our call site for get() should be in the trace. int index = findStackFrame( e, getClass().getName(), "getExpectingExecutionException"); assertThat(index).isNotEqualTo(0); // Above our method should be the call to get(). Don't assert on the class // because it could be some superclass. assertThat(e.getStackTrace()[index - 1].getMethodName()).isEqualTo("get"); }