Use logging instead of printStackTrace.  Also, don't handle the exception.  Instead, convert it to an IOException or RuntimeException (if necessary) and let the exception propagate.  It will be handled at a higher level.