[logback-dev] svn commit: r2175 - in logback/trunk/logback-classic/src: main/java/ch/qos/logback/classic/db main/java/ch/qos/logback/classic/html main/java/ch/qos/logback/classic/log4j main/java/ch/qos/logback/classic/net main/java/ch/qos/logback/classic/pattern main/java/ch/qos/logback/classic/spi test/java/ch/qos/logback/classic/db test/java/ch/qos/logback/classic/html test/java/ch/qos/logback/classic/spi test/java/ch/qos/logback/classic/spi/special

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Feb 27 18:21:48 CET 2009


Author: ceki
Date: Fri Feb 27 18:21:48 2009
New Revision: 2175

Removed:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableDataPoint.java
Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicCPDCTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java

Log:
Removed ThrowableDataPoint class as, in light of recent ThrowableProxy refactoring, it 
had become an empty shell around StackTraceElementProxy.

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java	Fri Feb 27 18:21:48 2009
@@ -21,7 +21,7 @@
 
 import ch.qos.logback.classic.spi.CallerData;
 import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.core.db.DBAppenderBase;
 
 /**
@@ -92,7 +92,7 @@
     insertProperties(mergedMap, connection, eventId);
 
     if (event.getThrowableProxy() != null) {
-      insertThrowable(event.getThrowableProxy().getThrowableDataPointArray(), connection, eventId);
+      insertThrowable(event.getThrowableProxy().getStackTraceElementProxyArray(), connection, eventId);
     }
   }
 
@@ -176,16 +176,16 @@
     }
   }
   
-  protected void insertThrowable(ThrowableDataPoint[] tdpArray, Connection connection,
+  protected void insertThrowable(StackTraceElementProxy[] stepArray, Connection connection,
       int eventId) throws SQLException {
 
     PreparedStatement insertExceptionStatement = connection
         .prepareStatement(insertExceptionSQL);
 
-    for (short i = 0; i < tdpArray.length; i++) {
+    for (short i = 0; i < stepArray.length; i++) {
       insertExceptionStatement.setInt(1, eventId);
       insertExceptionStatement.setShort(2, i);
-      insertExceptionStatement.setString(3, tdpArray[i].toString());
+      insertExceptionStatement.setString(3, stepArray[i].toString());
       if (cnxSupportsBatchUpdates) {
         insertExceptionStatement.addBatch();
       } else {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java	Fri Feb 27 18:21:48 2009
@@ -11,7 +11,7 @@
 
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.IThrowableProxy;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.classic.spi.ThrowableProxyUtil;
 import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.helpers.Transform;
@@ -30,12 +30,12 @@
     sbuf.append(Transform.escapeTags(firstLine.toString()));
     
     int commonFrames = tp.getCommonFrames();
-    ThrowableDataPoint[] tdpa = tp.getThrowableDataPointArray();
+    StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
     
-    for (int i = 0; i < tdpa.length - commonFrames; i++) {
-      ThrowableDataPoint tdp = tdpa[i];
+    for (int i = 0; i < stepArray.length - commonFrames; i++) {
+      StackTraceElementProxy step = stepArray[i];
       sbuf.append(TRACE_PREFIX);
-      sbuf.append(Transform.escapeTags(tdp.toString()));
+      sbuf.append(Transform.escapeTags(step.toString()));
       sbuf.append(CoreConstants.LINE_SEPARATOR);
     }
     

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java	Fri Feb 27 18:21:48 2009
@@ -16,7 +16,7 @@
 import ch.qos.logback.classic.spi.CallerData;
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.IThrowableProxy;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.core.LayoutBase;
 import ch.qos.logback.core.helpers.Transform;
 
@@ -125,10 +125,10 @@
 
     IThrowableProxy tp = event.getThrowableProxy();
     if (tp != null) {
-      ThrowableDataPoint[] tdpArray = tp.getThrowableDataPointArray();
+      StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
       buf.append("  <log4j:throwable><![CDATA[");
-      for (ThrowableDataPoint tdp : tdpArray) {
-        buf.append(tdp.toString());
+      for (StackTraceElementProxy step : stepArray) {
+        buf.append(step.toString());
         buf.append("\r\n");
       }
       buf.append("]]></log4j:throwable>\r\n");

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java	Fri Feb 27 18:21:48 2009
@@ -15,7 +15,7 @@
 import ch.qos.logback.classic.pattern.SyslogStartConverter;
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.IThrowableProxy;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.classic.util.LevelToSyslogSeverity;
 import ch.qos.logback.core.Layout;
 import ch.qos.logback.core.net.SyslogAppenderBase;
@@ -77,10 +77,10 @@
 
     IThrowableProxy tp = event.getThrowableProxy();
     while (tp != null) {
-      ThrowableDataPoint[] strRep = tp.getThrowableDataPointArray();
+      StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
       try {
-        for (ThrowableDataPoint line : strRep) {
-          sw.write(prefix + line.toString());
+        for (StackTraceElementProxy step : stepArray) {
+          sw.write(prefix + step.toString());
           sw.flush();
         }
       } catch (IOException e) {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java	Fri Feb 27 18:21:48 2009
@@ -12,14 +12,12 @@
 import ch.qos.logback.classic.spi.ClassPackagingData;
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.StackTraceElementProxy;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
 
 public class ExtendedThrowableProxyConverter extends ThrowableProxyConverter {
 
   @Override
-  protected void extraData(StringBuilder builder, ThrowableDataPoint tdp) {
+  protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
 
-    StackTraceElementProxy step = tdp.getStackTraceElementProxy();
     if (step != null) {
       ClassPackagingData pi = step.getClassPackagingData();
       if (pi != null) {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java	Fri Feb 27 18:21:48 2009
@@ -15,7 +15,7 @@
 
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.IThrowableProxy;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.classic.spi.ThrowableProxyUtil;
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.CoreConstants;
@@ -88,7 +88,7 @@
     super.stop();
   }
 
-  protected void extraData(StringBuilder builder, ThrowableDataPoint tdp) {
+  protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
     // nop
   }
 
@@ -142,11 +142,11 @@
   void printThrowableProxy(StringBuilder buf, IThrowableProxy tp) {
     ThrowableProxyUtil.printFirstLine(buf, tp);
 
-    ThrowableDataPoint[] tdpArray = tp.getThrowableDataPointArray();
+    StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
     int commonFrames = tp.getCommonFrames();
 
-    boolean unrestrictedPrinting = lengthOption > tdpArray.length;
-    int length = (unrestrictedPrinting) ? tdpArray.length : lengthOption;
+    boolean unrestrictedPrinting = lengthOption > stepArray.length;
+    int length = (unrestrictedPrinting) ? stepArray.length : lengthOption;
 
 
     int maxIndex = length;
@@ -155,9 +155,9 @@
     }
 
     for (int i = 0; i < maxIndex; i++) {
-      String string = tdpArray[i].toString();
+      String string = stepArray[i].toString();
       buf.append(string);
-      extraData(buf, tdpArray[i]); // allow other data to be added
+      extraData(buf, stepArray[i]); // allow other data to be added
       buf.append(CoreConstants.LINE_SEPARATOR);
     }
 

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java	Fri Feb 27 18:21:48 2009
@@ -13,8 +13,7 @@
 
 public class ClassPackagingData implements Serializable {
 
-  private static final long serialVersionUID = 637783570208674312L;
-
+  private static final long serialVersionUID = -804643281218337001L;
   final String codeLocation;
   final String version;
   private final boolean exact;

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java	Fri Feb 27 18:21:48 2009
@@ -10,14 +10,9 @@
 package ch.qos.logback.classic.spi;
 
 public interface IThrowableProxy {
-
   public String getMessage();
   public String getClassName();
-  /**
-   * The data point representation of the throwable proxy.
-   */
-  public ThrowableDataPoint[] getThrowableDataPointArray();
+  public StackTraceElementProxy[] getStackTraceElementProxyArray();
   public int getCommonFrames();
   public IThrowableProxy getCause();
-
 }
\ No newline at end of file

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java	Fri Feb 27 18:21:48 2009
@@ -11,11 +11,8 @@
 
 import java.net.URL;
 import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
 
 import sun.reflect.Reflection;
-import ch.qos.logback.classic.spi.ThrowableDataPoint.ThrowableDataPointType;
 
 /**
  * 
@@ -52,14 +49,11 @@
   public PackagingDataCalculator() {
   }
 
-  public void calculate(ThrowableDataPoint[] tdpArray) {
-    int steStart = 0;
-    StackTraceElementProxy[] stepArray = new StackTraceElementProxy[0];
-    do {
-      steStart = findSTEStartIndex(tdpArray, steStart + stepArray.length);
-      stepArray = getSTEPArray(tdpArray, steStart);
-      populateFrames(stepArray);
-    } while (steStart != -1);
+  public void calculate(IThrowableProxy tp) {
+    while(tp != null) {
+      populateFrames(tp.getStackTraceElementProxyArray());
+      tp = tp.getCause();
+    } 
   }
 
   void populateFrames(StackTraceElementProxy[] stepArray) {
@@ -101,38 +95,6 @@
     populateUncommonFrames(commonFrames, stepArray, firsExactClassLoader);
   }
 
-  int findSTEStartIndex(final ThrowableDataPoint[] tdpArray, final int from) {
-    final int len = tdpArray.length;
-    if (from < 0 || from >= len) {
-      return -1;
-    }
-    for (int i = from; i < len; i++) {
-      if (tdpArray[i].type == ThrowableDataPointType.STEP) {
-        return i;
-      }
-    }
-    return -1;
-  }
-
-  private StackTraceElementProxy[] getSTEPArray(
-      final ThrowableDataPoint[] tdpArray, final int from) {
-    List<StackTraceElementProxy> stepList = new LinkedList<StackTraceElementProxy>();
-    int len = tdpArray.length;
-    if (from < 0 || from >= len) {
-      return stepList.toArray(STEP_ARRAY_TEMPLATE);
-    }
-    for (int i = from; i < len; i++) {
-      final ThrowableDataPoint tdp = tdpArray[i];
-
-      if (tdp.type == ThrowableDataPointType.STEP) {
-        stepList.add(tdp.getStackTraceElementProxy());
-      } else {
-        break;
-      }
-    }
-    return stepList.toArray(STEP_ARRAY_TEMPLATE);
-  }
-
   void populateUncommonFrames(int commonFrames,
       StackTraceElementProxy[] stepArray, ClassLoader firstExactClassLoader) {
     int uncommonFrames = stepArray.length - commonFrames;

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java	Fri Feb 27 18:21:48 2009
@@ -4,15 +4,15 @@
 
 public class StackTraceElementProxy implements Serializable {
 
-  private static final long serialVersionUID = -4832130320500439038L;
-
+  private static final long serialVersionUID = -2374374378980555982L;
+  
   final StackTraceElement ste;
   // save a byte or two during serialization, as we can
   // reconstruct this field from 'ste'
   transient private String steAsString;
   private ClassPackagingData cpd;
 
-  StackTraceElementProxy(StackTraceElement ste) {
+  public StackTraceElementProxy(StackTraceElement ste) {
     if (ste == null) {
       throw new IllegalArgumentException("ste cannot be null");
     }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java	Fri Feb 27 18:21:48 2009
@@ -9,8 +9,6 @@
  */
 package ch.qos.logback.classic.spi;
 
-import java.util.Arrays;
-
 import ch.qos.logback.core.CoreConstants;
 
 public class ThrowableProxy implements IThrowableProxy {
@@ -18,7 +16,7 @@
   Throwable throwable;
   String className;
   String message;
-  ThrowableDataPoint[] throwableDataPointArray;
+  StackTraceElementProxy[] stackTraceElementProxyArray;
   int commonFrames;
   ThrowableProxy cause;
 
@@ -30,7 +28,7 @@
     this.throwable = throwable;
     this.className = throwable.getClass().getName();
     this.message = throwable.getMessage();
-    this.throwableDataPointArray = ThrowableProxyUtil.stea2tdpa(throwable
+    this.stackTraceElementProxyArray = ThrowableProxyUtil.steArrayToStepArray(throwable
         .getStackTrace());
     
     Throwable nested = throwable.getCause();
@@ -39,7 +37,7 @@
       this.cause = new ThrowableProxy(nested);
       this.cause.commonFrames = ThrowableProxyUtil
           .findNumberOfCommonFrames(nested.getStackTrace(),
-              throwableDataPointArray);
+              stackTraceElementProxyArray);
     }
   }
 
@@ -61,13 +59,8 @@
     return className;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see ch.qos.logback.classic.spi.IThrowableProxy#getThrowableDataPointArray()
-   */
-  public ThrowableDataPoint[] getThrowableDataPointArray() {
-    return throwableDataPointArray;
+  public StackTraceElementProxy[] getStackTraceElementProxyArray() {
+    return stackTraceElementProxyArray;
   }
 
   public int getCommonFrames() {
@@ -100,45 +93,24 @@
     PackagingDataCalculator pdc = this.getPackagingDataCalculator();
     if (pdc != null) {
       calculatedPackageData = true;
-      pdc.calculate(throwableDataPointArray);
+      pdc.calculate(this);
     }
   }
 
-  @Override
-  public int hashCode() {
-    final int PRIME = 31;
-    int result = 1;
-    result = PRIME * result + Arrays.hashCode(throwableDataPointArray);
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (obj == null)
-      return false;
-    if (getClass() != obj.getClass())
-      return false;
-    final ThrowableProxy other = (ThrowableProxy) obj;
-    if (!Arrays.equals(throwableDataPointArray, other.throwableDataPointArray))
-      return false;
-    return true;
-  }
+
 
   public void fullDump() {
     StringBuilder builder = new StringBuilder();
-    for (ThrowableDataPoint tdp : getThrowableDataPointArray()) {
-      String string = tdp.toString();
+    for (StackTraceElementProxy step : stackTraceElementProxyArray) {
+      String string = step.toString();
       builder.append(string);
-      extraData(builder, tdp);
+      extraData(builder, step);
       builder.append(CoreConstants.LINE_SEPARATOR);
     }
     System.out.println(builder.toString());
   }
 
-  protected void extraData(StringBuilder builder, ThrowableDataPoint tdp) {
-    StackTraceElementProxy step = tdp.getStackTraceElementProxy();
+  protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
     if (step != null) {
       ClassPackagingData cpd = step.getClassPackagingData();
       if (cpd != null) {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java	Fri Feb 27 18:21:48 2009
@@ -20,7 +20,7 @@
  */
 public class ThrowableProxyUtil {
 
-  static final ThrowableDataPoint[] TEMPLATE_ARRAY = new ThrowableDataPoint[0];
+  //static final ThrowableDataPoint[] TEMPLATE_ARRAY = new ThrowableDataPoint[0];
 
   static public void build(ThrowableProxy nestedTP, Throwable nestedThrowable,
       ThrowableProxy parentTP) {
@@ -30,33 +30,33 @@
     int commonFramesCount = -1;
     if (parentTP != null) {
       commonFramesCount = findNumberOfCommonFrames(nestedSTE, parentTP
-          .getThrowableDataPointArray());
+          .getStackTraceElementProxyArray());
     }
 
     nestedTP.commonFrames = commonFramesCount;
-    nestedTP.throwableDataPointArray = stea2tdpa(nestedSTE);
+    nestedTP.stackTraceElementProxyArray = steArrayToStepArray(nestedSTE);
   }
 
-  static ThrowableDataPoint[] stea2tdpa(StackTraceElement[] stea) {
-    ThrowableDataPoint[] tdpa = new ThrowableDataPoint[stea.length];
-    for (int i = 0; i < tdpa.length; i++) {
-      tdpa[i] = new ThrowableDataPoint(stea[i]);
+  static StackTraceElementProxy[] steArrayToStepArray(StackTraceElement[] stea) {
+    StackTraceElementProxy[] stepa = new StackTraceElementProxy[stea.length];
+    for (int i = 0; i < stepa.length; i++) {
+      stepa[i] = new StackTraceElementProxy(stea[i]);
     }
-    return tdpa;
+    return stepa;
   }
 
   static int findNumberOfCommonFrames(StackTraceElement[] steArray,
-      ThrowableDataPoint[] parentTDPA) {
-    if (parentTDPA == null) {
+      StackTraceElementProxy[] parentSTEPArray) {
+    if (parentSTEPArray == null) {
       return 0;
     }
 
     int steIndex = steArray.length - 1;
-    int parentIndex = parentTDPA.length - 1;
+    int parentIndex = parentSTEPArray.length - 1;
     int count = 0;
     while (steIndex >= 0 && parentIndex >= 0) {
       StackTraceElement ste = steArray[steIndex];
-      StackTraceElement otherSte = parentTDPA[parentIndex].step.ste;
+      StackTraceElement otherSte = parentSTEPArray[parentIndex].ste;
       if (ste.equals(otherSte)) {
         count++;
       } else {
@@ -74,19 +74,19 @@
     while (tp != null) {
      
       printFirstLine(sb, tp);
-      printTDP(sb, tp);
+      printSTEPArray(sb, tp);
       tp = tp.getCause();
     }
     return sb.toString();
 
   }
 
-  static public void printTDP(StringBuilder sb, IThrowableProxy tp) {
-    ThrowableDataPoint[] tdpa = tp.getThrowableDataPointArray();
+  static public void printSTEPArray(StringBuilder sb, IThrowableProxy tp) {
+    StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
     int commonFrames = tp.getCommonFrames();
-    for (int i = 0; i < tdpa.length - commonFrames; i++) {
-      ThrowableDataPoint tdp = tdpa[i];
-      sb.append(tdp.toString()).append(CoreConstants.LINE_SEPARATOR);
+    for (int i = 0; i < stepArray.length - commonFrames; i++) {
+      StackTraceElementProxy step = stepArray[i];
+      sb.append(step.toString()).append(CoreConstants.LINE_SEPARATOR);
     }
     
     if (commonFrames > 0) {
@@ -94,7 +94,6 @@
           .append(CoreConstants.LINE_SEPARATOR);
     }
     
-    
   }
 
   static public void printFirstLine(StringBuilder sb, IThrowableProxy tp) {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java	Fri Feb 27 18:21:48 2009
@@ -19,7 +19,7 @@
   private String className;
   private String message;
   private int commonFramesCount;
-  private ThrowableDataPoint[] throwableDataPointArray;
+  private StackTraceElementProxy[] stackTraceElementProxyArray;
   private IThrowableProxy cause;
 
 
@@ -39,8 +39,8 @@
     return cause;
   }
   
-  public ThrowableDataPoint[] getThrowableDataPointArray() {
-    return throwableDataPointArray;
+  public StackTraceElementProxy[] getStackTraceElementProxyArray() {
+    return stackTraceElementProxyArray;
   }
 
   @Override
@@ -68,7 +68,7 @@
     } else if (!className.equals(other.className))
       return false;
 
-    if (!Arrays.equals(throwableDataPointArray, other.throwableDataPointArray))
+    if (!Arrays.equals(stackTraceElementProxyArray, other.stackTraceElementProxyArray))
       return false;
     
     if (cause == null) {
@@ -88,7 +88,7 @@
     tpvo.className = throwableProxy.getClassName();
     tpvo.message = throwableProxy.getMessage();
     tpvo.commonFramesCount = throwableProxy.getCommonFrames();
-    tpvo.throwableDataPointArray = throwableProxy.getThrowableDataPointArray();
+    tpvo.stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
     if(throwableProxy.getCause() != null) {
       tpvo.cause = ThrowableProxyVO.build(throwableProxy.getCause());
     }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java	Fri Feb 27 18:21:48 2009
@@ -108,7 +108,7 @@
     rs = stmt.executeQuery("SELECT * FROM logging_event_exception where event_id = 0");
     int i = 0;
     while (rs.next()) {
-      assertEquals(event.getThrowableProxy().getThrowableDataPointArray()[i].toString(), rs.getString(3));
+      assertEquals(event.getThrowableProxy().getStackTraceElementProxyArray()[i].toString(), rs.getString(3));
       i++;
     }
     

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java	Fri Feb 27 18:21:48 2009
@@ -25,7 +25,7 @@
 import ch.qos.logback.classic.spi.DummyThrowableProxy;
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.classic.spi.ThrowableDataPoint;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.classic.spi.ThrowableProxy;
 import ch.qos.logback.classic.util.TeztConstants;
 import ch.qos.logback.core.CoreConstants;
@@ -104,9 +104,9 @@
     StackTraceElement ste1 = new StackTraceElement("c1", "m1", "f1", 1);
     StackTraceElement ste2 = new StackTraceElement("c2", "m2", "f2", 2);
     
-    ThrowableDataPoint[] strArray = { new ThrowableDataPoint(ste1),
-        new ThrowableDataPoint(ste2) };
-    tp.setThrowableDataPointArray(strArray);
+    StackTraceElementProxy[] stepArray = { new StackTraceElementProxy(ste1),
+        new StackTraceElementProxy(ste2) };
+    tp.setStackTraceElementProxyArray(stepArray);
     DefaultThrowableRenderer renderer = (DefaultThrowableRenderer) layout
         .getThrowableRenderer();
 

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicCPDCTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicCPDCTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicCPDCTest.java	Fri Feb 27 18:21:48 2009
@@ -20,9 +20,8 @@
   public void tearDown() throws Exception {
   }
 
-  public void verify(ThrowableDataPoint[] tdpArray) {
-    for (ThrowableDataPoint tdp : tdpArray) {
-      StackTraceElementProxy step = tdp.getStackTraceElementProxy();
+  public void verify(ThrowableProxy tp) {
+    for (StackTraceElementProxy step : tp.getStackTraceElementProxyArray()) {
       if (step != null) {
         assertNotNull(step.getClassPackagingData());
       }
@@ -34,37 +33,18 @@
     System.out.println(SystemInfo.getJavaVendor());
   }
 
-//  @Test
-//  public void withGreenMail() {
-//    try {
-//      ServerSetup serverSetup = new ServerSetup(-1, "localhost",
-//          ServerSetup.PROTOCOL_SMTP);
-//      GreenMail greenMail = new GreenMail((ServerSetup) null);
-//      // greenMail.start();
-//    } catch (Throwable e) {
-//      ThrowableProxy tp = new ThrowableProxy(e);
-//      ClassPackagingDataCalculator cpdc = tp.getClassPackagingDataCalculator();
-//      ThrowableDataPoint[] tdpArray = tp.getThrowableDataPointArray();
-//      cpdc.calculate(tdpArray);
-//      verify(tdpArray);
-//      tp.fullDump();
-//    }
-//  }
-  
- 
   @Test
   public void integration() throws Exception {
-  
+
   }
-  
+
   @Test
   public void smoke() throws Exception {
     Throwable t = new Throwable("x");
     ThrowableProxy tp = new ThrowableProxy(t);
     PackagingDataCalculator pdc = tp.getPackagingDataCalculator();
-    ThrowableDataPoint[] tdpArray = tp.getThrowableDataPointArray();
-    pdc.calculate(tdpArray);
-    verify(tdpArray);
+    pdc.calculate(tp);
+    verify(tp);
     tp.fullDump();
   }
 
@@ -73,9 +53,8 @@
     Throwable t = TeztHelper.makeNestedException(3);
     ThrowableProxy tp = new ThrowableProxy(t);
     PackagingDataCalculator pdc = tp.getPackagingDataCalculator();
-    ThrowableDataPoint[] tdpArray = tp.getThrowableDataPointArray();
-    pdc.calculate(tdpArray);
-    verify(tdpArray);
+    pdc.calculate(tp);
+    verify(tp);
   }
 
   public void doCalculateClassPackagingData(
@@ -85,10 +64,8 @@
     } catch (Throwable e) {
       ThrowableProxy tp = new ThrowableProxy(e);
       if (withClassPackagingCalculation) {
-        PackagingDataCalculator pdc = tp
-            .getPackagingDataCalculator();
-        ThrowableDataPoint[] tdpArray = tp.getThrowableDataPointArray();
-        pdc.calculate(tdpArray);
+        PackagingDataCalculator pdc = tp.getPackagingDataCalculator();
+        pdc.calculate(tp);
       }
     }
   }
@@ -113,16 +90,15 @@
     double d1 = loop(len, true);
     System.out.println("with    packaging info " + d1 + " microseconds");
 
-    int slackFactor = 8;  
+    int slackFactor = 8;
     if (!SystemInfo.getJavaVendor().contains("Sun")) {
       // be more lenient with other JDKs
       slackFactor = 10;
-    } 
-    assertTrue(
-        "computing class packaging data ("
-            + d1
-            + ") should have been less than "+slackFactor+" times the time it takes to process an exception "
-            + (d0 * slackFactor), d0 * slackFactor > d1);
+    }
+    assertTrue("computing class packaging data (" + d1
+        + ") should have been less than " + slackFactor
+        + " times the time it takes to process an exception "
+        + (d0 * slackFactor), d0 * slackFactor > d1);
 
   }
 }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java	Fri Feb 27 18:21:48 2009
@@ -5,7 +5,7 @@
   private String className;
   private String message;
   private int commonFramesCount;
-  private ThrowableDataPoint[] throwableDataPointArray;
+  private StackTraceElementProxy[] stackTraceElementProxyArray;
   private IThrowableProxy cause;
   
 
@@ -28,14 +28,13 @@
     this.commonFramesCount = commonFramesCount;
   }
 
-  public ThrowableDataPoint[] getThrowableDataPointArray() {
-    return throwableDataPointArray;
+  public StackTraceElementProxy[] getStackTraceElementProxyArray() {
+    return stackTraceElementProxyArray;
   }
-  public void setThrowableDataPointArray(
-      ThrowableDataPoint[] throwableDataPointArray) {
-    this.throwableDataPointArray = throwableDataPointArray;
+  public void setStackTraceElementProxyArray(
+      StackTraceElementProxy[] stackTraceElementProxyArray) {
+    this.stackTraceElementProxyArray = stackTraceElementProxyArray;
   }
-  
   public IThrowableProxy getCause() {
     return cause;
   }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java	Fri Feb 27 18:21:48 2009
@@ -20,7 +20,7 @@
     throwable = new Throwable("x");
     throwableProxy = new ThrowableProxy(throwable);
     PackagingDataCalculator pdc = new PackagingDataCalculator();
-    pdc.calculate(throwableProxy.getThrowableDataPointArray());
+    pdc.calculate(throwableProxy);
   }
   
   public Throwable getThrowable() {


More information about the logback-dev mailing list