Log4j - WriteAppender is throwing a nullpointerexception when the first throwableinformation's stacktrace element is null. Have Log4j write a "null" string instead of throwing an excpetion.
Can you provide a piece of code that shows this behaviour?
Here is a test case public void testThrowableCause() throws Exception { // hack for 1.4 Field f = PlatformInfo.class.getDeclaredField("hasStackTraceElement"); f.setAccessible(true); f.set(null, new Integer(0)); assertEquals(false, PlatformInfo.hasStackTraceElement()); Throwable t = new Throwable("Freedom") { public String getNextException() { return "cheese"; } public void printStackTrace(PrintWriter pw) { pw.println((Object)null); pw.print((Object)null); } }; ThrowableInformation ti = new ThrowableInformation(t); String s[] = ti.getThrowableStrRep(); for (int i = 0; i < s.length; i++) System.out.println(s[i]); } The second "print" causes this.
*** This bug has been marked as a duplicate of 35234 ***
(Duplicate of 35324, not 35234)
*** This bug has been marked as a duplicate of 35324 ***