For some reason chucknorrisfacts.com has been spreading like wildfire throughout the office.  After dealing with some Hibernate lameness today, I thought I’d add a new fact. 

If Chuck Norris were to re-write Hibernate, he’d have it done yesterday without any bugs.

The issue I was having with Hibernate today was some nasty logger usage occuring within a catch{} block.  I’m sure Gavin had his reasons, but I generally consider this type of explicit logging before re-throwing inside of a try/catch to be an annoying practice.  It popped up today as we were writing unit tests that expected the exception to get thrown minus the annoying ERROR messages filling up our console.  My less-than-ideal solution was to bump the logging level up for the AbstractBatcher to FATAL.

BatchingBatcher.java

try
{
    if (batchSize!=0)
    {
        // do something
    }
}
catch (RuntimeException re)
{
    log.error(”Exception executing batch: “, re);
    throw re;
}
finally
{
    // cleanup
}

I did a quick check and noticed the same usage existed in 3.1.1 (we’re still using 3.0).  Also noticed that there were a few other cases where logging was occuring from within the scope of a try/catch.

Is there a reason?


Leave a Comment




  • Windows Live Writer isn’t bad Until recently, the bulk of my writing was done on a Mac using Ecto.  I was looking for a suitable publishing tool for Windows and was directed towards ...

  • Pet Peeve: Don’t email my password to me in plain text You know the drill. Signup for some random service on the internet Receive a confirmation email with your account information or Forget a password for some random service ...

  • Eclipise Memory Analyzer (MAT) I must say the Eclipse Memory Analyzer looks pretty slick. There is some pretty good material over on the developers blog. Lastly, there was a talk on it ...

  • Open-source Web-based Code Review Tool: Rietveld Guido van Rossum, of Python fame, has recently released a Django-based application that enables web-based code reviews... Rietveld. It supports any language and currently can hook into Subversion repositories. You ...

  • An implementation of the JVM in Javascript? Caught this over on JavaPosse Google Groups. Essentially, some bright fellows over in Japan have developed a bytecode->javascript compiler. There's a demo floating around that took a Tetris ...