qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject qpid-proton git commit: added a workaround for jython's inability to display the java portions of stack traces
Date Mon, 02 Feb 2015 14:02:26 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 571cd4196 -> cdd154297


added a workaround for jython's inability to display the java portions of stack traces


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cdd15429
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cdd15429
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cdd15429

Branch: refs/heads/master
Commit: cdd1542972871816e043694ebb87329e41ba5a54
Parents: 571cd41
Author: Rafael Schloming <rhs@alum.mit.edu>
Authored: Mon Feb 2 09:02:18 2015 -0500
Committer: Rafael Schloming <rhs@alum.mit.edu>
Committed: Mon Feb 2 09:02:18 2015 -0500

----------------------------------------------------------------------
 tests/python/proton-test | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd15429/tests/python/proton-test
----------------------------------------------------------------------
diff --git a/tests/python/proton-test b/tests/python/proton-test
index 5efabfd..66113dc 100755
--- a/tests/python/proton-test
+++ b/tests/python/proton-test
@@ -70,6 +70,9 @@ parser.add_option("-b", "--bare", action="store_true", default=False,
                   help="Run bare, i.e. don't capture stack traces. This is useful under Jython
as " +
                   "captured stack traces do not include the Java portion of the stack," +
                   "whereas non captured stack traces do.")
+parser.add_option("-j", "--javatrace", action="store_true", default=False,
+                  help="Show the full java stack trace. This disables heuristics to eliminate
the " +
+                  "jython portion of java stack traces.")
 
 class Config:
 
@@ -375,7 +378,24 @@ class Runner:
         output = indent("".join(traceback.format_exception_only(*self.exception[:2]))).rstrip()
       else:
         output = "Error during %s:" % self.exception_phase_name
-        output += indent("".join(traceback.format_exception(*self.exception))).rstrip()
+        lines = traceback.format_exception(*self.exception)
+        val = self.exception[1]
+        reflect = False
+        if val and hasattr(val, "getStackTrace"):
+          jlines = []
+          for frame in val.getStackTrace():
+            if reflect and frame.getClassName().startswith("org.python."):
+              # this is a heuristic to eliminate the jython portion of
+              # the java stack trace
+              if not opts.javatrace:
+                break
+            jlines.append("  %s\n" % frame.toString())
+            if frame.getClassName().startswith("java.lang.reflect"):
+              reflect = True
+            else:
+              reflect = False
+          lines.extend(jlines)
+        output += indent("".join(lines)).rstrip()
       return output
 
   def get_exception_type(self):


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message