Ol’ Granma feels a bit tired. The doctor comes around, blinks twice, and tells you she has a rare case of reverse acquired acute osteopraxia. Some days, I wish I could do the same with software.
Of course, there are some who say that Dijkstra managed to do so: he would peek at a student’s screen, sift through the code in a few seconds, and assert that there would be a bug if the program was used in a certain way. I certainly don’t doubt this: it’s often easy to see the errors in the code written by others, especially if they just finished writing it and didn’t have time to check it or test it.
But there are other errors that can be quite anoying. Consider, for instance, an error message from our dearest friend Alfresco the content management system:
org.alfresco.service.cmr.repository.TemplateException: Error during processing of the template ‘Error on line 42, column 91 in status.ftl
Expecting a string, date or number here, Expression exception.message is instead a freemarker.ext.beans.SimpleMethodModel’. Please contact your system administrator.
caused by:
freemarker.core.NonStringException: Error on line 42, column 91 in status.ftl
Expecting a string, date or number here, Expression exception.message is instead a freemarker.ext.beans.SimpleMethodModel
It appeared as I executed a Web Script—a piece of Javascript-and-Freemarker that runs inside the Java program itself—in my web browser. Despite being quite long and detailed, this error message does not contain interesting information. It actually makes three of the most fundamental mistakes in error reporting:
- Bad technology level. This is a Java error (in fact, it’s precisely a Java exception report and the full call stack was available for viewing on the page). Yet, the error comes from a Freemarker template, not from Java. But I’m a homo sapiens, so I can gather that the actual error is actually the “Error on line 42, column 91 in status.ftl. Expecting a string, date or number here, Expression exception.message is instead a freemarker.ext.beans.SimpleMethodModel” part.
- Vague references to files. Alfresco has the nasty habit of storing files everywhere. That status.ftl file could be within the repository itself, or it could be part of the alfresco WAR, or it could have been placed in any of the billion tiny locations in a typical Tomcat application server your Alfresco will seep into unhindered if badly administrated. What I do know is that I’ve never written a status.ftl file myself, ever, so that certainly isn’t my fault! Now, I understand that the exception came from Freemarker, and Freemarker was told that the file’s name was status.ftl, but if you’re executing file foo/bar/qux/status.ftl and the processing fails, add the complete path to the exception or diagnosis message!
- No references to documentation. There’s no link to an online documentation, manual page, book, wiki, relevant log on my server or even an error number that I could google. Sure, the contact your administrator line is fine, but what happens if you are the administrator and how do you start looking for solutions?
By the way, google-fu yields this link, which accurately solves the problem. This would be a hint that a badly worded error message isn’t always the end of the world (but this doesn’t make it better).
Hi. I'm Victor Nicollet,
Recent Comments