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

NPE on certain types of exception table entries #15

Open
gfredericks opened this issue Nov 14, 2018 · 0 comments
Open

NPE on certain types of exception table entries #15

gfredericks opened this issue Nov 14, 2018 · 0 comments

Comments

@gfredericks
Copy link

I'm not sure under what circumstances this occurs, and couldn't get an easy-to-reproduce case, but I was decompiling something produced by the clojure compiler (one of the init classes for a namespace, I think), and got an NPE on this line.

The javadoc for IExceptionTableEntry says "Returns the catch type name, null if getCatchTypeIndex() returns 0. This is the case for any exception handler"; which is a bit confusing, but I think it might mean "this is the case for an exception handler with catch-type "any"", which is the exact string printed by javap -c for this class.

So this is my workaround, but I'm not a dentist so I can't say confidently that it's correct:

(extend-protocol no.disassemble.r/Coerce
  org.eclipse.jdt.core.util.IExceptionTableEntry
  (coerce [e]
    {:start-pc   (.getStartPC e)
     :end-pc     (.getEndPC e)
     :handler-pc (.getHandlerPC e)
     :catch-type (if-let [bytes (.getCatchType e)]
                   (String. bytes)
                   "java/lang/Throwable")}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant