Tassilo Horn <tass...@member.fsf.org> writes:

Hi again,

> Maybe the problem is that clj-stacktrace stumbles upon those names?
>
> But on the other hand: since *e contains the last exception and that
> is the divide by zero exception and not some exception from
> clj-stacktrace, this doesn't seem very likely...

Debugging a bit further I came to the conclusion that it's
clj-stacktrace's fault that errors with certain stack frames.

  (run* [q] (wrongo 1 2))
  ; Evaluation aborted.

  *e
  => #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

  (clj-stacktrace.core/parse-exception *e)
  ; Evaluation aborted.

  *e
  => #<NullPointerException java.lang.NullPointerException>

  (pst *e)
  NullPointerException 
  => nil

So while letting clj-stacktrace parse the ArithmeticException, an
NullPointerException was thrown.

By tracing the functions in clj-stacktrace.core (contained in
swank-clojure-1.3.4.jar) I was able to determine the throwing function
call inside clj-stacktrace.  The following call throws a
NullPointerException.

  (clojure-ns "clojure.core.logic.Substitutions")
  ; Evaluation aborted

The definition in the swank-clojure-1.3.4.jar is

(defn- clojure-ns
  "Returns the clojure namespace name implied by the bytecode class name."
  [class-name]
  (utils/re-gsub #"_" "-" (utils/re-get #"([^$]+)\$" class-name 1)))

For the given argument, the `re-get' form returns nil which causes the
null pointer.  It's simply not ready for getting the namespace of a
protocol.

I fixed the definition directly in the swank-clojure-1.3.4.jar and then
wanted to write a patch against clj-stacktrace's git master branch.  As
it turns out, it's already fixed in there.  Funnily, it was Phil himself
who committed that patch written by Michael van Acken.

Phil, maybe you want to release a new swank-clojure version with an
updated clj-stacktrace?

Bye,
Tassilo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to