Issue1684
Created on 2010年12月08日.13:05:04 by doublep, last changed 2020年05月27日.09:10:28 by doublep.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | Remove |
| test.java | doublep, 2010年12月08日.13:05:03 | short example demonstrating the problem | ||
| test2.java | doublep, 2010年12月09日.14:28:18 | propagating exception thrown in Java code: here cause is correctly set | ||
| Test.java | jeff.allen, 2018年03月17日.20:03:33 | Demonstration that getCause returns null | ||
| Messages | |||
|---|---|---|---|
| msg6274 (view) | Author: (doublep) | Date: 2010年12月08日.13:05:03 | |
The attached example demonstrates the problem. I have code that walks exception chain to "the real cause" to find out whether that cause should be reported as a user-level error (real_cause instanceof UserLevelException) or internal application bug. With exceptions raised from Jython code I cannot do this at the moment. |
|||
| msg6275 (view) | Author: (doublep) | Date: 2010年12月09日.14:28:18 | |
Actually, when exception is thrown by Java code and is wrapped by PyException for propagation, cause is set correctly. It seems the problem is there only when a Java exception is raised _directly_ from Python code, as in original example. |
|||
| msg11830 (view) | Author: Jeff Allen (jeff.allen) | Date: 2018年03月17日.20:03:33 | |
I explored this on 2.7.2a1 with a small adaptation of the provided test.java, attached, and the embedded cause is still null. Reproduce like this: PS bugs> javac -cp ".;C:\Jython2円.7.2a1\jython.jar;C:\Jython2円.7.2a1\javalib\*" .\iss1684\Test.java PS bugs> java -cp ".;C:\Jython2円.7.2a1\jython.jar;C:\Jython2円.7.2a1\javalib\*" iss1684.Test Traceback (most recent call last): File "<string>", line 2, in <module> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:211) java.lang.RuntimeException: java.lang.RuntimeException: Thrown from Python code Cause: null So we get the cause in the stack dump, but it isn't the cause in the Java sense, which seems a reasonable expectation. |
|||
| msg13068 (view) | Author: (doublep) | Date: 2020年05月27日.09:10:28 | |
Bump. Reproducible with 2.7.2. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020年05月27日 09:10:28 | doublep | set | messages: + msg13068 |
| 2018年03月17日 20:03:33 | jeff.allen | set | files:
+ Test.java resolution: accepted messages: + msg11830 nosy: + jeff.allen versions: + Jython 2.7 |
| 2013年02月26日 17:39:39 | fwierzbicki | set | priority: normal nosy: + fwierzbicki |
| 2013年02月19日 23:28:05 | fwierzbicki | set | versions: + Jython 2.5, - 2.5.1 |
| 2010年12月09日 14:28:18 | doublep | set | files:
+ test2.java messages: + msg6275 title: PyException raised from a Java exception doesn't have cause set -> PyException wrapper for a Java exception raised directly from Python code doesn't have cause set |
| 2010年12月08日 13:05:04 | doublep | create | |
Supported by Python Software Foundation,
Powered by Roundup