Error inside Serial.serialEvent()

Greetings All,

I was working on my Arduino Diecimila this evening and came across an error. The reason why I am emailing you directly is because I did a search of the forum and found a similar error message from another user to which you started to reply.

From Arduino Forum ? Software ? Troubleshooting
Error inside Serial.serialEvent()
27. Jan 2008 at 23:05

The error message I am receiving is:
Error inside Serial.serialEvent() Bad file descriptor in nativeavailable
at Method)
at Method)

This message repeats.

What I am doing is trying to measure capacitance.
See code:

First I looked over the hardware and it seems fine.
Then I tried the simple stuff like unpluging and repluging the Arduino.
Then starting and stopping the Serial Monitor, which i can do
Then restarting the IDE software.

The first person who came across this error said they got it 'occasionally' I get it consistently.

Any thoughts,