You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2013/05/30 11:31:04 UTC

git commit: Simplified/corrected the logic for counting the stack frames count as we used to overcharge 1 line extra (the first line) with the content of Throwable.toString() itself (which is NOT part of the call stack itself). Also fixed one CS violatio

Updated Branches:
  refs/heads/master 87b4e7024 -> 6678673cd


Simplified/corrected the logic for counting the stack frames count as we used to overcharge 1 line extra (the first line) with the content of Throwable.toString() itself (which is NOT part of the call stack itself). Also fixed one CS violation.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6678673c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6678673c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6678673c

Branch: refs/heads/master
Commit: 6678673cd625d191742273ad1b18b08f2d6bfc04
Parents: 87b4e70
Author: Babak Vahdat <bv...@apache.org>
Authored: Thu May 30 11:30:59 2013 +0200
Committer: Babak Vahdat <bv...@apache.org>
Committed: Thu May 30 11:30:59 2013 +0200

----------------------------------------------------------------------
 .../processor/validation/ValidatingProcessor.java  |   10 ++++---
 .../ReduceStacksNeededDuringRoutingTest.java       |   19 +-------------
 2 files changed, 8 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6678673c/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
index 2b2eee5..f2922bc 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
@@ -37,6 +37,11 @@ import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
+import org.w3c.dom.Node;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Exchange;
@@ -46,12 +51,9 @@ import org.apache.camel.TypeConverter;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.IOHelper;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.w3c.dom.Node;
-import org.w3c.dom.ls.LSResourceResolver;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
 
 /**
  * A processor which validates the XML version of the inbound message body

http://git-wip-us.apache.org/repos/asf/camel/blob/6678673c/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java b/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
index 3267459..0d6a770 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
@@ -16,10 +16,6 @@
  */
 package org.apache.camel.processor;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Scanner;
-
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -62,19 +58,8 @@ public class ReduceStacksNeededDuringRoutingTest extends ContextTestSupport {
                                 try {
                                     throw new IllegalArgumentException("Forced to dump stacktrace");
                                 } catch (Exception e) {
-                                    StringWriter sw = new StringWriter();
-                                    PrintWriter pw = new PrintWriter(sw);
-                                    e.printStackTrace(pw);
-
-                                    String s = sw.toString();
-                                    Scanner scanner = new Scanner(s);
-                                    scanner.useDelimiter("\n");
-                                    int count = 0;
-                                    while (scanner.hasNext()) {
-                                        scanner.next();
-                                        count++;
-                                    }
-                                    log.info("There is " + count + " lines in the stacktrace");
+                                    e.fillInStackTrace();
+                                    log.info("There are " + e.getStackTrace().length + " lines in the stacktrace");
                                     log.error("Dump stacktrace to log", e);
                                 }
                             }