Im getting this on just about every line....anybody see what Im doing wrong?
public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
Connection connection = null;
PreparedStatement pstmt = null;
ResultSet resultSet = null;
int[] leadsSummary = {0,0};
int leadCount = 0;
try {
connection = DataBaseConnectionManager.getConnection();
if (connection != null) {
if (userData.isAgentType()) {
String sqlStmt = "SELECT distinct count (lc.con_id) as TotalLeads FROM LEADS L inner join leads_contactinfo lc on l.fk_conid = lc.con_id" +
" WHERE l.FK_CONID = lc.CON_ID AND lc.FK_AGENTID = ? AND L.BO_VIEWED = 0 ";
// logger.debug(sqlStmt);
pstmt = connection.prepareStatement(sqlStmt);
pstmt.setInt(1,userData.getAgentId());
resultSet = pstmt.executeQuery();
if (resultSet.next()) {
leadsSummary[0] = resultSet.getInt(1);
}
resultSet.close();
pstmt.close();
// Do it again
} else {
String sqlStmt = "SELECT count(*) FROM leads l, leads_contactinfo lc " +
" WHERE l.FK_CONID = lc.CON_ID AND lc.FK_ADVERID = ? " +
" AND l.TIME_STAMP > TO_DATE('" + Integer.toString(month) + "/" +
Integer.toString(i+1) + "/" + Integer.toString(year) + " 00:00','MM/DD/YYYY HH24:MI') AND " +
" l.TIME_STAMP < TO_DATE('" + Integer.toString(month) + "/" +
Integer.toString(i+1) + "/" + Integer.toString(year) + " 23:00','MM/DD/YYYY HH24:MI')";
// logger.debug(sqlStmt);
pstmt = connection.prepareStatement(sqlStmt);
pstmt.setInt(1,userData.getAdverId());
resultSet = pstmt.executeQuery();
if (resultSet.next()) {
leadCount = resultSet.getInt(1);
}
resultSet.close();
pstmt.close();
}
}
}catch (SQLException e) {
throw new Exception(e);
}catch(Exception e){
throw new Exception(e);
} finally {
try {
if (resultSet!=null) resultSet.close();
if (pstmt!=null) pstmt.close();
DataBaseConnectionManager.closeConnection(connection);
} catch (SQLException e) {
throw new Exception(e);
}catch(Exception e){
throw new Exception(e);
}
}
return leadsSummary;
}