Program: 12160
Project: 12160
Buggy source:
/** 
 * <p>semantic_memory.cpp:1494:smem_install_memory
 * @param state
 * @param parent_id
 * @throws SQLException
 */
void smem_install_memory(IdentifierImpl state,long lti_id,IdentifierImpl lti,boolean activate_lti,List<SymbolTriple> meta_wmes,List<SymbolTriple> retrieval_wmes) throws SQLException {
  final SemanticMemoryStateInfo info=smem_info(state);
  final IdentifierImpl result_header=info.smem_result_header;
  boolean lti_created_here=false;
  if (lti == null) {
    db.lti_letter_num.setLong(1,lti_id);
    final ResultSet rs=db.lti_letter_num.executeQuery();
    try {
      if (!rs.next()) {
        throw new IllegalStateException("String_Node_Str");
      }
      ;
      lti=smem_lti_soar_make(lti_id,(char)rs.getLong(0 + 1),rs.getLong(1 + 1),result_header.level);
    }
  finally {
      rs.close();
    }
    lti_created_here=true;
  }
  if (activate_lti) {
    smem_lti_activate(lti_id,true);
  }
  smem_buffer_add_wme(meta_wmes,result_header,predefinedSyms.smem_sym_retrieved,lti);
  if (lti_created_here) {
  }
  if ((this.params.merge.get() == MergeChoices.add) || ((lti.goalInfo.getImpasseWmes() == null) && (lti.getInputWmes() == null) && (lti.slots == null))) {
    db.web_expand.setLong(1,lti_id);
    final ResultSet rs=db.web_expand.executeQuery();
    try {
      while (rs.next()) {
        final SymbolImpl attr_sym=smem_reverse_hash(rs.getInt(0 + 1),rs.getLong(1 + 1));
        final SymbolImpl value_sym;
        final long lti_rs=rs.getLong(6 + 1);
        if (lti_rs != SMEM_AUGMENTATIONS_NULL) {
          value_sym=smem_lti_soar_make(lti_rs,(char)rs.getLong(4 + 1),rs.getLong(5 + 1),lti.level);
        }
 else {
          value_sym=smem_reverse_hash(rs.getInt(2 + 1),rs.getLong(3 + 1));
        }
        smem_buffer_add_wme(retrieval_wmes,lti,attr_sym,value_sym);
      }
    }
  finally {
      rs.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * <p>semantic_memory.cpp:1494:smem_install_memory
 * @param state
 * @param parent_id
 * @throws SQLException
 */
void smem_install_memory(IdentifierImpl state,long lti_id,IdentifierImpl lti,boolean activate_lti,List<SymbolTriple> meta_wmes,List<SymbolTriple> retrieval_wmes) throws SQLException {
  final SemanticMemoryStateInfo info=smem_info(state);
  final IdentifierImpl result_header=info.smem_result_header;
  boolean lti_created_here=false;
  if (lti == null) {
    db.lti_letter_num.setLong(1,lti_id);
    final ResultSet rs=db.lti_letter_num.executeQuery();
    try {
      if (!rs.next()) {
        throw new IllegalStateException("String_Node_Str");
      }
      ;
      lti=smem_lti_soar_make(lti_id,(char)rs.getLong(0 + 1),rs.getLong(1 + 1),result_header.level);
    }
  finally {
      rs.close();
    }
    lti_created_here=true;
  }
  if (activate_lti) {
    smem_lti_activate(lti_id,true);
  }
  smem_buffer_add_wme(meta_wmes,result_header,predefinedSyms.smem_sym_retrieved,lti);
  if (lti_created_here) {
  }
  if ((this.params.merge.get() == MergeChoices.add) || ((lti.goalInfo == null || lti.goalInfo.getImpasseWmes() == null) && (lti.getInputWmes() == null) && (lti.slots == null))) {
    db.web_expand.setLong(1,lti_id);
    final ResultSet rs=db.web_expand.executeQuery();
    try {
      while (rs.next()) {
        final SymbolImpl attr_sym=smem_reverse_hash(rs.getInt(0 + 1),rs.getLong(1 + 1));
        final SymbolImpl value_sym;
        final long lti_rs=rs.getLong(6 + 1);
        if (lti_rs != SMEM_AUGMENTATIONS_NULL) {
          value_sym=smem_lti_soar_make(lti_rs,(char)rs.getLong(4 + 1),rs.getLong(5 + 1),lti.level);
        }
 else {
          value_sym=smem_reverse_hash(rs.getInt(2 + 1),rs.getLong(3 + 1));
        }
        smem_buffer_add_wme(retrieval_wmes,lti,attr_sym,value_sym);
      }
    }
  finally {
      rs.close();
    }
  }
}