Passing in integer into Processing from Arduino

Hi guys.

I'm having some problem passing over information from the Arduino IDE to Processing. I have arduino reading tags fine and printing their numbers out but when I try to grab this in processing, it always returns a null pointer exception.

This is the code that I have in processing for getting the tag numbers:

public int readRFID()
{
int tagNumber = 0;

if ( myPort.available() > 0) { // If data is available,
val = myPort.readStringUntil('\n'); // read it and store it in val
if (val.isEmpty())
{
tagNumber = 0;
}
else
{
tagNumber = Integer.parseInt(val);
}
}
else
{
tagNumber = 0;
}

return tagNumber;
}[/table]

Any ideas of how to help?

Any ideas of how to help?

Without seeing your Arduino code , all of your Processing code, and your Processing output, no.