nus-yam/ex-repair huggingface dataset:
Program: 12135
Project: 12135
Buggy source:
private String doPrint(int i,String[] args) throws SoarException {
  final StringWriter sw=new StringWriter();
  final PrintWriter pw=new PrintWriter(sw);
  long lti_id=0;
  int depth=1;
  smem.smem_attach();
  if (args.length > i && args.length <= i + 3) {
    char name_letter=0;
    long name_number=0;
    if (args.length == i + 2) {
      lexer.get_lexeme_from_string(args[i + 1]);
      if (lexer.getCurrentLexeme().type == LexemeType.IDENTIFIER) {
        if (smem.getDatabase() != null) {
          lti_id=smem.smem_lti_get_id(name_letter,name_number);
          if ((lti_id != 0) && args.length == i + 3) {
            depth=Integer.parseInt(args[i + 2]);
          }
        }
      }
    }
    StringBuilder viz=new StringBuilder("String_Node_Str");
    if (lti_id == 0) {
      smem.smem_print_store(viz);
    }
 else {
      smem.smem_print_lti(lti_id,depth,viz);
    }
    if (viz.length() == 0) {
      throw new SoarException("String_Node_Str");
    }
    pw.printf(PrintHelper.generateHeader("String_Node_Str",40));
    pw.printf(viz.toString());
  }
 else {
    throw new SoarException("String_Node_Str");
  }
  pw.flush();
  return sw.toString();
}

Fixed version (ground truth):
private String doPrint(int i,String[] args) throws SoarException {
  final StringWriter sw=new StringWriter();
  final PrintWriter pw=new PrintWriter(sw);
  long lti_id=0;
  int depth=1;
  smem.smem_attach();
  if (args.length > i && args.length <= i + 3) {
    if (args.length == i + 2) {
      boolean allowIdsOld=lexer.isAllowIds();
      lexer.setAllowIds(true);
      lexer.get_lexeme_from_string(args[i + 1]);
      if (lexer.getCurrentLexeme().type == LexemeType.IDENTIFIER) {
        final char name_letter=lexer.getCurrentLexeme().id_letter;
        final long name_number=lexer.getCurrentLexeme().id_number;
        if (smem.getDatabase() != null) {
          lti_id=smem.smem_lti_get_id(name_letter,name_number);
          if ((lti_id != 0) && args.length == i + 3) {
            depth=Integer.parseInt(args[i + 2]);
          }
        }
      }
      lexer.setAllowIds(allowIdsOld);
    }
    StringBuilder viz=new StringBuilder("String_Node_Str");
    if (lti_id == 0) {
      smem.smem_print_store(viz);
    }
 else {
      smem.smem_print_lti(lti_id,depth,viz);
    }
    if (viz.length() == 0) {
      throw new SoarException("String_Node_Str");
    }
    pw.printf(PrintHelper.generateHeader("String_Node_Str",40));
    pw.printf(viz.toString());
  }
 else {
    throw new SoarException("String_Node_Str");
  }
  pw.flush();
  return sw.toString();
}
Program: 12136
Project: 12136
Buggy source:
@Override public void removeWme(WmeImpl w){
  boolean was_encoded=false;
  if (w.value.asIdentifier() != null) {
    boolean lti=(w.value.asIdentifier().smem_lti != 0);
    if ((w.epmem_id != EPMEM_NODEID_BAD) && (w.epmem_valid == epmem_validation)) {
      was_encoded=true;
      epmem_edge_removals.put(w.epmem_id,true);
      if (!lti) {
        LinkedList<EpisodicMemoryIdPair> p=epmem_id_replacement.get(w.epmem_id);
        p.addFirst(new EpisodicMemoryIdPair(w.value.asIdentifier().epmem_id,w.epmem_id));
        epmem_id_replacement.remove(p);
      }
    }
    if (!lti && (w.value.asIdentifier().epmem_id != EPMEM_NODEID_BAD) && (w.value.asIdentifier().epmem_valid == epmem_validation)) {
      Set<WmeImpl> my_refs=epmem_id_ref_counts.get(w.value.asIdentifier().epmem_id);
      if (my_refs == null) {
        my_refs=new LinkedHashSet<WmeImpl>();
        epmem_id_ref_counts.put(w.value.asIdentifier().epmem_id,my_refs);
      }
      if (my_refs.contains(w)) {
        my_refs.remove(w);
        boolean recurse=true;
        for (        WmeImpl rc_it : my_refs) {
          if (rc_it == null || rc_it.id.level == decider.top_state.level) {
            recurse=false;
            break;
          }
        }
        if (recurse) {
          my_refs.clear();
          epmem_id_removes.push(w.value);
        }
      }
    }
  }
 else   if ((w.epmem_id != EPMEM_NODEID_BAD) && (w.epmem_valid == epmem_validation)) {
    was_encoded=true;
    epmem_node_removals.put(w.epmem_id,true);
  }
  if (was_encoded) {
    w.epmem_id=EPMEM_NODEID_BAD;
    w.epmem_valid=0;
  }
}

Fixed version (ground truth):
@Override public void removeWme(WmeImpl w){
  boolean was_encoded=false;
  if (w.value.asIdentifier() != null) {
    boolean lti=(w.value.asIdentifier().smem_lti != 0);
    if ((w.epmem_id != EPMEM_NODEID_BAD) && (w.epmem_valid == epmem_validation)) {
      was_encoded=true;
      epmem_edge_removals.put(w.epmem_id,true);
      if (!lti) {
        LinkedList<EpisodicMemoryIdPair> p=epmem_id_replacement.get(w.epmem_id);
        p.addFirst(new EpisodicMemoryIdPair(w.value.asIdentifier().epmem_id,w.epmem_id));
        epmem_id_replacement.remove(p);
      }
    }
    if (!lti && (w.value.asIdentifier().epmem_id != EPMEM_NODEID_BAD) && (w.value.asIdentifier().epmem_valid == epmem_validation)) {
      Set<WmeImpl> my_refs=epmem_id_ref_counts.get(w.value.asIdentifier().epmem_id);
      if (my_refs == null) {
        my_refs=new LinkedHashSet<WmeImpl>();
        epmem_id_ref_counts.put(w.value.asIdentifier().epmem_id,my_refs);
      }
      if (my_refs.contains(w)) {
        my_refs.remove(w);
        if (my_refs.isEmpty()) {
          my_refs.clear();
          epmem_id_removes.push(w.value);
        }
      }
    }
  }
 else   if ((w.epmem_id != EPMEM_NODEID_BAD) && (w.epmem_valid == epmem_validation)) {
    was_encoded=true;
    epmem_node_removals.put(w.epmem_id,true);
  }
  if (was_encoded) {
    w.epmem_id=EPMEM_NODEID_BAD;
    w.epmem_valid=0;
  }
}
Program: 12138
Project: 12138
Buggy source:
@Test public void testCountEpMem() throws Exception {
}

Fixed version (ground truth):
@Test public void testCountEpMem() throws Exception {
  runTest("String_Node_Str",1693);
}
Program: 12144
Project: 12144
Buggy source:
@Override public String ExecuteCommandLine(String command){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public String ExecuteCommandLine(String command){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12145
Project: 12145
Buggy source:
@Override public boolean LoadProductions(String file){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public boolean LoadProductions(String file){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12146
Project: 12146
Buggy source:
@Override public Object getAgentImpl(){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public Object getAgentImpl(){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12147
Project: 12147
Buggy source:
@Override public String RunSelfForever(){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public String RunSelfForever(){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12148
Project: 12148
Buggy source:
@Override public String RunSelf(Integer decisionCyclesToRun){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public String RunSelf(Integer decisionCyclesToRun){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12149
Project: 12149
Buggy source:
@Override public CSoarAgentWrapper CreateAgent(String name){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public CSoarAgentWrapper CreateAgent(String name){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12150
Project: 12150
Buggy source:
@Override public void DestroyAgent(CSoarAgentWrapper agent){
  System.out.println("String_Node_Str");
  throw new RuntimeException();
}

Fixed version (ground truth):
@Override public void DestroyAgent(CSoarAgentWrapper agent){
  System.out.println("String_Node_Str");
  throw new RuntimeException("String_Node_Str");
}
Program: 12153
Project: 12153
Buggy source:
private int parseConfiguration(OptionProcessor<Options> options){
  String configurationPath=options.get(Options.Configuration);
  if (!configurationPath.endsWith("String_Node_Str")) {
    out.println("String_Node_Str");
    return EXIT_FAILURE_CONFIGURATION;
  }
  Configuration config=new Configuration(configurationPath);
  int result=Configuration.PARSE_FAILURE;
  try {
    result=config.parse();
  }
 catch (  IOException|UnknownPropertyException|InvalidTestNameException|MalformedTestCategory e) {
    out.println(e.getMessage());
    return EXIT_FAILURE;
  }
  if (result != Configuration.PARSE_SUCCESS) {
    out.println("String_Node_Str");
    return EXIT_FAILURE_CONFIGURATION;
  }
  defaultTestSettings=config.getDefaultSettings();
  if (!defaultTestSettings.isJSoarEnabled() && !defaultTestSettings.isCSoarEnabled()) {
    out.println("String_Node_Str");
    defaultTestSettings.setJSoarEnabled(true);
  }
  if (defaultTestSettings.isCSoarEnabled()) {
    csoarPaths=defaultTestSettings.getCSoarVersions();
  }
  configurationTests=config.getConfigurationTests();
  return NON_EXIT;
}

Fixed version (ground truth):
private int parseConfiguration(OptionProcessor<Options> options){
  String configurationPath=options.get(Options.Configuration);
  if (!configurationPath.endsWith("String_Node_Str")) {
    out.println("String_Node_Str");
    return EXIT_FAILURE_CONFIGURATION;
  }
  Configuration config=new Configuration(configurationPath);
  int result=Configuration.PARSE_FAILURE;
  try {
    result=config.parse();
  }
 catch (  IOException|UnknownPropertyException|InvalidTestNameException|MalformedTestCategory e) {
    out.println(e.getMessage());
    return EXIT_FAILURE;
  }
  if (result != Configuration.PARSE_SUCCESS) {
    out.println("String_Node_Str");
    return EXIT_FAILURE_CONFIGURATION;
  }
  defaultTestSettings=config.getDefaultSettings();
  if (!defaultTestSettings.isJSoarEnabled() && !defaultTestSettings.isCSoarEnabled()) {
    out.println("String_Node_Str");
    defaultTestSettings.setJSoarEnabled(true);
  }
  configurationTests=config.getConfigurationTests();
  return NON_EXIT;
}
Program: 12157
Project: 12157
Buggy source:
public Symbol readIdentifierOrContextVariable(String t){
  ContextVariableInfo info=ContextVariableInfo.get(predefinedSyms,decider.top_goal,decider.bottom_goal,t);
  if (info.getValue() != null) {
    return info.getValue();
  }
  if (t.length() < 2 || !Character.isLetter(t.charAt(0)))   return null;
  final char letter=Character.toUpperCase(t.charAt(0));
  long number=1;
  try {
    number=Long.parseLong(t.substring(1));
  }
 catch (  NumberFormatException e) {
    return null;
  }
  return syms.findIdentifier(letter,number);
}

Fixed version (ground truth):
public Symbol readIdentifierOrContextVariable(String t){
  ContextVariableInfo info=ContextVariableInfo.get(predefinedSyms,decider.top_goal,decider.bottom_goal,t);
  if (info.getValue() != null) {
    return info.getValue();
  }
  if (t.charAt(0) == '@') {
    t=t.substring(1);
  }
  if (t.length() < 2 || !Character.isLetter(t.charAt(0))) {
    return null;
  }
  final char letter=Character.toUpperCase(t.charAt(0));
  long number=1;
  try {
    number=Long.parseLong(t.substring(1));
  }
 catch (  NumberFormatException e) {
    return null;
  }
  return syms.findIdentifier(letter,number);
}
Program: 12158
Project: 12158
Buggy source:
/** 
 * Make sure an URL is normalized, i.e. does not contain any .. or . path components.
 * @param url the url to normalize
 * @return normalized URL
 * @throws SoarException if there are any problems with the URL
 */
private URL normalizeUrl(URL url) throws SoarException {
  try {
    return url.toURI().normalize().toURL();
  }
 catch (  MalformedURLException e) {
    throw new SoarException(e.getMessage(),e);
  }
catch (  URISyntaxException e) {
    throw new SoarException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Make sure an URL is normalized, i.e. does not contain any .. or . path components.
 * @param url the url to normalize
 * @return normalized URL
 * @throws SoarException if there are any problems with the URL
 */
private URL normalizeUrl(URL url) throws SoarException {
  try {
    return (new URI(null,url.toString(),null)).normalize().toURL();
  }
 catch (  MalformedURLException e) {
    throw new SoarException(e.getMessage(),e);
  }
catch (  URISyntaxException e) {
    throw new SoarException(e.getMessage(),e);
  }
}
Program: 12161
Project: 12161
Buggy source:
PreparedStatement smem_setup_web_crawl(WeightedCueElement el) throws SQLException {
  PreparedStatement q=null;
  if (el.element_type == smem_cue_element_type.attr_t) {
    q=db.web_attr_all;
  }
 else   if (el.element_type == smem_cue_element_type.value_const_t) {
    q=db.web_const_all;
    q.setLong(2,el.value_hash);
  }
 else   if (el.element_type == smem_cue_element_type.value_lti_t) {
    q=db.web_lti_all;
    q.setLong(2,el.value_lti);
  }
  q.setLong(1,el.value_hash);
  return q;
}

Fixed version (ground truth):
PreparedStatement smem_setup_web_crawl(WeightedCueElement el) throws SQLException {
  PreparedStatement q=null;
  if (el.element_type == smem_cue_element_type.attr_t) {
    q=db.web_attr_all;
  }
 else   if (el.element_type == smem_cue_element_type.value_const_t) {
    q=db.web_const_all;
    q.setLong(2,el.value_hash);
  }
 else   if (el.element_type == smem_cue_element_type.value_lti_t) {
    q=db.web_lti_all;
    q.setLong(2,el.value_lti);
  }
  q.setLong(1,el.attr_hash);
  return q;
}
Program: 12164
Project: 12164
Buggy source:
public void initialize(){
  this.symbols=Adaptables.require(DefaultSemanticMemory.class,context,SymbolFactoryImpl.class);
  this.predefinedSyms=new SemanticMemorySymbols(this.symbols);
  this.chunker=Adaptables.adapt(context,Chunker.class);
  this.decider=Adaptables.adapt(context,Decider.class);
  this.recMem=Adaptables.adapt(context,RecognitionMemory.class);
  this.epmem=Adaptables.require(DefaultEpisodicMemory.class,context,DefaultEpisodicMemory.class);
  Agent agent=Adaptables.adapt(context,Agent.class);
  this.trace=agent.getTrace();
  final PropertyManager properties=Adaptables.require(DefaultSemanticMemory.class,context,PropertyManager.class);
  params=new DefaultSemanticMemoryParams(properties);
  stats=new DefaultSemanticMemoryStats(properties);
}

Fixed version (ground truth):
public void initialize(){
  this.symbols=Adaptables.require(DefaultSemanticMemory.class,context,SymbolFactoryImpl.class);
  this.predefinedSyms=new SemanticMemorySymbols(this.symbols);
  this.chunker=Adaptables.adapt(context,Chunker.class);
  this.decider=Adaptables.adapt(context,Decider.class);
  this.recMem=Adaptables.adapt(context,RecognitionMemory.class);
  this.epmem=Adaptables.require(DefaultSemanticMemory.class,context,DefaultEpisodicMemory.class);
  Agent agent=Adaptables.adapt(context,Agent.class);
  this.trace=agent.getTrace();
  final PropertyManager properties=Adaptables.require(DefaultSemanticMemory.class,context,PropertyManager.class);
  params=new DefaultSemanticMemoryParams(properties);
  stats=new DefaultSemanticMemoryStats(properties);
}
Program: 12165
Project: 12165
Buggy source:
@Before public void setUp() throws Exception {
  context=AdaptableContainer.from(new SymbolFactoryImpl(),new PropertyManager());
  conn=JdbcTools.connect("String_Node_Str","String_Node_Str");
  final SemanticMemoryDatabase db=new SemanticMemoryDatabase("String_Node_Str",conn);
  db.structure();
  db.prepare();
  smem=new DefaultSemanticMemory(context,db);
  smem.initialize();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  context=AdaptableContainer.from(new SymbolFactoryImpl(),new PropertyManager(),new Agent());
  conn=JdbcTools.connect("String_Node_Str","String_Node_Str");
  final SemanticMemoryDatabase db=new SemanticMemoryDatabase("String_Node_Str",conn);
  db.structure();
  db.prepare();
  smem=new DefaultSemanticMemory(context,db);
  smem.initialize();
}
Program: 12166
Project: 12166
Buggy source:
@Test public void testSimpleNonCueBasedRetrieval() throws Exception {
  runTest("String_Node_Str",2);
}

Fixed version (ground truth):
@Test public void testSimpleNonCueBasedRetrieval() throws Exception {
  agent.setStopPhase(Phase.OUTPUT);
  runTest("String_Node_Str",2);
}
Program: 12167
Project: 12167
Buggy source:
@Test public void testSimpleStore() throws Exception {
  runTest("String_Node_Str",2);
}

Fixed version (ground truth):
@Test public void testSimpleStore() throws Exception {
  agent.setStopPhase(Phase.OUTPUT);
  runTest("String_Node_Str",2);
}
Program: 12168
Project: 12168
Buggy source:
@Test public void testSimpleCueBasedRetrieval() throws Exception {
  runTest("String_Node_Str",1);
}

Fixed version (ground truth):
@Test public void testSimpleCueBasedRetrieval() throws Exception {
  agent.setStopPhase(Phase.OUTPUT);
  runTest("String_Node_Str",1);
}
Program: 12169
Project: 12169
Buggy source:
@Test public void testCanCreateInitialTables() throws Exception {
  final SemanticMemoryDatabase smdb=new SemanticMemoryDatabase("String_Node_Str",db);
  smdb.structure();
  final Set<String> tables=new HashSet<String>();
  final ResultSet rs=db.getMetaData().getTables(null,null,null,new String[]{"String_Node_Str"});
  while (rs.next()) {
    tables.add(rs.getString("String_Node_Str").toLowerCase());
  }
  final String[] expectedTables=new String[]{SemanticMemoryDatabase.SMEM_SIGNATURE,SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str"};
  for (  String expected : expectedTables) {
    assertTrue("String_Node_Str" + expected + "String_Node_Str",tables.contains(expected));
  }
  assertEquals(expectedTables.length,tables.size());
}

Fixed version (ground truth):
@Test public void testCanCreateInitialTables() throws Exception {
  final SemanticMemoryDatabase smdb=new SemanticMemoryDatabase("String_Node_Str",db);
  smdb.structure();
  final Set<String> tables=new HashSet<String>();
  final ResultSet rs=db.getMetaData().getTables(null,null,null,new String[]{"String_Node_Str"});
  while (rs.next()) {
    tables.add(rs.getString("String_Node_Str").toLowerCase());
  }
  final String[] expectedTables=new String[]{SemanticMemoryDatabase.SMEM_SIGNATURE,SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str"};
  for (  String expected : expectedTables) {
    assertTrue("String_Node_Str" + expected + "String_Node_Str",tables.contains(expected));
  }
  assertEquals(expectedTables.length,tables.size());
}
Program: 12170
Project: 12170
Buggy source:
@Test public void testCanCreateInitialIndexes() throws Exception {
  final SemanticMemoryDatabase smdb=new SemanticMemoryDatabase("String_Node_Str",db);
  smdb.structure();
  final Set<String> tables=new HashSet<String>();
  final ResultSet rs=db.getMetaData().getTables(null,null,null,new String[]{"String_Node_Str"});
  while (rs.next()) {
    tables.add(rs.getString("String_Node_Str").toLowerCase());
  }
  final String[] expectedTables=new String[]{SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str"};
  for (  String expected : expectedTables) {
    assertTrue("String_Node_Str" + expected + "String_Node_Str",tables.contains(expected));
  }
  assertEquals(expectedTables.length,tables.size());
}

Fixed version (ground truth):
@Test public void testCanCreateInitialIndexes() throws Exception {
  final SemanticMemoryDatabase smdb=new SemanticMemoryDatabase("String_Node_Str",db);
  smdb.structure();
  final Set<String> tables=new HashSet<String>();
  final ResultSet rs=db.getMetaData().getTables(null,null,null,new String[]{"String_Node_Str"});
  while (rs.next()) {
    tables.add(rs.getString("String_Node_Str").toLowerCase());
  }
  final String[] expectedTables=new String[]{SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str",SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str","String_Node_Str" + SemanticMemoryDatabase.SMEM_SCHEMA + "String_Node_Str"};
  for (  String expected : expectedTables) {
    assertTrue("String_Node_Str" + expected + "String_Node_Str",tables.contains(expected));
  }
  assertEquals(expectedTables.length,tables.size());
}
Program: 12171
Project: 12171
Buggy source:
public boolean runTestsForAverage(int runCount,int warmUpCount) throws SoarException {
  if (runCount < (warmUpCount + 1))   return false;
  out.print("String_Node_Str");
  out.flush();
  for (int i=0; i < warmUpCount; i++) {
    test.reset();
    boolean result=test.run(i);
    if (!result)     return false;
    out.print("String_Node_Str");
    out.flush();
  }
  runs=runCount;
  out.print("String_Node_Str" + "String_Node_Str");
  out.flush();
  for (int i=0; i < runCount; i++) {
    boolean result=runSingleIteration(i);
    if (!result)     return false;
    out.print("String_Node_Str");
    out.flush();
  }
  out.print("String_Node_Str");
  out.flush();
  return true;
}

Fixed version (ground truth):
public boolean runTestsForAverage(int runCount,int warmUpCount) throws SoarException {
  out.print("String_Node_Str");
  out.flush();
  for (int i=0; i < warmUpCount; i++) {
    test.reset();
    boolean result=test.run(i);
    if (!result)     return false;
    out.print("String_Node_Str");
    out.flush();
  }
  runs=runCount;
  out.print("String_Node_Str" + "String_Node_Str");
  out.flush();
  for (int i=0; i < runCount; i++) {
    boolean result=runSingleIteration(i);
    if (!result)     return false;
    out.print("String_Node_Str");
    out.flush();
  }
  out.print("String_Node_Str");
  out.flush();
  return true;
}
Program: 12175
Project: 12175
Buggy source:
public PreparedStatement request(){
  try {
    return db.prepareStatement(sql);
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public PreparedStatement request(){
  try {
    return new SoarPreparedStatement(db.prepareStatement(sql),sql);
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 12176
Project: 12176
Buggy source:
private PreparedStatement prepareNamedStatement(String name) throws SoarException {
  final String sql=statements.getProperty(name);
  if (sql == null) {
    throw new SoarException("String_Node_Str" + name + "String_Node_Str");
  }
  try {
    final String trimmed=sql.trim();
    return trimmed.startsWith("String_Node_Str") ? db.prepareStatement(trimmed,Statement.RETURN_GENERATED_KEYS) : db.prepareStatement(trimmed);
  }
 catch (  SQLException e) {
    throw new SoarException("String_Node_Str" + sql + "String_Node_Str"+ e.getMessage(),e);
  }
}

Fixed version (ground truth):
private PreparedStatement prepareNamedStatement(String name) throws SoarException {
  final String sql=statements.getProperty(name);
  if (sql == null) {
    throw new SoarException("String_Node_Str" + name + "String_Node_Str");
  }
  try {
    final String trimmed=sql.trim();
    return trimmed.startsWith("String_Node_Str") ? new SoarPreparedStatement(db.prepareStatement(trimmed,Statement.RETURN_GENERATED_KEYS),trimmed) : new SoarPreparedStatement(db.prepareStatement(trimmed),trimmed);
  }
 catch (  SQLException e) {
    throw new SoarException("String_Node_Str" + sql + "String_Node_Str"+ e.getMessage(),e);
  }
}
Program: 12177
Project: 12177
Buggy source:
/** 
 * Writes out the children of a particular   {@link ReteNode}. <p>rete.cpp:7270:retesave_children_of_node
 * @see ReteNetReader#readChildrenOfNode
 */
private void writeChildrenOfNode(DataOutputStream dos,ReteNode node) throws IOException, SoarException {
  ReteNode child;
  int numChildren=0;
  for (child=node.first_child; child != null; child=child.next_sibling) {
    if (child.node_type != ReteNodeType.CN_BNODE) {
      numChildren++;
    }
  }
  dos.writeInt(numChildren);
  for (child=node.first_child; child != null; child=child.next_sibling) {
    if (child.node_type != ReteNodeType.CN_BNODE) {
      writeNodeAndChildren(dos,child);
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes out the children of a particular   {@link ReteNode}. <p>rete.cpp:7270:retesave_children_of_node
 * @see ReteNetReader#readChildrenOfNode
 */
private void writeChildrenOfNode(DataOutputStream dos,ReteNode node) throws IOException, SoarException {
  final Stack<ReteNode> children=new Stack<ReteNode>();
  for (ReteNode child=node.first_child; child != null; child=child.next_sibling) {
    if (child.node_type != ReteNodeType.CN_BNODE) {
      children.push(child);
    }
  }
  dos.writeInt(children.size());
  while (!children.empty()) {
    writeNodeAndChildren(dos,children.pop());
  }
}
Program: 12183
Project: 12183
Buggy source:
/** 
 * This is called when the agent is initialized. This code here in CSoar is usually run at agent creation.
 */
public void initialize(){
  agent=Adaptables.require(DefaultEpisodicMemory.class,context,Agent.class);
  symbols=Adaptables.require(DefaultEpisodicMemory.class,context,SymbolFactoryImpl.class);
  final PropertyManager properties=Adaptables.require(DefaultEpisodicMemory.class,context,PropertyManager.class);
  decider=Adaptables.adapt(context,Decider.class);
  params=new DefaultEpisodicMemoryParams(properties,symbols);
  stats=new DefaultEpisodicMemoryStats(properties);
  epmem_init_db_catch();
  epmem_node_removals=Maps.newHashMap();
  epmem_node_mins=Lists.newArrayList();
  epmem_node_maxes=Lists.newArrayList();
  epmem_edge_removals=Maps.newHashMap();
  epmem_edge_mins=Lists.newArrayList();
  epmem_edge_maxes=Lists.newArrayList();
  epmem_id_repository=Maps.newHashMap();
  epmem_id_replacement=Maps.newHashMap();
  epmem_id_ref_counts=Maps.newHashMap();
  epmem_id_removes=Lists.newLinkedList();
  soarModule.initialize(context);
}

Fixed version (ground truth):
/** 
 * This is called when the agent is initialized. This code here in CSoar is usually run at agent creation.
 */
public void initialize(){
  agent=Adaptables.require(DefaultEpisodicMemory.class,context,Agent.class);
  symbols=Adaptables.require(DefaultEpisodicMemory.class,context,SymbolFactoryImpl.class);
  final PropertyManager properties=Adaptables.require(DefaultEpisodicMemory.class,context,PropertyManager.class);
  decider=Adaptables.adapt(context,Decider.class);
  params=new DefaultEpisodicMemoryParams(properties,symbols);
  stats=new DefaultEpisodicMemoryStats(properties);
  predefinedSyms=new EpisodicMemorySymbols(symbols);
  epmem_node_removals=Maps.newHashMap();
  epmem_node_mins=Lists.newArrayList();
  epmem_node_maxes=Lists.newArrayList();
  epmem_edge_removals=Maps.newHashMap();
  epmem_edge_mins=Lists.newArrayList();
  epmem_edge_maxes=Lists.newArrayList();
  epmem_id_repository=Maps.newHashMap();
  epmem_id_replacement=Maps.newHashMap();
  epmem_id_ref_counts=Maps.newHashMap();
  epmem_id_removes=Lists.newLinkedList();
  epmem_init_db_catch();
  soarModule.initialize(context);
}
Program: 12184
Project: 12184
Buggy source:
private ReteTest readTest(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException {
  Symbol sym;
  int type=dis.readInt();
  int right_field_num=dis.readInt();
  ReteTest rt=new ReteTest(type);
  if (rt.test_is_constant_relational_test()) {
    sym=symbolMap.get(dis.readInt());
    rt=ReteTest.createConstantTest(type,right_field_num,(SymbolImpl)sym);
  }
 else   if (rt.test_is_variable_relational_test()) {
    int field_num=dis.readInt();
    int levels_up=dis.readInt();
    rt=ReteTest.createVariableTest(type,right_field_num,new VarLocation(levels_up,field_num));
  }
 else   if (type == ReteTest.DISJUNCTION) {
    int count=dis.readInt();
    List<SymbolImpl> disjuncts=new ArrayList<SymbolImpl>(count);
    while (count-- > 0) {
      sym=symbolMap.get(dis.readInt());
      disjuncts.add((SymbolImpl)sym);
    }
    rt=ReteTest.createDisjunctionTest(right_field_num,disjuncts);
  }
 else {
    rt=null;
  }
  return rt;
}

Fixed version (ground truth):
private ReteTest readTest(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  SymbolImpl sym;
  int type=dis.readInt();
  int right_field_num=dis.readInt();
  ReteTest rt=new ReteTest(type);
  if (rt.test_is_constant_relational_test()) {
    type-=ReteTest.CONSTANT_RELATIONAL;
    sym=getSymbol(symbolMap,dis.readInt());
    rt=ReteTest.createConstantTest(type,right_field_num,(SymbolImpl)sym);
  }
 else   if (rt.test_is_variable_relational_test()) {
    type-=ReteTest.VARIABLE_RELATIONAL;
    int field_num=dis.readInt();
    int levels_up=dis.readInt();
    rt=ReteTest.createVariableTest(type,right_field_num,new VarLocation(levels_up,field_num));
  }
 else   if (type == ReteTest.DISJUNCTION) {
    int count=dis.readInt();
    List<SymbolImpl> disjuncts=new ArrayList<SymbolImpl>(count);
    while (count-- > 0) {
      sym=getSymbol(symbolMap,dis.readInt());
      disjuncts.add((SymbolImpl)sym);
    }
    rt=ReteTest.createDisjunctionTest(right_field_num,disjuncts);
  }
 else   if (type == ReteTest.ID_IS_GOAL) {
    rt=ReteTest.createGoalIdTest();
  }
 else   if (type == ReteTest.ID_IS_IMPASSE) {
    rt=ReteTest.createImpasseIdTest();
  }
 else {
    throw new SoarException("String_Node_Str" + rt + "String_Node_Str"+ type+ "String_Node_Str");
  }
  return rt;
}
Program: 12185
Project: 12185
Buggy source:
private static NodeVarNames readNodeVarNames(DataInputStream dis,ReteNode node,List<Symbol> symbolMap) throws SoarException, IOException {
  if (node.node_type == ReteNodeType.DUMMY_TOP_BNODE) {
    return null;
  }
  if (node.node_type == ReteNodeType.CN_BNODE) {
    ReteNode temp=node.b_cn().partner.parent;
    NodeVarNames nvn_for_ncc=readNodeVarNames(dis,temp,symbolMap);
    final NodeVarNames bottom_of_subconditions=nvn_for_ncc;
    while (temp != node.parent) {
      temp=temp.real_parent_node();
      nvn_for_ncc=nvn_for_ncc.parent;
    }
    return NodeVarNames.createForNcc(nvn_for_ncc,bottom_of_subconditions);
  }
  return NodeVarNames.newInstance(readNodeVarNames(dis,node.real_parent_node(),symbolMap),readVarNames(dis,symbolMap),readVarNames(dis,symbolMap),readVarNames(dis,symbolMap));
}

Fixed version (ground truth):
private static NodeVarNames readNodeVarNames(DataInputStream dis,ReteNode node,List<Symbol> symbolMap) throws SoarException, IOException {
  if (node.node_type == ReteNodeType.DUMMY_TOP_BNODE) {
    return null;
  }
  if (node.node_type == ReteNodeType.CN_BNODE) {
    ReteNode temp=node.b_cn().partner.parent;
    NodeVarNames nvn_for_ncc=readNodeVarNames(dis,temp,symbolMap);
    final NodeVarNames bottom_of_subconditions=nvn_for_ncc;
    while (temp != node.parent) {
      temp=temp.real_parent_node();
      nvn_for_ncc=nvn_for_ncc.parent;
    }
    return NodeVarNames.createForNcc(nvn_for_ncc,bottom_of_subconditions);
  }
  Object id=readVarNames(dis,symbolMap);
  Object attr=readVarNames(dis,symbolMap);
  Object value=readVarNames(dis,symbolMap);
  NodeVarNames parent=readNodeVarNames(dis,node.real_parent_node(),symbolMap);
  return NodeVarNames.newInstance(parent,id,attr,value);
}
Program: 12186
Project: 12186
Buggy source:
private ReteTest readTestList(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException {
  ReteTest rt, prev_rt, first;
  int count;
  prev_rt=null;
  first=null;
  count=dis.readInt();
  while (count-- > 0) {
    rt=readTest(dis,symbolMap,alphaMemories);
    if (prev_rt != null) {
      prev_rt.next=rt;
    }
 else {
      first=rt;
    }
    prev_rt=rt;
  }
  if (prev_rt != null) {
    prev_rt.next=null;
  }
 else {
    first=null;
  }
  return first;
}

Fixed version (ground truth):
private ReteTest readTestList(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  ReteTest rt, prev_rt, first;
  int count;
  prev_rt=null;
  first=null;
  count=dis.readInt();
  while (count-- > 0) {
    rt=readTest(dis,symbolMap,alphaMemories);
    if (prev_rt != null) {
      prev_rt.next=rt;
    }
 else {
      first=rt;
    }
    prev_rt=rt;
  }
  if (prev_rt != null) {
    prev_rt.next=null;
  }
 else {
    first=null;
  }
  return first;
}
Program: 12187
Project: 12187
Buggy source:
protected ReteNetReader(Agent context){
  Arguments.checkNotNull(context,"String_Node_Str");
  this.context=context;
  this.syms=Adaptables.require(getClass(),context,SymbolFactoryImpl.class);
  this.rete=Adaptables.require(getClass(),context,Rete.class);
  this.productionManager=context.getProductions();
}

Fixed version (ground truth):
protected ReteNetReader(Agent context){
  Arguments.checkNotNull(context,"String_Node_Str");
  this.context=context;
  this.syms=Adaptables.require(getClass(),context,SymbolFactoryImpl.class);
  this.rete=Adaptables.require(getClass(),context,Rete.class);
  this.rl=Adaptables.require(getClass(),context,ReinforcementLearning.class);
  this.productionManager=context.getProductions();
}
Program: 12188
Project: 12188
Buggy source:
private RhsValue reteload_rhs_value(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  RhsValue rv=null;
  Symbol sym;
  int field_num;
  int type;
  int levels_up;
  type=dis.readInt();
switch (type) {
case 0:
    sym=symbolMap.get(dis.readInt());
  rv=(RhsValue)sym;
break;
case 1:
sym=symbolMap.get(dis.readInt());
boolean isStandalone=dis.readBoolean();
RhsFunctionHandler rf=context.getRhsFunctions().getHandler(sym.asString().getValue());
if (rf == null) {
throw new SoarException("String_Node_Str" + sym.asString().getValue());
}
RhsFunctionCall funCall=new RhsFunctionCall(sym.asString(),isStandalone);
int count=dis.readInt();
while (count-- > 0) {
funCall.addArgument(reteload_rhs_value(dis,symbolMap,alphaMemories));
}
rv=funCall;
break;
case 2:
field_num=dis.readInt();
levels_up=dis.readInt();
rv=ReteLocation.create(field_num,levels_up);
break;
case 3:
int i=dis.readInt();
rete.update_max_rhs_unbound_variables(i + 1);
rv=UnboundVariable.create(i);
break;
}
return rv;
}

Fixed version (ground truth):
private RhsValue reteload_rhs_value(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  RhsValue rv=null;
  SymbolImpl sym;
  int field_num;
  int type;
  int levels_up;
  type=dis.readInt();
switch (type) {
case 0:
    sym=getSymbol(symbolMap,dis.readInt());
  rv=new RhsSymbolValue(sym);
break;
case 1:
sym=getSymbol(symbolMap,dis.readInt());
boolean isStandalone=dis.readBoolean();
RhsFunctionCall funCall=new RhsFunctionCall(sym.asString(),isStandalone);
int count=dis.readInt();
while (count-- > 0) {
funCall.addArgument(reteload_rhs_value(dis,symbolMap,alphaMemories));
}
rv=funCall;
break;
case 2:
field_num=dis.readInt();
levels_up=dis.readInt();
rv=ReteLocation.create(field_num,levels_up);
break;
case 3:
int i=dis.readInt();
rete.update_max_rhs_unbound_variables(i + 1);
rv=UnboundVariable.create(i);
break;
}
return rv;
}
Program: 12190
Project: 12190
Buggy source:
private Action readRHSAction(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  int type=dis.readInt();
  Action a=null;
  if (type == 0) {
    a=new MakeAction();
  }
 else   if (type == 1) {
    a=new FunctionAction(null);
  }
  a.preference_type=PreferenceType.valueOf(dis.readUTF());
  a.support=ActionSupport.valueOf(dis.readUTF());
  if (type == 1) {
    FunctionAction fa=a.asFunctionAction();
    fa.call=reteload_rhs_value(dis,symbolMap,alphaMemories).asFunctionCall();
  }
 else   if (type == 0) {
    MakeAction ma=a.asMakeAction();
    ma.id=reteload_rhs_value(dis,symbolMap,alphaMemories);
    ma.attr=reteload_rhs_value(dis,symbolMap,alphaMemories);
    ma.value=reteload_rhs_value(dis,symbolMap,alphaMemories);
    if (a.preference_type.isBinary()) {
      ma.referent=reteload_rhs_value(dis,symbolMap,alphaMemories);
    }
 else {
      ma.referent=null;
    }
  }
  return a;
}

Fixed version (ground truth):
private Action readRHSAction(DataInputStream dis,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  int type=dis.readInt();
  Action a=null;
  if (type == 0) {
    a=new MakeAction();
  }
 else   if (type == 1) {
    a=new FunctionAction(null);
  }
  boolean hasPreferenceType=dis.readBoolean();
  if (hasPreferenceType) {
    String preference_type=dis.readUTF();
    a.preference_type=PreferenceType.valueOf(preference_type);
  }
 else {
    a.preference_type=null;
  }
  a.support=ActionSupport.valueOf(dis.readUTF());
  if (type == 1) {
    FunctionAction fa=a.asFunctionAction();
    fa.call=reteload_rhs_value(dis,symbolMap,alphaMemories).asFunctionCall();
  }
 else   if (type == 0) {
    MakeAction ma=a.asMakeAction();
    ma.id=reteload_rhs_value(dis,symbolMap,alphaMemories);
    ma.attr=reteload_rhs_value(dis,symbolMap,alphaMemories);
    ma.value=reteload_rhs_value(dis,symbolMap,alphaMemories);
    if (a.preference_type != null && a.preference_type.isBinary()) {
      ma.referent=reteload_rhs_value(dis,symbolMap,alphaMemories);
    }
 else {
      ma.referent=null;
    }
  }
  return a;
}
Program: 12191
Project: 12191
Buggy source:
@Override public Identifier xmlToWme(File file){
  Element root=getRootElement(file);
  xmlPath.pushTag(root.getNodeName());
  return super.fromXml(root);
}

Fixed version (ground truth):
@Override public Identifier xmlToWme(File file){
  Element root=getRootElement(file);
  xmlPath.pushTag(root.getNodeName());
  Identifier ret=super.fromXml(root);
  xmlPath.popTag();
  return ret;
}
Program: 12192
Project: 12192
Buggy source:
@Override public Identifier fromXml(Element element){
  xmlPath.pushTag(element.getNodeName());
  return super.fromXml(element);
}

Fixed version (ground truth):
@Override public Identifier fromXml(Element element){
  xmlPath.pushTag(element.getNodeName());
  Identifier ret=super.fromXml(element);
  xmlPath.popTag();
  return ret;
}
Program: 12194
Project: 12194
Buggy source:
/** 
 * This procedure prints a preference and the production which is the source of the preference. <p>NOTE: The called of this routine should be stepping thru slots only, (not stepping thru WMEs) and therefore input wmes and arch-wmes are already excluded and we can print :I when o_support is FALSE. <p>sml_KernelHelpers.cpp:794:print_preference_and_source
 * @param agnt
 * @param printer
 * @param pref
 * @throws IOException
 */
private void print_preference_and_source(Agent agnt,Printer printer,Preference pref) throws IOException {
  final TraceFormats traceFormats=Adaptables.adapt(agnt,TraceFormats.class);
  final PredefinedSymbols predefinedSyms=Adaptables.adapt(agnt,PredefinedSymbols.class);
  printer.print("String_Node_Str");
  if (pref.attr == predefinedSyms.operator_symbol) {
    traceFormats.print_object_trace(printer.getWriter(),pref.value);
  }
 else {
    printer.print("String_Node_Str",pref.id,pref.attr,pref.value);
  }
  if (pref.attr == predefinedSyms.operator_symbol) {
    printer.print("String_Node_Str",pref.type.getIndicator());
  }
  if (pref.type.isBinary())   traceFormats.print_object_trace(printer.getWriter(),pref.referent);
  if (pref.o_supported)   printer.print("String_Node_Str");
 else   printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  if (print_prod) {
    printer.print("String_Node_Str");
    pref.inst.trace(printer.asFormatter(),wtt);
    printer.print("String_Node_Str");
  }
}

Fixed version (ground truth):
private void print_preference_and_source(Agent agnt,Printer printer,Preference pref,Double selection_probability) throws IOException {
  final TraceFormats traceFormats=Adaptables.adapt(agnt,TraceFormats.class);
  final PredefinedSymbols predefinedSyms=Adaptables.adapt(agnt,PredefinedSymbols.class);
  printer.print("String_Node_Str");
  if (pref.attr == predefinedSyms.operator_symbol) {
    traceFormats.print_object_trace(printer.getWriter(),pref.value);
  }
 else {
    printer.print("String_Node_Str",pref.id,pref.attr,pref.value);
  }
  if (pref.attr == predefinedSyms.operator_symbol) {
    printer.print("String_Node_Str",pref.type.getIndicator());
  }
  if (pref.type.isBinary())   traceFormats.print_object_trace(printer.getWriter(),pref.referent);
  if (pref.o_supported)   printer.print("String_Node_Str");
 else   printer.print("String_Node_Str");
  if (selection_probability != null)   printer.print("String_Node_Str",selection_probability * 100.0);
  printer.print("String_Node_Str");
  if (print_prod) {
    printer.print("String_Node_Str");
    pref.inst.trace(printer.asFormatter(),wtt);
    printer.print("String_Node_Str");
  }
}
Program: 12195
Project: 12195
Buggy source:
/** 
 * <p>exploration.cpp:621:exploration_boltzmann_select
 */
private Preference exploration_boltzmann_select(Preference candidates){
  double temp=exploration_get_parameter_value("String_Node_Str");
  final Trace trace=context.getTrace();
  if (trace.isEnabled(Category.INDIFFERENT)) {
    for (Preference cand=candidates; cand != null; cand=cand.next_candidate) {
      trace.print("String_Node_Str",cand.value);
      trace.print("String_Node_Str",cand.numeric_value,Math.exp(cand.numeric_value / temp));
    }
  }
  double exp_max=Math.log(Double.MAX_VALUE);
  double q_max=exp_max * temp;
  double q_diff=0;
  if (candidates.next_candidate != null) {
    double q_high=candidates.numeric_value;
    double q_low=candidates.numeric_value;
    for (Preference cand=candidates.next_candidate; cand != null; cand=cand.next_candidate) {
      if (cand.numeric_value > q_high)       q_high=cand.numeric_value;
      if (cand.numeric_value < q_low)       q_low=cand.numeric_value;
    }
    q_diff=(q_high - q_low) / 2;
  }
 else {
    q_diff=candidates.numeric_value;
  }
  double total_probability=0.0;
  for (Preference cand=candidates; cand != null; cand=cand.next_candidate) {
    double q_val=(cand.numeric_value - q_diff);
    total_probability+=Math.exp((double)(q_val / temp));
    if (q_val > q_max) {
      context.getPrinter().warn("String_Node_Str",q_val,q_max);
    }
  }
  double rn=context.getRandom().nextDouble();
  double selected_probability=rn * total_probability;
  double current_sum=0.0;
  for (Preference cand=candidates; cand != null; cand=cand.next_candidate) {
    current_sum+=Math.exp((double)((cand.numeric_value - q_diff) / temp));
    if (selected_probability <= current_sum)     return cand;
  }
  return null;
}

Fixed version (ground truth):
Preference exploration_boltzmann_select(Preference candidates){
  double t=exploration_get_parameter_value("String_Node_Str");
  double maxq;
  Preference c;
  maxq=candidates.numeric_value;
  for (c=candidates.next_candidate; c != null; c=c.next_candidate) {
    if (maxq < c.numeric_value)     maxq=c.numeric_value;
  }
  double exptotal=0.0;
  List<Double> expvals=new LinkedList<Double>();
  for (c=candidates; c != null; c=c.next_candidate) {
    double v=Math.exp((c.numeric_value - maxq) / t);
    expvals.add(v);
    exptotal+=v;
  }
  final Trace trace=context.getTrace();
  if (trace.isEnabled(Category.INDIFFERENT)) {
    ListIterator<Double> i=expvals.listIterator();
    for (c=candidates; c != null; c=c.next_candidate) {
      double prob=i.next() / exptotal;
      trace.print("String_Node_Str",c.value);
      trace.print("String_Node_Str",c.numeric_value,prob);
    }
  }
  double r=context.getRandom().nextDouble() * exptotal;
  double sum=0.0;
  ListIterator<Double> i=expvals.listIterator();
  for (c=candidates, i=expvals.listIterator(); c != null; c=c.next_candidate) {
    sum+=i.next();
    if (sum >= r)     return c;
  }
  return null;
}
Program: 12196
Project: 12196
Buggy source:
/** 
 * prefmem.cpp:100:deallocate_preference
 * @param pref
 */
private void deallocate_preference(Preference pref,RecognitionMemory recMemory){
}

Fixed version (ground truth):
/** 
 * prefmem.cpp:100:deallocate_preference
 * @param pref
 */
static public void deallocate_preference(Preference pref,RecognitionMemory recMemory){
}
Program: 12198
Project: 12198
Buggy source:
/** 
 * Copy constructor used to negate pos and neg conditions. Test fields are only a shallow copy!
 */
protected ThreeFieldCondition(ThreeFieldCondition other){
  this.id_test=other.id_test;
  this.attr_test=other.attr_test;
  this.value_test=other.value_test;
}

Fixed version (ground truth):
/** 
 * Copy constructor used to negate pos and neg conditions. Test fields are only a shallow copy!
 */
protected ThreeFieldCondition(ThreeFieldCondition other){
  this.id_test=other.id_test;
  this.attr_test=other.attr_test;
  this.value_test=other.value_test;
  this.test_for_acceptable_preference=other.test_for_acceptable_preference;
}