These two pieces of code log an error and then continue. If either of these fails, the code later in the method doesn't make sense though. It's better to just log the error, throw a RuntimeException and stop trying.