Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: Release 1.3
-
Fix Version/s: Release 1.4
-
Component/s: None
-
Labels:None
-
Patch:Code and Test
-
Approval:Ok
Description
Expressions passed to try that trigger the use of clojure.lang.Reflector result in their thrown checked exceptions being wrapped in RuntimeException. As a result, the subsequent set of catches won't switch on the expected checked exception.
Attached: patch for regression test that exposes the problem
(defn- get-exception [expression]
(try (eval expression)
nil
(catch java.lang.Throwable t
t)))
(deftest catch-receives-checked-exception
(are [expression expected-exception] (= expected-exception
(type (get-exception expression)))
"Eh, I'm pretty safe" nil
'(java.io.FileReader. "CAFEBABEx0/idonotexist") java.io.FileNotFoundException)) ; fails
Clojure ML Thread: https://groups.google.com/forum/#!topic/clojure/I5l1YHVMgkI/discussion
Introduced: https://github.com/clojure/clojure/commit/8fda34e4c77cac079b711da59d5fe49b74605553
Attachments
Activity
Ben Smith-Mannschott
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
Expressions passed to try that trigger the use of clojure.lang.Reflector result in their thrown checked exceptions being wrapped in RuntimeException. As a result, the subsequent set of catches won't switch on the expected checked exception.
Attached: patch for regression test that exposes the problem (defn- get-exception [expression] (try (eval expression) nil (catch java.lang.Throwable t t))) (deftest catch-receives-checked-exception (are [expression expected-exception] (= expected-exception (type (get-exception expression))) "Eh, I'm pretty safe" nil '(java.io.FileReader. "CAFEBABEx0/idonotexist") java.io.FileNotFoundException)) ; fails Clojure ML Thread: https://groups.google.com/forum/#!topic/clojure/I5l1YHVMgkI/discussion Introduced: https://github.com/clojure/clojure/commit/8fda34e4c77cac079b711da59d5fe49b74605553 |
Expressions passed to try that trigger the use of clojure.lang.Reflector result in their thrown checked exceptions being wrapped in RuntimeException. As a result, the subsequent set of catches won't switch on the expected checked exception.
Attached: patch for regression test that exposes the problem {code:none} (defn- get-exception [expression] (try (eval expression) nil (catch java.lang.Throwable t t))) (deftest catch-receives-checked-exception (are [expression expected-exception] (= expected-exception (type (get-exception expression))) "Eh, I'm pretty safe" nil '(java.io.FileReader. "CAFEBABEx0/idonotexist") java.io.FileNotFoundException)) ; fails {code} Clojure ML Thread: https://groups.google.com/forum/#!topic/clojure/I5l1YHVMgkI/discussion Introduced: https://github.com/clojure/clojure/commit/8fda34e4c77cac079b711da59d5fe49b74605553 |
Ben Smith-Mannschott
made changes -
| Attachment | 0001-CLJ-855-RFC-solution-using-specific-RTE-subclass-and.patch [ 10383 ] |
Herwig Hochleitner
made changes -
| Attachment | CLJ-855_throw_undeclared_checked.patch [ 10384 ] |
Paul Michael Bauer
made changes -
| Waiting On | stuart.sierra |
Ben Smith-Mannschott
made changes -
| Attachment |
0001- |
Ben Smith-Mannschott
made changes -
| Attachment | CLJ-855-try-unwraps.patch [ 10390 ] |
Ben Smith-Mannschott
made changes -
| Attachment | CLJ-855-sneaky-throw.patch [ 10395 ] |
Ben Smith-Mannschott
made changes -
| Assignee | Ben Smith-Mannschott [ bsmith.occs@gmail.com ] | |
| Patch | Code and Test [ 10002 ] |
Rich Hickey
made changes -
| Resolution | Completed [ 1 ] | |
| Fix Version/s | Backlog [ 10035 ] | |
| Fix Version/s | Release 1.4 [ 10040 ] | |
| Approval | Ok [ 10007 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Stuart Halloway
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
(marked up code snippet in description to display as code.)