Program: 53062
Project: 53062
Buggy source:
protected TLongIntHashMap buildTitlesToIds() throws DaoException {
  Connection conn=null;
  try {
    if (cache != null) {
      String[] dependsOn=(redirectSqlDao == null) ? new String[]{Tables.LOCAL_PAGE.getName()} : new String[]{Tables.LOCAL_PAGE.getName(),Tables.REDIRECT.getName()};
      TLongIntHashMap map=(TLongIntHashMap)cache.get("String_Node_Str",dependsOn);
      if (map != null) {
        return map;
      }
    }
    conn=ds.getConnection();
    DSLContext context=DSL.using(conn,dialect);
    Cursor<Record> cursor=context.select().from(Tables.LOCAL_PAGE).fetchLazy();
    TLongIntHashMap map=new TLongIntHashMap(Constants.DEFAULT_CAPACITY,Constants.DEFAULT_LOAD_FACTOR,-1,-1);
    int numRedirects=0;
    int numResolved=0;
    for (    Record record : cursor) {
      long hash=hashTitle(record.getValue(Tables.LOCAL_PAGE.TITLE),record.getValue(Tables.LOCAL_PAGE.LANG_ID),record.getValue(Tables.LOCAL_PAGE.NAME_SPACE));
      if (redirectSqlDao != null && record.getValue(Tables.LOCAL_PAGE.IS_REDIRECT)) {
        numRedirects++;
        Integer dest=redirectSqlDao.resolveRedirect(Language.getById(record.getValue(Tables.LOCAL_PAGE.LANG_ID)),record.getValue(Tables.LOCAL_PAGE.PAGE_ID));
        if (dest != null) {
          numResolved++;
          map.put(hash,dest);
        }
      }
 else {
        map.put(hash,record.getValue(Tables.LOCAL_PAGE.PAGE_ID));
      }
    }
    LOG.info("String_Node_Str" + numResolved + "String_Node_Str"+ numRedirects+ "String_Node_Str");
    if (cache != null) {
      cache.saveToCache("String_Node_Str",map);
    }
    return map;
  }
 catch (  SQLException e) {
    throw new DaoException(e);
  }
 finally {
    quietlyCloseConn(conn);
  }
}

Fixed version (ground truth):
protected TLongIntHashMap buildTitlesToIds() throws DaoException {
  Connection conn=null;
  try {
    if (cache != null) {
      String[] dependsOn=(redirectSqlDao == null) ? new String[]{Tables.LOCAL_PAGE.getName()} : new String[]{Tables.LOCAL_PAGE.getName(),Tables.REDIRECT.getName()};
      TLongIntHashMap map=(TLongIntHashMap)cache.get("String_Node_Str",dependsOn);
      if (map != null) {
        return map;
      }
    }
    conn=ds.getConnection();
    DSLContext context=DSL.using(conn,dialect);
    Cursor<Record> cursor=context.select().from(Tables.LOCAL_PAGE).fetchLazy();
    TLongIntHashMap map=new TLongIntHashMap(Constants.DEFAULT_CAPACITY,Constants.DEFAULT_LOAD_FACTOR,-1,-1);
    int numRedirects=0;
    int numResolved=0;
    for (    Record record : cursor) {
      String title=record.getValue(Tables.LOCAL_PAGE.TITLE);
      int lang_id=record.getValue(Tables.LOCAL_PAGE.LANG_ID);
      int ns_id=record.getValue(Tables.LOCAL_PAGE.NAME_SPACE);
      long hash=hashTitle(record.getValue(Tables.LOCAL_PAGE.TITLE),record.getValue(Tables.LOCAL_PAGE.LANG_ID),record.getValue(Tables.LOCAL_PAGE.NAME_SPACE));
      if (redirectSqlDao != null && record.getValue(Tables.LOCAL_PAGE.IS_REDIRECT)) {
        numRedirects++;
        Integer dest=redirectSqlDao.resolveRedirect(Language.getById(record.getValue(Tables.LOCAL_PAGE.LANG_ID)),record.getValue(Tables.LOCAL_PAGE.PAGE_ID));
        if (dest != null) {
          numResolved++;
          map.put(hash,dest);
        }
      }
 else {
        map.put(hash,record.getValue(Tables.LOCAL_PAGE.PAGE_ID));
      }
    }
    LOG.info("String_Node_Str" + numResolved + "String_Node_Str"+ numRedirects+ "String_Node_Str");
    if (cache != null) {
      cache.saveToCache("String_Node_Str",map);
    }
    return map;
  }
 catch (  SQLException e) {
    throw new DaoException(e);
  }
 finally {
    quietlyCloseConn(conn);
  }
}