• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception Handling query

 
Sam O'Neill
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application I use a JTextArea below my JTable which acts as a 'status' box for my application where any checked exceptions are displayed but in a nice succinct user friendly manor such as "Unable to complete booking as not enough seats available on that flight."
My question is what if I am calling a method such as the following:
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeel());
which throws 4 checked exceptions that should be caught but I do not want to display a confusing message to the user about look and feel as they will have no idea what to do about it and it is my understanding that the system will use the default in any case so no real disaster.
Ideally I would like to use the java.util.logging package to log these sorts of problems to a file for later inspection without concerning the user but I have read many mails warning against that so what should I do with these sorts of exceptions.

I don't want to just swollow them and logging would seem ideal.
Any suggestions much appreciated.
Thanks in advance
Sam
 
Brian Blignaut
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all changing the look and feel is not part of the requirement, which means you are just complicating your design and making it more error prone. Try remember the following two principles YAGNI (You aint gonna need it) and KISS (keep it simple stupid) when you design application.
As for the exception handling, I took the simple approach and just display a dialog to the user with a user friendly message. Again logging was not a requirement of the project.
Hope this helps!
 
Brian Blignaut
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry should have mentiond, if I am not mistaken the above two practices are both from extreme programming if you wanna get more info
 
Sam O'Neill
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
I think you are right - am trying to pack too much in when not necessary. Have read alot of different books and study aids and each one has different recommendations so difficult to know what is really expected of you.
I will leave the logging in for now just to help with testing then just go with the basics for upload.
Input appreciated, can go a little bit loopy doing this stuff on your own all the time!
Regards
Sam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic