logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r510097 - in /logging/log4j/branches/v1_2-branch: src/java/org/apache/log4j/spi/ThrowableInformation.java tests/src/java/org/apache/log4j/spi/ThrowableInformationTest.java
Date Wed, 21 Feb 2007 16:51:41 GMT
Author: carnold
Date: Wed Feb 21 08:51:40 2007
New Revision: 510097

URL: http://svn.apache.org/viewvc?view=rev&rev=510097
Log:
Bug 35324: Stacktrace may choke on null fields

Modified:
    logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/spi/ThrowableInformation.java
    logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/spi/ThrowableInformationTest.java

Modified: logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/spi/ThrowableInformation.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/spi/ThrowableInformation.java?view=diff&rev=510097&r1=510096&r2=510097
==============================================================================
--- logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/spi/ThrowableInformation.java
(original)
+++ logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/spi/ThrowableInformation.java
Wed Feb 21 08:51:40 2007
@@ -65,10 +65,10 @@
 
 /**
   * VectorWriter is a seemingly trivial implemtantion of PrintWriter.
-  * The throwable instance that we are trying to represnt is asked to
+  * The throwable instance that we are trying to represent is asked to
   * print itself to a VectorWriter. 
   *
-  * By our design choice, r string representation of the throwable
+  * By our design choice, our string representation of the throwable
   * does not contain any line separators. It follows that println()
   * methods of VectorWriter ignore the 'ln' part.
   * */
@@ -82,7 +82,7 @@
   }
 
   public void print(Object o) {      
-    v.addElement(o.toString());
+    v.addElement(String.valueOf(o));
   }
   
   public void print(char[] chars) {
@@ -94,7 +94,7 @@
   }
 
   public void println(Object o) {      
-    v.addElement(o.toString());
+    v.addElement(String.valueOf(o));
   }
   
   // JDK 1.1.x apprenly uses this form of println while in

Modified: logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/spi/ThrowableInformationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/spi/ThrowableInformationTest.java?view=diff&rev=510097&r1=510096&r2=510097
==============================================================================
--- logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/spi/ThrowableInformationTest.java
(original)
+++ logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/spi/ThrowableInformationTest.java
Wed Feb 21 08:51:40 2007
@@ -176,12 +176,12 @@
 
     public void testNull() {
         ThrowableInformation ti = new ThrowableInformation(new NullThrowable());
-        try {
-            String[] rep = ti.getThrowableStrRep();
-        } catch (NullPointerException ex) {
-            return;
-        }
-        fail("log4j 1.2.14 would throw exception");
+        String[] rep = ti.getThrowableStrRep();
+        assertEquals(4, rep.length);
+        assertEquals(String.valueOf((Object) null), rep[0]);
+        assertNull(rep[1]);
+        assertEquals(String.valueOf((Object) null), rep[2]);
+        assertNull(rep[3]);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message