@Test public void testToString() throws Exception { SofaRpcException exception = new SofaRpcException(RpcErrorType.SERVER_BUSY, "111"); String string = ExceptionUtils.toString(exception); Assert.assertNotNull(string); Pattern pattern = Pattern.compile("at"); Matcher matcher = pattern.matcher(string); int count = 0; while (matcher.find()) { count++; } Assert.assertTrue(count > 1); }
public static String toString(Throwable e) { StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\n"); if (traces != null) { for (StackTraceElement trace : traces) { sb.append("\tat ").append(trace).append("\n"); } } return sb.toString(); }
ExceptionUtils { public static String toString(Throwable e) { StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\n"); if (traces != null) { for (StackTraceElement trace : traces) { sb.append("\tat ").append(trace).append("\n"); } } return sb.toString(); } }
ExceptionUtils { public static String toString(Throwable e) { StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\n"); if (traces != null) { for (StackTraceElement trace : traces) { sb.append("\tat ").append(trace).append("\n"); } } return sb.toString(); }  }
ExceptionUtils { public static String toString(Throwable e) { StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\n"); if (traces != null) { for (StackTraceElement trace : traces) { sb.append("\tat ").append(trace).append("\n"); } } return sb.toString(); }  static SofaRpcRuntimeException buildRuntime(String configKey, String configValue); static SofaRpcRuntimeException buildRuntime(String configKey, String configValue, String message); static boolean isServerException(SofaRpcException exception); static boolean isClientException(SofaRpcException exception); static String toString(Throwable e); static String toShortString(Throwable e, int stackLevel); }
ExceptionUtils { public static String toString(Throwable e) { StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\n"); if (traces != null) { for (StackTraceElement trace : traces) { sb.append("\tat ").append(trace).append("\n"); } } return sb.toString(); }  static SofaRpcRuntimeException buildRuntime(String configKey, String configValue); static SofaRpcRuntimeException buildRuntime(String configKey, String configValue, String message); static boolean isServerException(SofaRpcException exception); static boolean isClientException(SofaRpcException exception); static String toString(Throwable e); static String toShortString(Throwable e, int stackLevel);  }