Well the getJobName call is only made after I call the isValidJobNumber method so it would always have a valid job number and it does not handle bad job numbers! That is why I wanted to clean this up.
I can see the idea of bypassing the isValid routine all together but I am a little fuzzy on how to make that work. Lets say I create a method similar to:
Assuming that all the database setup is correct that would return a jobName
string when the job number is valid or will throw an exception when it is not. I know that jobNumber is the PK so it will either have one record returned or no records at all. So when calling getJobNum I would need to catch the SQLException?
showInvalidJobNumberError() would display a error dialog requesting that a valid job number be entered before continuing. At which point I would return out of the method and wait for the user to enter a better job number and try again (it is ran from a GUI).
Does that sound like a more reasonable approach or would you structure it differently?