Archive

Posts Tagged ‘Code Smell’

Extreme Exception Programming – Catch Every Exception and Work Around It

October 10, 2010 Leave a comment
I was reviewing the commit log from the last week commits and found this gem:
try{
list = (ArrayList<MyObject1>)session.getAttribute(TEMPORARY_LIST);
}catch (ClassCastException e){
if(add.getMyObjectCurrentItem()) != -1)
try{
list = add.getOtherList().get(add.getMyObjectList()).getMyObjectList();
} catch(IndexOutOfBoundsException e2){
try{
list = add.getOtherList().get(add.getMyObjectList()-1).getMyObjectList();<
} catch(IndexOutOfBoundsException e3){
//Move On
}
}
}

Only thing that came to mind was WTF, after Showing it to my boss he called it : Extreme Exception Programming.
I tweeted before about how in Enterprise we end up coding for every possible chance, but this is going too far.
Categories: java, WTF Tags: , , ,