ResourceException may be thrown as well. Use a multicatch in here