Can we please ensure that we write meaningful error messages in the
code. For example, from ContextListener:
catch (Exception e) {
_logger.error("error: " + e.getCause());
}
} catch (Exception e) {
_logger.error("error: "+e.getCause());
}
is just unhelpful.
Firstly, this catches exceptions (including runtime) and silently
ignores them. If it were safe to do this then there would be no point
in throwing the exception in the first place
Secondly, the log message hear is meaningless, it tells us nothing
about what has happened, i.e. we get:
[java] INFO [Thread-13] (ContextListener.java:131) - Deploying widget:vote
.wgt
[java] 08:55:29,718 INFO ContextListener:131 - Deploying widget:vote.wgt
[java] ERROR [Thread-13] (ContextListener.java:142) - error: null
[java] 08:55:29,718 ERROR ContextListener:142 - error: null
This does not help with debugging the code, and makes for a silently
unstable system (tests will pass for example, even though there is an
exception).
I suggest that all exceptions need to be handled sensibly by the code,
if there is no way of handling it sensibly at the point of exception
then bubble it up to somewhere that can handle it, finally throwing a
Runtime if there is nothing we can do about it.
Ross
--
Ross Gardler
OSS Watch - supporting open source in education and research
http://www.oss-watch.ac.uk