Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Tom Holt

Greenhorn
+ Follow
since Oct 06, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Holt

I am an old-schooler, first passing my 1.4 exams on Kathy and Bert's books.  Now I am overdue a refresh, and I am pleased to be using their books (and Elizabeth's) again.
The DB interface I am forced to implement says that a SecurityException should be thrown when the record is locked with a cookie other than the cookie passed. Does this mean I should use a SecurityManager to manage the locking and unlocking of contractor records?

I am concerned about doing this for the following reason:
In my 'RMI Restrictions' it says that "You must not require the installation of a security manager" - Does this requirement just relate to RMI or the whole app?

I would rather not throw a SecurityException but keep my thread waiting until the resource has been released.

Some guidance would be appreciated!
Thanks for the post. I managed to get it working using the DataInputStream rather than the ObjectInputStream.
I am just starting on the Bodgitt and Scarper assignment and have created a class to read the data file - I hope this will be a starting point from which I can write the rest of the db server code. The only problem is that it crashes when I try to instantiate the ObjectInputStream. I get the following error:

Exception in thread "main" java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at suncertify.db.DataReader.read(DataReader.java:28)
at suncertify.db.DataReader.main(DataReader.java:57)

Here is a code snippet:

FileInputStream fis = new FileInputStream(file);
FileChannel fc = fis.getChannel();
ByteBuffer bb = ByteBuffer.allocate((int)fc.size());
fc.read(bb);

ByteArrayInputStream bais = new ByteArrayInputStream(bb.array());
ObjectInputStream ois = new ObjectInputStream(bais);

long magicCookieValue = ois.readLong();

Can anyone give me a clue what I have done wrong.

Many Thanks,
Tom.