[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.24-29-gf0ffd80

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Logback: the generic, reliable, fast and flexible logging framework.". The branch, master has been updated via f0ffd80fe1f4230a9d7fa2d21b64f49738e73a9d (commit) from 7480e3375fa4b7e22c3c5a96bf56867b48ce46bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=f0ffd80fe1f4230a9d7fa2d21... http://github.com/ceki/logback/commit/f0ffd80fe1f4230a9d7fa2d21b64f49738e73a... commit f0ffd80fe1f4230a9d7fa2d21b64f49738e73a9d Author: Ceki Gulcu <ceki@qos.ch> Date: Wed Oct 13 20:51:14 2010 +0200 fixed LBCLASSIC-216 diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java index be8dc67..964ca59 100644 --- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java @@ -39,6 +39,9 @@ public class ThrowableProxyUtil { } static StackTraceElementProxy[] steArrayToStepArray(StackTraceElement[] stea) { + if(stea == null) { + return new StackTraceElementProxy[0]; + } StackTraceElementProxy[] stepa = new StackTraceElementProxy[stea.length]; for (int i = 0; i < stepa.length; i++) { stepa[i] = new StackTraceElementProxy(stea[i]); @@ -48,7 +51,7 @@ public class ThrowableProxyUtil { static int findNumberOfCommonFrames(StackTraceElement[] steArray, StackTraceElementProxy[] parentSTEPArray) { - if (parentSTEPArray == null) { + if (parentSTEPArray == null || steArray == null) { return 0; } diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java index d0fc89e..ea39a8b 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java @@ -39,12 +39,12 @@ public class ThrowableProxyTest { t.printStackTrace(pw); IThrowableProxy tp = new ThrowableProxy(t); - + String result = ThrowableProxyUtil.asString(tp); result = result.replace("common frames omitted", "more"); - + String expected = sw.toString(); - + System.out.println("========expected"); System.out.println(expected); @@ -71,6 +71,26 @@ public class ThrowableProxyTest { verify(w); } + // see also http://jira.qos.ch/browse/LBCLASSIC-216 + @Test + public void nullSTE() { + Throwable t = new Exception("someMethodWithNullException") { + @Override + public StackTraceElement[] getStackTrace() { + return null; + } + }; + // we can't test output as Throwable.printStackTrace method uses + // the private getOurStackTrace method instead of getStackTrace + + // tests ThrowableProxyUtil.steArrayToStepArray + new ThrowableProxy(t); + + // tests ThrowableProxyUtil.findNumberOfCommonFrames + Exception top = new Exception("top", t); + new ThrowableProxy(top); + } + @Test public void multiNested() { Exception w = null; @@ -86,6 +106,15 @@ public class ThrowableProxyTest { throw new Exception("someMethod"); } + void someMethodWithNullException() throws Exception { + throw new Exception("someMethodWithNullException") { + @Override + public StackTraceElement[] getStackTrace() { + return null; + } + }; + } + void someOtherMethod() throws Exception { try { someMethod(); diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html index 63a3e51..46a126c 100644 --- a/logback-site/src/site/pages/news.html +++ b/logback-site/src/site/pages/news.html @@ -44,6 +44,7 @@ <a href="manual/configuration.html#variableSubstitution">variable substitution</a>, thus fixing <a href="http://jira.qos.ch/browse/LBCLASSIC-224">LBCLASSIC-224</a> as reported by David Harrigan. + </p> <hr width="80%" align="center" /> ----------------------------------------------------------------------- Summary of changes: .../logback/classic/spi/ThrowableProxyUtil.java | 5 ++- .../logback/classic/spi/ThrowableProxyTest.java | 35 ++++++++++++++++++-- logback-site/src/site/pages/news.html | 1 + 3 files changed, 37 insertions(+), 4 deletions(-) hooks/post-receive -- Logback: the generic, reliable, fast and flexible logging framework.
participants (1)
-
git-noreply@pixie.qos.ch