"catch(Throwable ex)" in some places in StatefulRuleSessionImpl.java class should be replaced with "catch(Exception ex)", since Throwable is the superclass of all exceptions and errors
You can use it in a catch clause, but you should never do it!
If you use Throwable in a catch clause, it will not only catch all exceptions; it will also catch all errors. Errors are thrown by the JVM to indicate serious problems that are not intended to be handled by an application. Typical examples for that are the OutOfMemoryError or the StackOverflowError. Both are caused by situations that are outside of the control of the application and can’t be handled.
So, better don’t catch a Throwable unless you’re absolutely sure that you’re in an exceptional situation in which you’re able or required to handle an error.
So if possible, can it be changed to "catch(Exception ex)" in StatefulRuleSessionImpl class.
Regards,
Pratik Pande
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
"catch(Throwable ex)" in some places in StatefulRuleSessionImpl.java class should be replaced with "catch(Exception ex)", since Throwable is the superclass of all exceptions and errors
You can use it in a catch clause, but you should never do it!
If you use Throwable in a catch clause, it will not only catch all exceptions; it will also catch all errors. Errors are thrown by the JVM to indicate serious problems that are not intended to be handled by an application. Typical examples for that are the OutOfMemoryError or the StackOverflowError. Both are caused by situations that are outside of the control of the application and can’t be handled.
So, better don’t catch a Throwable unless you’re absolutely sure that you’re in an exceptional situation in which you’re able or required to handle an error.
So if possible, can it be changed to "catch(Exception ex)" in StatefulRuleSessionImpl class.
Regards,
Pratik Pande