Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Do you have to implemente SecurityException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Do you have to implemente SecurityException?" Watch "Do you have to implemente SecurityException?" New topic
Author

Do you have to implemente SecurityException?

Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Do I have to create a class for it or I can use it as java's SecurityException...
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Might be of use...


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Sean Keane wrote:Might be of use...


Well I did read before I posted but... I'm still unsure if I should implement it.. since is kind of meaningless
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

I think you should create your own SecurityException, instead of using the one in Java's API.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Dennis Grimbergen
Ranch Hand

Joined: Nov 04, 2009
Posts: 140

Just create your own SecurityException as a member of the suncertify.db package.
That's all. Now focus on the next issue Good luck!


SCJP, SCWCD, SCJD
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ixus See wrote:
Sean Keane wrote:Might be of use...


Well I did read before I posted but... I'm still unsure if I should implement it.. since is kind of meaningless


The very first result from Google answers your question, no?

What do you think the exception is meaningless?
Dmitri Cherkas
Ranch Hand

Joined: Mar 22, 2010
Posts: 40
Excuse me, but... what advantages can be of using own suncertify.db.SecurityException instead of standard java.lang.SecurityException ?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4344
    
    8

java.lang.SecurityException has a specific meaning:
Javadocs wrote:Thrown by the security manager to indicate a security violation.

I think it's misleading to use it for something else, which is why I implemented my own. In my opinion, it's just a coincidence that there's a core library exception with the same name.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

Dmitri Cherkas wrote:what advantages can be of using own suncertify.db.SecurityException instead of standard java.lang.SecurityException ?

No real advantages. But the exception from java.lang has (according to its documentation) nothing to do with the exception in the given interface and therefore I would suggest creating your own exception.
Dmitri Cherkas
Ranch Hand

Joined: Mar 22, 2010
Posts: 40
May be if I will write in my choices.txt :

"I implement my own suncertify.db.SecurityException because following to my assignment instructions : I "must not require the installation of a security manager." and from API of java.lang.SecurityException : "Thrown by the security manager to indicate a security violation." therefore it seems that java.lang.SecurityException is bind to using of security manager."

Does seem it logic ?

I think to do my suncertify.db.SecurityException as unchecked exception, is it a good choice ?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

Dmitri Cherkas wrote:I think to do my suncertify.db.SecurityException as unchecked exception, is it a good choice ?

To me it can only be an unchecked exception, so
Dmitri Cherkas
Ranch Hand

Joined: Mar 22, 2010
Posts: 40
Thank you Roel, thank you Matthew !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Do you have to implemente SecurityException?
 
Similar Threads
[Bodgit Scrapper] Thought regarding the DB interface and exceptions
Help...
Lock check in Update and Delete
How to handle securityException in Service layer
Do I have to creare own SecurityException?