File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes SecurityException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "SecurityException " Watch "SecurityException " New topic
Author

SecurityException

Olena Golub
Ranch Hand

Joined: Jan 17, 2005
Posts: 113
Hello everyone,

Do you implement the SecurityException by yourself or do you use SUN�s java.lang.SecurityException ?
Thanks a lot for your answers!
Regards,
Olena.


SCJP 1.4<br />SCJD 1.4 (in progress)
Wei-ju Wu
Ranch Hand

Joined: Feb 16, 2005
Posts: 147
Hi Olena,

I used java.lang.SecurityException which seems to conform best to the requirement:


Any unimplemented exceptions in this interface must all be created as member classes of the package.


"The UrlyBird catches the certificate. And he's gonna FlyByNight"<br /> <br />SCJP 1.2/5.0, SCJD, SCBCD, SCWCD, SCEA
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Hi Olena and Wei-ju,

here is what the JDK API says about SecurityException:


public class SecurityException
extends RuntimeException

Thrown by the security manager to indicate a security violation.


That stays in contrast to a must demand in our assignment:


You must not require the installation of a security manager.


What are our exceptions? In my assignment (B&S) I have these three exceptions in my data layer:

  • DuplicateKeyException
  • RecordNotFoundException
  • SecurityException


  • Honestly I am not sure either , but I tend more to implement a SecurityException because of the security manager issue.

    Olena, seems that the exam take longer than we expected

    Regards,
    Darya
    [ May 19, 2005: Message edited by: Darya Akbari ]

    SCJP, SCJD, SCWCD, SCBCD
    Olena Golub
    Ranch Hand

    Joined: Jan 17, 2005
    Posts: 113
    Hi Darya and Wei-ju,
    Thanks a lot for your comments!


    Darya,

    Yep, I did not expect that I need more time. With full-time job it�s not so easy to make it faster
    This preparation is endless
    Darya Akbari
    Ranch Hand

    Joined: Aug 21, 2004
    Posts: 1855
    Hi Olena,

    I share your and and and ... Same feelings on my side.

    But at least we are careful

    Regards,
    Darya
    Wei-ju Wu
    Ranch Hand

    Joined: Feb 16, 2005
    Posts: 147
    Hi Darya,

    it is true that the SecurityException is documented as being thrown from the SecurityManager. This holds true for the J2SE, but noone prevents you from using it in your project. At last, it is simply a public API class and the information that within the J2SE it is thrown in the SecurityManager, does not mean that you need to install a SecurityManager.

    The SecurityException's constructors are all public, so they are meant to be used (at least that's how I interpreted it ) and reusing the appropriate platform exceptions is generally considered a good habit.

    This was the idea I had in my mind when I had to decide whether to create a custom SecurityException or not.

    Wei-ju
    Darya Akbari
    Ranch Hand

    Joined: Aug 21, 2004
    Posts: 1855
    Hi Wei-ju,

    Thanks for your reponse.

    Using your own SecurityException leads to a compiler problem as described in B&S: How to difference between my and JDK's SecurityException?

    As far as I understand, the use of JDK's SecurityException is now only to satisfy the compiler.

    Regards,
    Darya
    [ May 26, 2005: Message edited by: Darya Akbari ]
    Ken Boyd
    Ranch Hand

    Joined: Dec 10, 2003
    Posts: 329
    You can create SecurityException.java under suncertify.db and use that in Data.java class instead of java.lang.SecurityException...

    anything wrong in doing that...


    SCJP, SCWCD, SCBCD, SCJD, BB Java2 and JSP1.1
    Darya Akbari
    Ranch Hand

    Joined: Aug 21, 2004
    Posts: 1855
    Hi Ken,

    you are right. In the meantime I can't even reproduce my compiler error discussed in the thread mentioned previously by me.

    Even with the fact Wei-ju passed SCJD with JDK's SecurityException I prefer my own SecurityException.

    Thanks,
    Darya
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: SecurityException
     
    Similar Threads
    Lock check in Update and Delete
    update and delete SecurityException question.
    use java.lang.SecurityException or create new one
    Do you have to implemente SecurityException?
    URLyBird 1.2.1 - SecurityException