arduino+processing=proplem

Is there a reason you're not simply using Firmata on the Arduino?

Then all the code would be handled through Processing, and you wouldn't need to directly control the serial communications part.