all our parameters are String
Customer holding this record owner 8 The id value (an 8 digit number) of the customer who has booked this. Note that for this application, you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Always proofread carefully to see if you any words out.
Always proofread carefully to see if you any words out.
BUT the server should obey the dictum "Never trust a client to do the right thing" and should perform further checks itself to prevent runtime exceptions being thrown server-side because of badly formatted client requests.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by Andrew Monkhouse:
You cannot throw a checked exception if something fails to validate - I dont think a RuntimeException is the correct response to invalid data.
From javadoc:
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Andrew: You cannot throw a checked exception if something fails to validate - I dont think a RuntimeException is the correct response to invalid data.
Maksim: What about java.lang.IllegalArgumentException?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
It is better than throwing a generic RuntimeException, but it is still not a checked exception. And this could mean that a client application could die a horrible death even though the programmer coded to specified interface.