Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbalanced parens cause NullPointerException #178

Open
yayitswei opened this issue Jan 25, 2013 · 2 comments
Open

Unbalanced parens cause NullPointerException #178

yayitswei opened this issue Jan 25, 2013 · 2 comments

Comments

@yayitswei
Copy link

Sometimes unbalanced parens cause the "lein-cljsbuild auto" process to crash with an NPE, and I have to restart the process.

(on $body :click :#a nil
    (fn [e]
      (log "test";;)
      )
    )

yields

wei:papyrus wei$ lein cljsbuild auto main-prod template-prod
Compiling ClojureScript.
Compiling "../app/assets/javascripts/bin/template.js" from ["src/cljs-template"]...
* Notification delivered.
Compiling "../app/assets/javascripts/bin/template.js" failed.
Exception in thread "main" java.lang.NullPointerException
    at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
    at java.util.regex.Matcher.reset(Matcher.java:291)
    at java.util.regex.Matcher.<init>(Matcher.java:211)
    at java.util.regex.Pattern.matcher(Pattern.java:888)
    at clj_stacktrace.utils$re_gsub.invoke(utils.clj:6)
    at clj_stacktrace.core$clojure_ns.invoke(core.clj:14)
    at clj_stacktrace.core$parse_trace_elem.invoke(core.clj:68)
    at clojure.core$map$fn__4087.invoke(core.clj:2434)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:587)
    at clojure.core$next.invoke(core.clj:64)
    at clojure.core$reduce1.invoke(core.clj:880)
    at clojure.core$reverse.invoke(core.clj:888)
@emezeske
Copy link
Owner

Hmm, lein-cljsbuild definitely catches all compiler errors, so those shouldn't cause the auto process to stop. I guess what's happening here (from the stack trace) is that clj-stacktrace (which lein-cljsbuild uses to pretty-print stack traces, with color, etc) is crashing when lein-cljsbuild tries to print the unmatched-parens exception. Bleh!

I checked to see if clj-stacktrace has a newer version out, but the latest that I see is 0.2.5, which is what lein-cljsbuild depends on right now.

I don't see any open bug reports for clj-stacktrace that seem related to this problem. Maybe you could open one?

If I have some time later this week, I can get the exact contents of the exception that clj-stacktrace is crashing while trying to print, which might be helpful to debug clj-stacktrace.

@yayitswei
Copy link
Author

Thanks for the quick response and good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants