| Article: |
An Exception Handling Framework for J2EE Applications | |
| Subject: | Bad code example | |
| Date: | 2006-01-16 23:58:26 | |
| From: | Shrik | |
|
Response to: Bad code example
|
||
| Using instanceof operator (please refer to Avoid instanceof operator (http://www.javapractices.com/Topic31.cjp) ) itself is a bad practice and you still need to use exception for program flow. In case exception needs to be dealt at any other place other than the Controller itself as mentioned in the example, it's better to make contract clear to the client instead of embedding the cause in the BaseAppException and checking its type. This kind of situation (where you need to handle the exception other than at Controller end) is rare in normal J2EE applications and for those situations I don't think there is any harm in putting the exception explicitely in the throws clause. | ||
Women in Technology
Hear us Roar
