This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi everybody, great place! I downloaded my developer assignment a couple of days ago: It had a DBAccess interface with deleteRecord, updateRecord methods that throw SecurityExceptions if the record is locked with a cookie other than 'lockCookie'. LockCookie is a long that is passed as an argument to these methods (also it is the return value of the lockRecord method). Now the API documentation says that a java.lang.SecurityException is thrown by the security manager. Would this indicate that I must use a subclass of SecurityManager? Or should I create a mypackage.SecurityException that can be thrown by anyone?
Hi Annekee Bos, 1. lock the record to perform update/delete operation, which returns lockCookie once the record is locked. 2. update/delete the locked record. while doing so, you will ensure that this record is locked with the lockCookie. If the record is not locked, you do throw SecurityException with appropriate message. NO SECURITYMANAGER IS INVOLVED. 3. unlock the already locked, if no lock found on this record, throw SecurityException again. Ganapathy
Joined: Apr 29, 2003
I'm still not 100% sure yet: the API documentation is very explicit about securityException: 'Thrown by the security manager to indicate a security violation.'. Would you say that my Data class is a kind of security manager even though it is not an instance of SecurityManager? I could argue this, since the class does 'manage the security' of my database. Also I do think that if SUN really intended securityExceptions to be thrown by instances of SecurityManager only, the exception would not have a public constructor, but still I have doubts: please manage the security of my consciense here !