Java Code Examples for org.gradle.util.TextUtil#indent()
The following examples show how to use
org.gradle.util.TextUtil#indent() .
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: FullExceptionFormatter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void printException(TestDescriptor descriptor, Throwable exception, @Nullable List<StackTraceElement> parentTrace, int exceptionLevel, StringBuilder builder) { String exceptionIndent = Strings.repeat(INDENT, exceptionLevel + 1); String exceptionText = exceptionLevel == 0 ? exception.toString() : "\nCaused by:\n" + exception.toString(); String indentedText = TextUtil.indent(exceptionText, exceptionIndent); builder.append(indentedText); builder.append('\n'); String stackTraceIndent = exceptionIndent + INDENT; List<StackTraceElement> stackTrace = null; if (testLogging.getShowStackTraces()) { stackTrace = filterStackTrace(exception, descriptor); int commonElements = countCommonElements(stackTrace, parentTrace); for (int i = 0; i < stackTrace.size() - commonElements; i++) { builder.append(stackTraceIndent); builder.append("at "); builder.append(stackTrace.get(i)); builder.append('\n'); } if (commonElements != 0) { builder.append(stackTraceIndent); builder.append("... "); builder.append(commonElements); builder.append(" more"); builder.append('\n'); } } if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), stackTrace, exceptionLevel + 1, builder); } }
Example 2
Source File: FullExceptionFormatter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void printException(TestDescriptor descriptor, Throwable exception, @Nullable List<StackTraceElement> parentTrace, int exceptionLevel, StringBuilder builder) { String exceptionIndent = Strings.repeat(INDENT, exceptionLevel + 1); String exceptionText = exceptionLevel == 0 ? exception.toString() : "\nCaused by:\n" + exception.toString(); String indentedText = TextUtil.indent(exceptionText, exceptionIndent); builder.append(indentedText); builder.append('\n'); String stackTraceIndent = exceptionIndent + INDENT; List<StackTraceElement> stackTrace = null; if (testLogging.getShowStackTraces()) { stackTrace = filterStackTrace(exception, descriptor); int commonElements = countCommonElements(stackTrace, parentTrace); for (int i = 0; i < stackTrace.size() - commonElements; i++) { builder.append(stackTraceIndent); builder.append("at "); builder.append(stackTrace.get(i)); builder.append('\n'); } if (commonElements != 0) { builder.append(stackTraceIndent); builder.append("... "); builder.append(commonElements); builder.append(" more"); builder.append('\n'); } } if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), stackTrace, exceptionLevel + 1, builder); } }
Example 3
Source File: FullExceptionFormatter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void printException(TestDescriptor descriptor, Throwable exception, @Nullable List<StackTraceElement> parentTrace, int exceptionLevel, StringBuilder builder) { String exceptionIndent = Strings.repeat(INDENT, exceptionLevel + 1); String exceptionText = exceptionLevel == 0 ? exception.toString() : "\nCaused by:\n" + exception.toString(); String indentedText = TextUtil.indent(exceptionText, exceptionIndent); builder.append(indentedText); builder.append('\n'); String stackTraceIndent = exceptionIndent + INDENT; List<StackTraceElement> stackTrace = null; if (testLogging.getShowStackTraces()) { stackTrace = filterStackTrace(exception, descriptor); int commonElements = countCommonElements(stackTrace, parentTrace); for (int i = 0; i < stackTrace.size() - commonElements; i++) { builder.append(stackTraceIndent); builder.append("at "); builder.append(stackTrace.get(i)); builder.append('\n'); } if (commonElements != 0) { builder.append(stackTraceIndent); builder.append("... "); builder.append(commonElements); builder.append(" more"); builder.append('\n'); } } if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), stackTrace, exceptionLevel + 1, builder); } }
Example 4
Source File: FullExceptionFormatter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void printException(TestDescriptor descriptor, Throwable exception, @Nullable List<StackTraceElement> parentTrace, int exceptionLevel, StringBuilder builder) { String exceptionIndent = Strings.repeat(INDENT, exceptionLevel + 1); String exceptionText = exceptionLevel == 0 ? exception.toString() : "\nCaused by:\n" + exception.toString(); String indentedText = TextUtil.indent(exceptionText, exceptionIndent); builder.append(indentedText); builder.append('\n'); String stackTraceIndent = exceptionIndent + INDENT; List<StackTraceElement> stackTrace = null; if (testLogging.getShowStackTraces()) { stackTrace = filterStackTrace(exception, descriptor); int commonElements = countCommonElements(stackTrace, parentTrace); for (int i = 0; i < stackTrace.size() - commonElements; i++) { builder.append(stackTraceIndent); builder.append("at "); builder.append(stackTrace.get(i)); builder.append('\n'); } if (commonElements != 0) { builder.append(stackTraceIndent); builder.append("... "); builder.append(commonElements); builder.append(" more"); builder.append('\n'); } } if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), stackTrace, exceptionLevel + 1, builder); } }