Combined two try/catch blocks in doPut.