So, I came across this code and wondered if the compound return statement would fail because the finally block is executed before the return statement is executed :
public DataObject processor(LinkedHashMap itemList)
{
Extractor ex = DataExtractor.getExtractor();
try{
ex.open();
return ex.processData(itemList);
}catch(Exception e){
/* error code */
}finally{
if(ex.isOpen()) ex.close();
}
}
My take is the finally block is executed, closing the Extractor, then the compound return statement is executed, using a closed Extractor, which would result in an error.
Question: Is the compound return statement executed before or after the finally block is executed, resulting in a operation attempted with a closed Extractor?