mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
04.59.2013 18dbe39207dd1162f50aac5e55ff3d0425db448a
Minor naming update for StaticUtils#stackTraceToSingleLineString methods
2 files modified
17 ■■■■ changed files
opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java 13 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java
@@ -1823,15 +1823,15 @@
     *
     * @param throwable
     *            The exception for which to retrieve the stack trace.
     * @param isDebug
     * @param isFullStack
     *            If {@code true}, provides the full stack trace, otherwise
     *            provides a limited extract of stack trace
     * @return A stack trace from the provided exception as a single-line
     *         string.
     */
    public static String stackTraceToSingleLineString(Throwable throwable, boolean isDebug) {
    public static String stackTraceToSingleLineString(Throwable throwable, boolean isFullStack) {
        StringBuilder buffer = new StringBuilder();
        stackTraceToSingleLineString(buffer, throwable, isDebug);
        stackTraceToSingleLineString(buffer, throwable, isFullStack);
        return buffer.toString();
    }
@@ -1844,15 +1844,15 @@
     *            The buffer to which the information is to be appended.
     * @param throwable
     *            The exception for which to retrieve the stack trace.
     * @param isDebug
     * @param isFullStack
     *            If {@code true}, provides the full stack trace, otherwise
     *            provides a limited extract of stack trace
     */
    public static void stackTraceToSingleLineString(StringBuilder buffer, Throwable throwable, boolean isDebug) {
    public static void stackTraceToSingleLineString(StringBuilder buffer, Throwable throwable, boolean isFullStack) {
        if (throwable == null) {
            return;
        }
        if (isDebug) {
        if (isFullStack) {
            buffer.append(throwable);
            // add first-level stack trace
            for (StackTraceElement e : throwable.getStackTrace()) {
@@ -1906,6 +1906,7 @@
                buffer.append(e.getLineNumber());
                i++;
            }
            buffer.append(")");
        }
    }
opendj-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java
@@ -198,7 +198,7 @@
    }
    @Test
    public void testStackTraceToSingleLineDebugIsFalse() throws Exception {
    public void testStackTraceToSingleLineLimitedStack() throws Exception {
        String trace = stackTraceToSingleLineString(
                new InvocationTargetException(new RuntimeException("message")), false);
        assertThat(trace).as("case 1").startsWith("message (StaticUtilsTestCase.java");
@@ -214,7 +214,7 @@
    }
    @Test
    public void testStackTraceToSingleLineDebugIsTrue() throws Exception {
    public void testStackTraceToSingleLineFullStack() throws Exception {
        String trace = stackTraceToSingleLineString(
                new InvocationTargetException(new RuntimeException("message")), true);
        assertThat(trace).as("case 1").startsWith(