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 handling of flag-values different from the well-defined ones 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 "handling of flag-values different from the well-defined ones" Watch "handling of flag-values different from the well-defined ones" New topic
Author

handling of flag-values different from the well-defined ones

Andy Jung
Ranch Hand

Joined: Feb 07, 2010
Posts: 150
Howdy ranchers,

my specification mandates to throw a RecordNotFoundException, if either the specified record cannot be found or has a deleted-flag.
Actually the assignment defines two different values for the short flag:
  • 0x0000 = valid
  • 0x0080 = deleted

  • What, if due to some mysterious failure to hard drive, the flag I receive turns out to be neither one of those specified?

    Is it legal to also throw a RecordNotFoundException in this special case? Or does it have to be one of a different type to exactly match the specification? Or is it better to ignore this problem at all?

    Regards,
    Andy


    SCJP, SCJD
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5131
        
      12

    Hi Andy,

    I only did the following check

    I think taking care with hard disk failures is a bridge (maybe even 2 or 3) too far.

    Kind regards,
    Roel


    SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
    http://www.javaroe.be/
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
     
    subject: handling of flag-values different from the well-defined ones
     
    Similar Threads
    NX:deleted flag as a field
    B&S 2.1.1: lock(), delete() and unlock() confusion
    RecordNotFoundException
    create, delete and locking
    Return flag in read method ?