Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Error handling , Chained Exception .. please  comment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Error handling , Chained Exception .. please  comment" Watch "Error handling , Chained Exception .. please  comment" New topic
Author

Error handling , Chained Exception .. please comment

Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Hi Guys,
I let all methods in my DataInterface interface
to throw Exception because when a class implements this interface and wants to override it's method, no need to worry about if their exception classes are covered by interface, also I didn't create any customized exception like DatabaseException for my client or server side (just throw Exception and catch Exception). but I've read some comments about 'Chained Exception' and now I am wondering if my way is not the right way?
I appreciate your comments

Sam
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,
I did not use chained exceptions either and got perfect on exception handling. I'm not arguing either way on the subject since I thing chained exception handling is a great tool to have at your disposal and I believe that the newer 1.4 SDK makes it easier to implement. It just didn't fit well with my design. I used an observer pattern (Observer/Observable) for client-side exception handling. Similar to you, I just caught Exception in the facade, and called the update method on the Observer and then went thru a series of "instanceof" tests to see what kind of exception had been thrown and in what context. So if your exception handling is clear and covers all the bases, I would just go with what you have already done.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Thanks Michael,
there is one thing I didn't implement so far and It is policy file and SercutiryManager. I appreciate it if you can help me. I run my application in WinXP (both client and server apps) without a problem, I don't know about other OS, when I add a RMISecurity Manager to my server it comes with the ugly applet windows. and I don't know what should I do with it and about policy file, what type of grant should I provide ? do I really need it? well I guess after that I am ready to uplaod
Thanks again for comments
Sam
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,
I did install a securtity manager and use a policy file for the server. Initially I was loading RMI stubs dynamically from the client so I needed both. I eventually decided it was better (more logical from a design point of view) to put those classes on the server so I probably needed neither. I do know that, although I required a policy file on the server, that in all tests that I did it would run fine without one. I granted all permission in my policy file. In a real application you probably would want to restrict it to the bare minimum required, but you won't lose any points for full permission so better safe than sorry.
Hope this helps,
Michael Morris
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Thansk again for your comment Michael,
I used RMI Security Manager in server side and I get ugly sceern in all my Frame and JOptionPane (show them like an applet) and it screws all my GUI do u know how can remove this from my fram??
thanks in advance
Sam
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,
I really don't know but a wild guess would be that it is XP specific. We've made the decision to steer clear of XP at our company and stay with 2K until we know most of the kinks are knocked out. Is there any way you can try it on a different OS? Sorry, I'm not much help on this. You might want to start a new post with this problem as the topic. There's a good chance someone knows of or has seen this behavior before.
Michael Morris
 
GeeCON Prague 2014
 
subject: Error handling , Chained Exception .. please comment