19 March 2010

Why Tomcat's should be neutered

Two hours I sat staring at a page of code which by rights should have worked perfectly first time. After all, the important loop I added came almost exactly from a text-book example. The problem? Tomcat was throwing up an error "resultset cannot be resolved to a type". There were lots of pages on Google suggesting making sure certain files were in the correct folders. The answer though was a real D'OH!!!! moment. Yes due to Tomcat's default case sensitivity, it turned out that I should have used RecordSet rather than Recordset (the capital S in set if you missed it). This is why there's a good reason to hate Java & JSP.

In fact the whole problem of Tomcat is neatly demonstrated over at the Tomcat wiki (see here: http://wiki.apache.org/tomcat/FAQ/Windows). Can I turn off case sensitivy? A one word response - Yes. Awesome classic fail. A few Googles later reveals why this is a really bad idea as it can lead to exploits, one of which is allowing attackers to see your source code. Nice!!! Someone else already pointed out that this could be percieved as a bit of a design flaw. Sort of like the architects leaving out the windows to negate the need for comfort cooling.

Still there is good news on the horizon. The guy who gets paid at least 10K/year more than me to support the developers is back from paternity leave next week. For another 10K I might be convinced there's a place in the world for Java but I still remember my lecture on Xpath. I replaced eleven lines of java which didn't work with five lines of PHP which did. I'm afraid I don't have the time to write twice as much code and spend four times longer fixing it.