• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

About SecurityException

 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

What do you guys think?
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you have to implement your own java.db.SecurityException
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just used the one from java.lang.

It's there to be used surely.

Can anyone give a reason why this was wrong?

David
 
Ranch Hand
Posts: 443
3
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used the one from java.lang I may need to hunt the instrcutions out and ready carefully (B&S)
 
David A. Scott
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only thing I can think is that the SecurityException is declared in the supplied interface which is not necessary for unchecked exceptions. But this doesn't mean it's invalid to do so.

Anyone?
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

about SecurityException.

Javadoc says: "Thrown by the security manager to indicate a security violation".(SecurityManager is also a class in java.lang)

That's why I decided not to use this exception, but I made my own SecurityException in the suncertify.db package.


Herman
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

    Warm regards,
    Edwin Dalorzo
     
    Ranch Hand
    Posts: 145
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi ranchers,

    There is a lot o threads about SecurityException, and, my conclusion is no correct answer!, it depends of your choices. There are good threads about that.

    NX: SecurityException unchecked or checked?

    Using java.lang.SecurityException

    B&S - Implication of SecurityException in DB interface methods

    I hope it helps.
    reply
      Bookmark Topic Watch Topic
    • New Topic