reduce raw types

It would save a lot of duplication if you move this try {} finally {} up into mergeTemplate. The printwriter is never used after it's called anyways.