|
From: <php...@li...> - 2009-09-24 14:15:19
|
> a the log on the Java side. Or via last_exception_get(), which returns the first exception not cleared via last_exception_clear(). > Are my assumptions correct Yes, correct. If you add a throw java_last_exception_get(); java_last_exception_clear(); at the bottom of your try/catch block, you will receive all exceptions with their stack traces from the back end. The only problem is that the current Java.inc turns all undeclared exceptions into fatal errors (see checkResult() in java_ThrowExceptionProxyFactory) and that java_last_exception is currently deprecated. Regards, Jost Boekemeier On Sep 24, 2009 3:21 PM, <php...@li...> wrote: Jost Bekemeier wrote: > I think you'll have to bite the bullet and always throw checked > exceptions... Ok, I'll look into that as well. My main issue with this is that almost all of what I'm going to be dealing with are Java beans that are persisted via Hibernate. I'm going to be reading and setting properties mainly. The problem is that Hibernate backs the properties with persistent collections that throw several unchecked exceptions. Adding checked exception declarations to all of these getters and setters is going to have a horrible ripple effect in our existing code. It may be that what I am intending to do just isn't workable. Let me make sure I understand the danger of using the unchecked exceptions. I've seen you say that if an unchecked exception is thrown the behavior is undefined. Meaning that in some cases it might work "as expected", and the exception will be thrown on the PHP side. But in other cases the method that threw the exception will return it instead of throwing it, and the code will continue to execute. Is this correct? If so, this may not be a problem for me anyway. I am not attempting to catch unchecked exceptions in order to control the flow of the application. In all cases, if an unchecked exception is thrown, I merely want to log it and display an error message to the end user. Since I'm mainly navigating object graphs and chaining method calls, my code will still fail quickly after an unchecked exception is thrown and ignored. I will end up trying to call a method on what was returned and the method will not exist, and the execution will stop anyway. It seems to me that the worst case scenario will be that the exception or error on the PHP side will not be useful in determining what went wrong. In that case I could determine the source of the problem via the log on the Java side. Are my assumptions correct? Jost Bekemeier wrote: >> Would you mind explaining why? > > If you call a procedure or method that ... Ok, thanks for the explanation. Michael ------------------------------------------------------------------------------ Come build... is the only developer event you need to attend this year. Jumpstart your developing skills, take Bla... php...@li... https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users |