I hate this.
try { // … some xml parsing stuff … } catch (XmlException e) { logger.error("Can't parse XML", e); }
Why? Because it found a problem, and then carried on as if nothing happened. Which leads me to debugging NullPointerExceptions half a mile away when it’s quite obvious that processing should have halted right there. And as an added bonus, we now get two stack traces in the logs for the price of one.
So what’s the right thing to do? Obviously it depends on the situation, but as I mentioned before, rethrowing the exception wrapped in a RuntimeException isn’t a bad default.
I could start on about how I wish people would think when writing code, but hey, I might as well bang my head against a nearby wall for some more fun instead. Happy ow! happy ow! joy ow! joy!