Wednesday, March 26, 2008

Java SQLException Chaining

In JDK 1.4 chained Throwables were added and made logging and tracing exceptions much easier. Being able to create a new exception and specify the causing exception in a standard way, tied to JVM printing out the stack chain, was a big boost to tracking down problems in an application.

There are still some exceptions that do not use this standard chaining mechanism and one of the most frustraiting cases in SQLException. It provides a getNextException() method which returns the next SQLException related to the failed operation. The problem here is without special handling code these nextExceptions just get lost in log messages.

A general solution to this problem is to add an Aspect that either logs the results of getNextException or adds them to the exception chain.



This aspect class can be used via Spring's AOP support with the following context configuration:

Thursday, March 20, 2008

Sirius, The Story Continues.

With great sadness we've decided that Sirius is not going to work as a member of our family. Gretchen ran head long into a pretty serious behavior issue while taking him on a walk yesterday and we don't think we have the necessary additional time it would take to deal with these issues.

He will be going back to his foster family some time in the next few days.

Monday, March 17, 2008

Sirius

So as promised here are pictures of Sirius our new dog.

He is a black lab mix and about a year and a half old. We got him from a Labrador rescue group that operates in southern Wisconsin and northern Illinois. We drove over to Racine, WI on Saturday (about a 2 hour drive) to go meet him and then do some shopping. We had expected that if we did want to adopt him we would have to wait 24 hours to get him per the group's rules. Apparently they liked us so much (or just felt bad for all the driving) that we were told we could bring him home that day if we wanted. We took a few hours and went shopping and got lunch and decided that we would take him. We went on a PetCo shopping spree ran by an ATM (didn't think to bring the check book) and picked up our new dog.

Gretchen rode in the back seat with him for the first hour of the trip home to help keep him calm. We stopped for Gretchen to do a bit more shopping while Sirius and I went on a 30 minute walk. He rode by himself the rest of the way home and did quite well. Once home we took him for an hour long walk to get him nice and tired before introducing him to our home and to get the migration instinct going in him (we watch lots of The Dog Whisperer). Once he was nice and tired we brought him inside and lead him around on the leash, Gretchen had sequestered the kitties in the master bedroom to avoid any traumatic introductions there. Then, following the great tradition with our kitties, Sirius got his first bath and unlike the kitties does just fine in the tub!

After the long day it was time for food and rest, except the tired new dog parents didn't realize that:
  1. He had no idea how to ask to go outside.
  2. What goes in must come out
Before we knew it we had a nice stinky present from our new pup on our dining room floor. Oh well after a bit of scrubbing all was cleaned and he hasn't had an accident since.

The cats are slowly warming up to him. We have baby gates setup so that they can easily get downstairs but he cannot and it seems to be working well. Today, his 3rd day in the house, Olive and Autumn are getting a bit bolder about being walking around with him loose. He still gets lots of hisses when he gets near them but we're both happy with how the cats are doing and are trying to make sure they get enough attention as well.

The twice daily walks are a bit tiring right now and we're both working on being mentally with it enough all the time to give him the corrections he needs as he settles in to our home. We'll be looking for an obedience school soon which we think will help a lot. He is quite the pleaser so he trains well and we already have sit and here down pretty well.

Well that is enough on the doggie front for this evening. We'll try to keep up with pictures and notes when we get the time off our feet.

-Eric & Gretchen

PS: Sirius' profile page from the rescue group.