Is there a built-in way to determine in a finally block whether or not you just came out of a catch block? I know this can easily be done with a variable like below, but I was just curious if there was a standard, built-in way of doing this.
boolean bException = false;
try
{
dbf = new DBFunctions();
dbf.db_run_query(query2);
dbf.rs.next();
nMonth = dbf.rs.getInt("calquarter") * 3;
nYear = dbf.rs.getInt("calyear");
}
catch (SQLException sqle)
{
out.println(sqle.toString());
bException = true;
}
finally
{
dbf.closeConnection();
if (bException == true)
return;
}
Update: Here are the contents of the closeConnection() method, which is just trying to close all of the database objects:
public void closeConnection()
{
if (rs != null)
{
try { rs.close(); } catch (SQLException e) { ; }
rs = null;
}
if (stmt != null)
{
try { stmt.close(); } catch (SQLException e) { ; }
stmt = null;
}
if (con != null)
{
try { con.close(); } catch (SQLException e) { ; }
con = null;
}
}