And up again

Okay, here's some tips for you budding Java programmers out there:

1) Don't assume anything. Just because you THINK that a line of code will never have problems or throw nasty errors, that doesn't mean it won't. Put that code into try-catches just to make sure. The BlogAgent inexplicably had something like this: result = stringVar.substring(4, stringVar.length()); At first glance I didn't think there would be any errors from that because you couldn't get to that code if stringVar wasn't at least 4 characters... Well. It turns out that you CAN arrive to that code with exactly 4 characters and Java barfed on it. The weird thing is that the scheduler code kept on running, but the agent code stopped dead. Weeeeird.

2) If you're going to bother to try-catch errors, it helps if you catch the RIGHT errors. DOH! Ahh screw-it. I just put in and caught generic Exceptions everywhere instead of a more detailed errors. I'm a lazy SOB, what can I say.

That's it. I'm hardly the Java programmer to give lessons. ;-)


< Previous         Next >