I am working on the URLyBird assignment. I have read the instructions carefully again, and this time I found this statement:
Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package. Each must have a zero argument constructor and a second constructor that takes a String that serves as the exception's description.
It says "any unimplemented exceptions". The thing is that the SecurityException is already part of the java.lang package, although it is not a checked exception.
But, given the statement above, I was wondering if I should implement the java.db.SecurityException.
I have to admit that I have already implemented a checked exception named java.db.SecurityException, but now I am having second thoughts about it.
I think I will join David and Herman for the two very good reasons they have provided:
The java.lang.SecurityException definition in Javadoc is not compliant with purpose of the suncerify.db.SecurityException documented in the assigment instructions. A java.lang.SecurityException must be thrown by the SecurityManager, while the suncerify.db.SecurityException is thrown in the context of the locking mechanism to ensure that a lock is not hold by another client.
The fact that the SecurityException is explicitly declared in the method signature of the provided Data interface conveys the idea that this is a different exception from the java.lang.SecurityException, which is actually an unchecked exception.
Thanks for you feedback, guys. Like you, I had already implemented the suncertify.db.SecurityException. Now I will simply stick to my design.