‘Catch branch is identical’ however still requires me to catch it

So, since I’m seeing that same warning in IntelliJ (and I think you’re using IntelliJ too), why not let Alt+Enter (or Option+Return if you rather) show you what it means?

You can collapse exception branches if they’re identical, and with the multi-catch syntax, you’ll wind up with one catch statement that does the same thing as your three:

try {
    FileInputStream e = new FileInputStream("outings.ser");
    ObjectInputStream inputStream = new ObjectInputStream(e);
    return (ArrayList)inputStream.readObject();
} catch (ClassNotFoundException | IOException var3) {
    var3.printStackTrace();
}
return null;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)