Could the `if (sub.isEmpty()) { ... }` generate any exception? In negative case, I'd move outise the try/catch block.