aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes UrlyBird 1.3.3 find method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "UrlyBird 1.3.3 find method " Watch "UrlyBird 1.3.3 find method " New topic
Author

UrlyBird 1.3.3 find method

Thiago Melo
Greenhorn

Joined: Dec 09, 2008
Posts: 7
hi everybody.

guys i have some questions about my find method:

// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria) throws RecordNotFoundException;

1. in my implementation when the size of the "criteria" is > 0 then i return the record that match
for any criteria. Is this right ? Someone used regular expression in this method?

2. in this method the sun interface only throw RecordNotFoundException, but in my implementation i
have to read the data file, so may i have to throw an IOException too. Can add more exception for my method?
i have the same doubt about create, read, modify and delete methods...


thanks,


Thiago Melo.
SCJP 1.4, SCWCD 5
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2247

Fala ai Thiago!

For your first question, please take a look here. I think this will be helpful!

For your second question, it probably will be better to throw a RuntimeException in these cases. Unfortunatelly, you can't change the interface that was provided to you. So just throw the exceptions that are allowed.

Will Sport be the Libertadores champion this year?!?!?!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Thiago Melo
Greenhorn

Joined: Dec 09, 2008
Posts: 7
Fala Roberto,
thanks for tip, about the exceptions i don't have doubts anymore. but the find method i'm a little confused. Because if i understand well, first i will do a search with the "OR" logic, and latter i'll filter in my gui. Am i right?

P.S Someone hold my sport!!! heheheh
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

Thiago Melo wrote:Fala Roberto,
Because if i understand well, first i will do a search with the "OR" logic, and latter i'll filter in my gui. Am i right?


You are absolutely right!


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UrlyBird 1.3.3 find method
 
Similar Threads
RecordNotFoundException dilema, pease help
Search exactly matches or partially matches?
find and RecordNotFoundException in B&S
Exception Handling behaviour
Additional runtime exceptions in DB interface