nus-yam/ex-repair huggingface dataset:
Program: 12199
Project: 12199
Buggy source:
/** 
 * This deallocates the given instantiation. This should only be invoked via the possibly_deallocate_instantiation() macro. <p>recmem.cpp:757:deallocate_instantiation
 * @param inst
 */
private void deallocate_instantiation(Instantiation inst){
  int level=inst.match_goal_level;
  for (Condition cond=inst.top_of_instantiated_conditions; cond != null; cond=cond.next) {
    final PositiveCondition pc=cond.asPositiveCondition();
    if (pc != null) {
      final BackTraceInfo bt=pc.bt();
      if (bt.hasProhibits()) {
        for (        Preference pref : bt) {
          if (SoarConstants.DO_TOP_LEVEL_REF_CTS) {
            pref.preference_remove_ref(this);
          }
 else {
            if (level > SoarConstants.TOP_GOAL_LEVEL)             pref.preference_remove_ref(this);
          }
        }
        bt.clearProhibits();
      }
      if (bt.trace != null) {
        bt.trace.preference_remove_ref(this);
        bt.trace=null;
      }
    }
  }
  inst.top_of_instantiated_conditions=null;
  inst.bottom_of_instantiated_conditions=null;
  inst.nots=null;
}

Fixed version (ground truth):
/** 
 * This deallocates the given instantiation. This should only be invoked via the possibly_deallocate_instantiation() macro. <p>recmem.cpp:757:deallocate_instantiation
 * @param inst
 */
private void deallocate_instantiation(Instantiation inst){
  int level=inst.match_goal_level;
  for (Condition cond=inst.top_of_instantiated_conditions; cond != null; cond=cond.next) {
    final PositiveCondition pc=cond.asPositiveCondition();
    if (pc != null) {
      final BackTraceInfo bt=pc.bt();
      if (bt.hasProhibits()) {
        for (        Preference pref : bt) {
          if (SoarConstants.DO_TOP_LEVEL_REF_CTS) {
            pref.preference_remove_ref(this);
          }
 else {
            if (level > SoarConstants.TOP_GOAL_LEVEL)             pref.preference_remove_ref(this);
          }
        }
        bt.clearProhibits();
      }
      if (SoarConstants.DO_TOP_LEVEL_REF_CTS) {
        if (bt.trace != null) {
          bt.trace.preference_remove_ref(this);
          bt.trace=null;
        }
      }
 else {
        if (level > SoarConstants.TOP_GOAL_LEVEL) {
          if (bt.trace != null) {
            bt.trace.preference_remove_ref(this);
            bt.trace=null;
          }
        }
      }
    }
  }
  inst.top_of_instantiated_conditions=null;
  inst.bottom_of_instantiated_conditions=null;
  inst.nots=null;
}
Program: 12200
Project: 12200
Buggy source:
/** 
 * Process_o_rejects_and_deallocate_them() handles the processing of o-supported reject preferences. This routine is called from the firer and passed a list of all the o-rejects generated in the current preference phases (the list is linked via the "next" fields on the preference structures). This routine removes all preferences for matching values from TM, and deallocates the o-reject preferences when done. prefmem.cpp:330:process_o_rejects_and_deallocate_them
 * @param o_rejects
 */
private void process_o_rejects_and_deallocate_them(List<Preference> o_rejects){
  for (  Preference pref : o_rejects) {
    pref.preference_add_ref();
  }
  for (  Preference pref : o_rejects) {
    Slot s=Slot.find_slot(pref.id,pref.attr);
    if (s != null) {
      Preference p=s.getAllPreferences();
      while (p != null) {
        final Preference next_p=p.nextOfSlot;
        if (p.value == pref.value) {
          remove_preference_from_tm(p);
        }
        p=next_p;
      }
    }
    pref.preference_remove_ref(this);
  }
}

Fixed version (ground truth):
/** 
 * Process_o_rejects_and_deallocate_them() handles the processing of o-supported reject preferences. This routine is called from the firer and passed a list of all the o-rejects generated in the current preference phases (the list is linked via the "next" fields on the preference structures). This routine removes all preferences for matching values from TM, and deallocates the o-reject preferences when done. prefmem.cpp:330:process_o_rejects_and_deallocate_them
 * @param o_rejects
 * @param bufdeallo Preferences buffered for deallocation after innerelaboration loop completes.
 */
private void process_o_rejects_and_deallocate_them(List<Preference> o_rejects,List<Preference> bufdeallo){
  for (  Preference pref : o_rejects) {
    pref.preference_add_ref();
  }
  for (  Preference pref : o_rejects) {
    Slot s=Slot.find_slot(pref.id,pref.attr);
    if (s != null) {
      Preference p=s.getAllPreferences();
      while (p != null) {
        final Preference next_p=p.nextOfSlot;
        if (p.value == pref.value) {
          p.preference_add_ref();
          bufdeallo.add(p);
          remove_preference_from_tm(p);
        }
        p=next_p;
      }
    }
    pref.preference_remove_ref(this);
  }
}
Program: 12204
Project: 12204
Buggy source:
private void debugTest(List<TestCase> all,String name) throws SoarException, InterruptedException {
  final Test test=findTest(all,name);
  if (test == null) {
    out.println("String_Node_Str" + name + "String_Node_Str");
    System.exit(1);
  }
  out.printf("String_Node_Str",test.getTestCase().getName(),test.getName());
  final TestRunner runner=new TestRunner(agentFactory,out);
  runner.debugTest(test);
}

Fixed version (ground truth):
private void debugTest(List<TestCase> all,String name) throws SoarException, InterruptedException {
  final Test test=findTest(all,name);
  if (test == null) {
    out.println("String_Node_Str" + name + "String_Node_Str");
    System.exit(1);
  }
  out.printf("String_Node_Str",test.getTestCase().getName(),test.getName());
  final TestRunner runner=new TestRunner(agentFactory,out);
  runner.debugTest(test,fromCommandLine);
}
Program: 12205
Project: 12205
Buggy source:
TestAgent createTestAgent();

Fixed version (ground truth):
/** 
 * @return a new, uninitialized test agent
 */
TestAgent createTestAgent();
Program: 12206
Project: 12206
Buggy source:
void debugTest(Test test) throws SoarException, InterruptedException ;

Fixed version (ground truth):
/** 
 * Open the debugger, pre-loaded with the given test for debugging.
 * @param test the test to load
 * @param exitOnClose if true, the debugger should cause the VM to exit when it'sclosed. Otherwise, the debugger should just clean up and hide itself
 * @throws SoarException
 * @throws InterruptedException
 */
void debugTest(Test test,boolean exitOnClose) throws SoarException, InterruptedException ;
Program: 12207
Project: 12207
Buggy source:
public void debugTest(Test test) throws SoarException, InterruptedException {
  factory.debugTest(test);
}

Fixed version (ground truth):
public void debugTest(Test test,boolean exitOnClose) throws SoarException, InterruptedException {
  factory.debugTest(test,exitOnClose);
}
Program: 12208
Project: 12208
Buggy source:
@Override public void debugTest(Test test) throws SoarException, InterruptedException {
  final ThreadedAgent agent=ThreadedAgent.create(test.getName());
  TestRhsFunction.addTestFunction(agent.getAgent(),"String_Node_Str");
  TestRhsFunction.addTestFunction(agent.getAgent(),"String_Node_Str");
  final Map<String,Object> debugProps=new HashMap<String,Object>();
  debugProps.put(DebuggerProvider.CLOSE_ACTION,CloseAction.DISPOSE);
  agent.getDebuggerProvider().setProperties(debugProps);
  agent.openDebuggerAndWait();
  final TestCase testCase=test.getTestCase();
  agent.getPrinter().print("String_Node_Str",test);
  agent.getInterpreter().eval(String.format("String_Node_Str",FileTools.getParent(testCase.getFile()).replace('\\','/')));
  agent.getInterpreter().eval(testCase.getSetup());
  agent.getInterpreter().eval(test.getContent());
  agent.getPrinter().flush();
}

Fixed version (ground truth):
@Override public void debugTest(Test test,boolean exitOnClose) throws SoarException, InterruptedException {
  final ThreadedAgent agent=ThreadedAgent.create(test.getName());
  TestRhsFunction.addTestFunction(agent.getAgent(),"String_Node_Str");
  TestRhsFunction.addTestFunction(agent.getAgent(),"String_Node_Str");
  final Map<String,Object> debugProps=new HashMap<String,Object>();
  debugProps.put(DebuggerProvider.CLOSE_ACTION,exitOnClose ? CloseAction.EXIT : CloseAction.DISPOSE);
  agent.getDebuggerProvider().setProperties(debugProps);
  agent.openDebuggerAndWait();
  final TestCase testCase=test.getTestCase();
  agent.getPrinter().print("String_Node_Str",test);
  agent.getInterpreter().eval(String.format("String_Node_Str",FileTools.getParent(testCase.getFile()).replace('\\','/')));
  agent.getInterpreter().eval(testCase.getSetup());
  agent.getInterpreter().eval(test.getContent());
  agent.getPrinter().flush();
}
Program: 12209
Project: 12209
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  try {
    final TestRunner runner=new TestRunner(agentFactory,new PrintWriter(new NullWriter()));
    runner.debugTest(test);
  }
 catch (  SoarException e1) {
    e1.printStackTrace();
  }
catch (  InterruptedException e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  try {
    final TestRunner runner=new TestRunner(agentFactory,new PrintWriter(new NullWriter()));
    runner.debugTest(test,false);
  }
 catch (  SoarException e1) {
    e1.printStackTrace();
  }
catch (  InterruptedException e1) {
    e1.printStackTrace();
  }
}
Program: 12210
Project: 12210
Buggy source:
private void initializeGlobalScope(String engineName,Adaptable context,ScriptEngine engine) throws SoarException {
  final InputStream is=getClass().getResourceAsStream(engineName);
  if (is != null) {
    engine.put("String_Node_Str",new ScriptContext(context));
    final Reader reader=new InputStreamReader(is,Charsets.UTF_8);
    try {
      try {
        engine.eval(reader);
      }
 catch (      ScriptException e) {
        throw new SoarException(e.getMessage(),e);
      }
    }
  finally {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new SoarException("String_Node_Str" + engineName + "String_Node_Str"+ e.getMessage(),e);
      }
    }
  }
 else {
    engine.put("String_Node_Str",new ScriptContext(context));
  }
}

Fixed version (ground truth):
private void initializeGlobalScope(String engineName,Adaptable context,ScriptEngine engine) throws SoarException {
  final InputStream is=getClass().getResourceAsStream(engineName);
  if (is != null) {
    engine.put("String_Node_Str",new ScriptContext(context));
    engine.put(ScriptEngine.FILENAME,"String_Node_Str" + engineName);
    final Reader reader=new InputStreamReader(is,Charsets.UTF_8);
    try {
      try {
        engine.eval(reader);
      }
 catch (      ScriptException e) {
        throw new SoarException(e.getMessage(),e);
      }
    }
  finally {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new SoarException("String_Node_Str" + engineName + "String_Node_Str"+ e.getMessage(),e);
      }
    }
  }
 else {
    engine.put("String_Node_Str",new ScriptContext(context));
  }
}
Program: 12211
Project: 12211
Buggy source:
/** 
 * activates a new or existing long-term identifier <p>semantic_memory.cpp:957:smem_lti_activate
 * @param lti
 * @throws SQLException
 */
void smem_lti_activate(long lti) throws SQLException {
  db.act_lti_child_ct_get.setLong(1,lti);
  final ResultSet rs=db.act_lti_child_ct_get.executeQuery();
  long lti_child_ct=0;
  try {
    rs.next();
    lti_child_ct=rs.getLong(0 + 1);
  }
  finally {
    rs.close();
  }
  if (lti_child_ct >= 100) {
    db.act_lti_set.setLong(1,smem_max_cycle++);
    db.act_lti_set.setLong(2,lti);
    db.act_lti_set.execute();
  }
 else {
    db.act_set.setLong(1,smem_max_cycle++);
    db.act_set.setLong(2,lti);
    db.act_set.execute();
  }
}

Fixed version (ground truth):
/** 
 * activates a new or existing long-term identifier <p>semantic_memory.cpp:957:smem_lti_activate
 * @param lti
 * @throws SQLException
 */
void smem_lti_activate(long lti) throws SQLException {
  db.act_lti_child_ct_get.setLong(1,lti);
  final ResultSet rs=db.act_lti_child_ct_get.executeQuery();
  long lti_child_ct=0;
  try {
    rs.next();
    lti_child_ct=rs.getLong(0 + 1);
  }
  finally {
    rs.close();
  }
  if (lti_child_ct >= params.thresh.get()) {
    db.act_lti_set.setLong(1,smem_max_cycle++);
    db.act_lti_set.setLong(2,lti);
    db.act_lti_set.execute();
  }
 else {
    db.act_set.setLong(1,smem_max_cycle++);
    db.act_set.setLong(2,lti);
    db.act_set.execute();
  }
}
Program: 12212
Project: 12212
Buggy source:
public DefaultSemanticMemory(Adaptable context,SemanticMemoryDatabase db){
  this.db=db;
  this.symbols=Adaptables.require(DefaultSemanticMemory.class,context,SymbolFactoryImpl.class);
  this.predefinedSyms=new SemanticMemorySymbols(this.symbols);
}

Fixed version (ground truth):
public DefaultSemanticMemory(Adaptable context,SemanticMemoryDatabase db){
  this.context=context;
  this.db=db;
}
Program: 12216
Project: 12216
Buggy source:
@Override public void smem_close() throws SoarException {
  if (db != null) {
    try {
      smem_variable_set(smem_variable_key.var_max_cycle,smem_max_cycle);
      if (false) {
        db.commit.executeUpdate();
      }
      db.getConnection().close();
      db=null;
    }
 catch (    SQLException e) {
      throw new SoarException("String_Node_Str" + e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
@Override public void smem_close() throws SoarException {
  if (db != null) {
    try {
      smem_variable_set(smem_variable_key.var_max_cycle,smem_max_cycle);
      if (params.lazy_commit.get()) {
        db.commit.executeUpdate();
      }
      db.getConnection().close();
      db=null;
    }
 catch (    SQLException e) {
      throw new SoarException("String_Node_Str" + e.getMessage(),e);
    }
  }
}
Program: 12217
Project: 12217
Buggy source:
public static void executeSql(Connection db,InputStream is) throws SoarException, IOException {
  try {
    final Statement s=db.createStatement();
    final BufferedReader reader=new BufferedReader(new InputStreamReader(is));
    String line=reader.readLine();
    while (line != null) {
      line=line.trim();
      if (!line.isEmpty() && !line.startsWith("String_Node_Str")) {
        s.addBatch(line);
      }
      line=reader.readLine();
    }
    db.setAutoCommit(false);
    s.executeBatch();
    db.setAutoCommit(true);
  }
 catch (  SQLException e) {
    throw new SoarException("String_Node_Str" + e.getMessage(),e);
  }
 finally {
    is.close();
  }
}

Fixed version (ground truth):
public static void executeSql(Connection db,InputStream is) throws SoarException, IOException {
  try {
    final Statement s=db.createStatement();
    try {
      final BufferedReader reader=new BufferedReader(new InputStreamReader(is));
      String line=reader.readLine();
      while (line != null) {
        line=line.trim();
        if (!line.isEmpty() && !line.startsWith("String_Node_Str")) {
          s.addBatch(line);
        }
        line=reader.readLine();
      }
      db.setAutoCommit(false);
      s.executeBatch();
      db.setAutoCommit(true);
    }
  finally {
      s.close();
    }
  }
 catch (  SQLException e) {
    throw new SoarException("String_Node_Str" + e.getMessage(),e);
  }
 finally {
    is.close();
  }
}
Program: 12218
Project: 12218
Buggy source:
@Test public void testCanInitializeTheDatabase() throws Exception {
  final DefaultSemanticMemory smem=new DefaultSemanticMemory(context);
  assertNull(smem.getDatabase());
  smem.smem_attach();
  assertNotNull(smem.getDatabase());
  assertFalse(smem.getDatabase().getConnection().isClosed());
}

Fixed version (ground truth):
@Test public void testCanInitializeTheDatabase() throws Exception {
  final DefaultSemanticMemory smem=new DefaultSemanticMemory(context);
  smem.initialize();
  assertNull(smem.getDatabase());
  smem.smem_attach();
  assertNotNull(smem.getDatabase());
  assertFalse(smem.getDatabase().getConnection().isClosed());
}
Program: 12219
Project: 12219
Buggy source:
@Test public void testCanParseAChunk() throws Exception {
  final DefaultSemanticMemory smem=new DefaultSemanticMemory(context);
  smem.smem_parse_chunks("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final PrintWriter pw=new PrintWriter(System.out);
  smem.smem_visualize_store(pw);
  pw.flush();
}

Fixed version (ground truth):
@Test public void testCanParseAChunk() throws Exception {
  final DefaultSemanticMemory smem=new DefaultSemanticMemory(context);
  smem.initialize();
  smem.smem_parse_chunks("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final PrintWriter pw=new PrintWriter(System.out);
  smem.smem_visualize_store(pw);
  pw.flush();
}
Program: 12220
Project: 12220
Buggy source:
@Before public void setUp() throws Exception {
  context=AdaptableContainer.from(new SymbolFactoryImpl());
  conn=JdbcTools.connect("String_Node_Str","String_Node_Str");
  final SemanticMemoryDatabase db=new SemanticMemoryDatabase(conn);
  db.structure();
  db.prepare();
  smem=new DefaultSemanticMemory(context,db);
}

Fixed version (ground truth):
@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(conn);
  db.structure();
  db.prepare();
  smem=new DefaultSemanticMemory(context,db);
  smem.initialize();
}
Program: 12221
Project: 12221
Buggy source:
/** 
 * activates a new or existing long-term identifier <p>semantic_memory.cpp:957:smem_lti_activate
 * @param lti
 * @throws SQLException
 */
void smem_lti_activate(long lti) throws SQLException {
  db.act_lti_child_ct_get.setLong(1,lti);
  final ResultSet rs=db.act_lti_child_ct_get.executeQuery();
  long lti_child_ct=0;
  try {
    rs.next();
    lti_child_ct=rs.getLong(0 + 1);
  }
  finally {
    rs.close();
  }
  if (lti_child_ct >= 0) {
    db.act_lti_set.setLong(1,smem_max_cycle++);
    db.act_lti_set.setLong(2,lti);
    db.act_lti_set.execute();
  }
 else {
    db.act_set.setLong(1,smem_max_cycle++);
    db.act_set.setLong(2,lti);
    db.act_set.execute();
  }
}

Fixed version (ground truth):
/** 
 * activates a new or existing long-term identifier <p>semantic_memory.cpp:957:smem_lti_activate
 * @param lti
 * @throws SQLException
 */
void smem_lti_activate(long lti) throws SQLException {
  db.act_lti_child_ct_get.setLong(1,lti);
  final ResultSet rs=db.act_lti_child_ct_get.executeQuery();
  long lti_child_ct=0;
  try {
    rs.next();
    lti_child_ct=rs.getLong(0 + 1);
  }
  finally {
    rs.close();
  }
  if (lti_child_ct >= 100) {
    db.act_lti_set.setLong(1,smem_max_cycle++);
    db.act_lti_set.setLong(2,lti);
    db.act_lti_set.execute();
  }
 else {
    db.act_set.setLong(1,smem_max_cycle++);
    db.act_set.setLong(2,lti);
    db.act_set.execute();
  }
}
Program: 12222
Project: 12222
Buggy source:
/** 
 * <p>semantic_memory.cpp:2564:smem_parse_chunks
 * @param chunkString
 * @return
 * @throws SoarException
 * @throws IOException
 * @throws SQLException
 */
boolean smem_parse_chunks(String chunkString) throws SoarException, IOException, SQLException {
  boolean return_val=false;
  long clause_count=0;
  smem_attach();
  final StringWriter errorWriter=new StringWriter();
  final Lexer lexer=new Lexer(new Printer(errorWriter),new StringReader(chunkString));
  lexer.setAllowIds(true);
  lexer.getNextLexeme();
  if (lexer.getCurrentLexeme().type == LexemeType.L_BRACE) {
    boolean good_chunk=true;
    final Map<String,smem_chunk_value> chunks=new HashMap<String,smem_chunk_value>();
    final Set<smem_chunk_lti> newbies=new HashSet<smem_chunk_lti>();
    lexer.getNextLexeme();
    while ((lexer.getCurrentLexeme().type == LexemeType.L_PAREN) && (good_chunk)) {
      good_chunk=smem_parse_chunk(symbols,lexer,chunks,newbies);
      if (good_chunk) {
        for (        smem_chunk_lti c_new : newbies) {
          if (c_new.lti_id == 0) {
            if (c_new.lti_number == 0) {
              c_new.lti_number=symbols.incrementIdNumber(c_new.lti_letter);
              c_new.lti_id=smem_lti_add_id(c_new.lti_letter,c_new.lti_number);
            }
 else {
              if (c_new.lti_id == 0) {
                c_new.lti_id=smem_lti_get_id(c_new.lti_letter,c_new.lti_number);
                if (c_new.lti_id == 0) {
                  c_new.lti_id=smem_lti_add_id(c_new.lti_letter,c_new.lti_number);
                  final IdentifierImpl id_parent=symbols.findIdentifier(c_new.lti_letter,(int)c_new.lti_number);
                  if (id_parent != null) {
                    id_parent.smem_lti=c_new.lti_id;
                  }
                }
              }
            }
          }
        }
        for (        smem_chunk_lti c_new : newbies) {
          if (c_new.slots != null) {
            smem_store_chunk(c_new.lti_id,c_new.slots,false);
          }
        }
        for (        smem_chunk_lti c_new : newbies) {
          smem_deallocate_chunk(c_new,false);
        }
        clause_count++;
        newbies.clear();
      }
    }
    ;
    if (good_chunk && (lexer.getCurrentLexeme().type == LexemeType.R_BRACE)) {
      lexer.getNextLexeme();
      return_val=(lexer.getCurrentLexeme().type == LexemeType.EOF);
    }
{
      for (      smem_chunk_value c_old : chunks.values()) {
        smem_deallocate_chunk(c_old,true);
      }
    }
  }
  if (!return_val) {
    throw new SoarException("String_Node_Str" + clause_count);
  }
  return return_val;
}

Fixed version (ground truth):
/** 
 * <p>semantic_memory.cpp:2564:smem_parse_chunks
 * @param chunkString
 * @return
 * @throws SoarException
 */
boolean smem_parse_chunks(String chunkString) throws SoarException {
  try {
    return smem_parse_chunks_safe(chunkString);
  }
 catch (  IOException e) {
    throw new SoarException(e);
  }
catch (  SQLException e) {
    throw new SoarException(e);
  }
}
Program: 12226
Project: 12226
Buggy source:
@Test public void testCanParseAChunk() throws Exception {
  final DefaultSemanticMemory smem=new DefaultSemanticMemory(context);
  smem.smem_parse_chunks("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Test public void testCanParseAChunk() throws Exception {
  final DefaultSemanticMemory smem=new DefaultSemanticMemory(context);
  smem.smem_parse_chunks("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  final PrintWriter pw=new PrintWriter(System.out);
  smem.smem_visualize_store(pw);
  pw.flush();
}
Program: 12228
Project: 12228
Buggy source:
private static Agent agent() throws Exception {
  final Agent a=new Agent();
  a.getPrinter().addPersistentWriter(new OutputStreamWriter(System.out));
  a.initialize();
  a.setInterpreter(new DefaultInterpreter(a));
  a.getInterpreter().source(new File("String_Node_Str"));
  a.getPrinter().flush();
  return a;
}

Fixed version (ground truth):
private static Agent agent() throws Exception {
  final Agent a=new Agent();
  a.getPrinter().addPersistentWriter(new OutputStreamWriter(System.out));
  a.initialize();
  a.getInterpreter().source(new File("String_Node_Str"));
  System.out.println("String_Node_Str" + a.getProductions().getProductionCount() + "String_Node_Str");
  a.getPrinter().flush();
  a.runFor(20000,RunType.DECISIONS);
  return a;
}
Program: 12229
Project: 12229
Buggy source:
public static void main(String[] args) throws Exception {
  final List<Agent> agents=new ArrayList<Agent>();
  for (int i=0; i < 20; ++i) {
    System.out.print("String_Node_Str" + (i + 1));
    agents.add(agent());
  }
  while (true) {
    Thread.sleep(1000);
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  final List<Agent> agents=new ArrayList<Agent>();
  for (int i=0; i < 1; ++i) {
    System.out.print("String_Node_Str" + (i + 1));
    agents.add(agent());
  }
  while (true) {
    Thread.sleep(1000);
  }
}
Program: 12230
Project: 12230
Buggy source:
public RunCommand(ThreadedAgent threadedAgent){
  this.threadedAgent=threadedAgent;
}

Fixed version (ground truth):
public RunCommand(AgentRunController controller){
  this.controller=controller;
}
Program: 12231
Project: 12231
Buggy source:
private long getCount(int i,String[] args) throws SoarException {
  final String arg=args[i];
  if (i + 1 >= args.length) {
    throw new SoarException("String_Node_Str" + arg + "String_Node_Str");
  }
  final String countString=args[i + 1].toString();
  try {
    long n=Long.parseLong(countString);
    if (n < 1) {
      throw new SoarException("String_Node_Str" + arg + "String_Node_Str");
    }
    return n;
  }
 catch (  NumberFormatException e) {
    throw new SoarException("String_Node_Str" + countString + "String_Node_Str");
  }
}

Fixed version (ground truth):
private long getCount(int i,String[] args) throws SoarException {
  final String arg=args[i];
  if (i + 1 >= args.length) {
    return 1;
  }
  final String countString=args[i + 1].toString();
  try {
    long n=Long.parseLong(countString);
    if (n < 1) {
      throw new SoarException("String_Node_Str" + arg + "String_Node_Str");
    }
    return n;
  }
 catch (  NumberFormatException e) {
    throw new SoarException("String_Node_Str" + countString + "String_Node_Str");
  }
}
Program: 12232
Project: 12232
Buggy source:
@Override public String execute(String[] args) throws SoarException {
  RunType type=RunType.FOREVER;
  long count=0;
  for (int i=1; i < args.length; ++i) {
    final String arg=args[i];
    if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.DECISIONS;
      count=getCount(i++,args);
    }
 else     if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.ELABORATIONS;
      count=getCount(i++,args);
    }
 else     if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.PHASES;
      count=getCount(i++,args);
    }
 else     if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.FOREVER;
    }
 else {
      throw new SoarException("String_Node_Str" + arg + "String_Node_Str");
    }
  }
  threadedAgent.runFor(count,type);
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String execute(String[] args) throws SoarException {
  RunType type=RunType.FOREVER;
  long count=0;
  for (int i=1; i < args.length; ++i) {
    final String arg=args[i];
    if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.DECISIONS;
      count=getCount(i++,args);
    }
 else     if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.ELABORATIONS;
      count=getCount(i++,args);
    }
 else     if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.PHASES;
      count=getCount(i++,args);
    }
 else     if ("String_Node_Str".equals(arg) || "String_Node_Str".equals(arg)) {
      type=RunType.FOREVER;
    }
 else {
      throw new SoarException("String_Node_Str" + arg + "String_Node_Str");
    }
  }
  controller.runFor(count,type);
  return "String_Node_Str";
}
Program: 12235
Project: 12235
Buggy source:
/** 
 * Formattable implementation for symbolic constants. Use in conjunction with the %s format. Since the csoar kernel uses rereadable==true in 90%  of calls to symbol_to_string(), we'll make that the default format. To  get the raw format, use the alternate, i.e. "%#s". <p>print.cpp:216:symbol_to_string / SYM_CONSTANT_SYMBOL_TYPE
 * @see java.util.Formattable#formatTo(java.util.Formatter,int,int,int)
 */
@Override public void formatTo(Formatter formatter,int flags,int width,int precision){
  final boolean rereadable=(FormattableFlags.ALTERNATE & flags) == 0;
  final String stringToWrite;
  if (rereadable) {
    final PossibleSymbolTypes possible=Lexer.determine_possible_symbol_types_for_string(getValue());
    final boolean hasAngleBracket=getValue().startsWith("String_Node_Str") || getValue().startsWith("String_Node_Str");
    if (!possible.possible_sc || possible.possible_var || possible.possible_ic|| possible.possible_fc|| !possible.rereadable|| hasAngleBracket) {
      stringToWrite=StringTools.string_to_escaped_string(getValue(),'|');
    }
 else {
      stringToWrite=getValue();
    }
  }
 else {
    stringToWrite=getValue();
  }
  try {
    formatter.out().append(stringToWrite);
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
/** 
 * Formattable implementation for symbolic constants. Use in conjunction with the %s format. Since the csoar kernel uses rereadable==true in 90%  of calls to symbol_to_string(), we'll make that the default format. To  get the raw format, use the alternate, i.e. "%#s". <p>print.cpp:216:symbol_to_string / SYM_CONSTANT_SYMBOL_TYPE
 * @see java.util.Formattable#formatTo(java.util.Formatter,int,int,int)
 */
@Override public void formatTo(Formatter formatter,int flags,int width,int precision){
  final boolean rereadable=(FormattableFlags.ALTERNATE & flags) == 0;
  final String stringToWrite;
  if (rereadable) {
    final PossibleSymbolTypes possible=Lexer.determine_possible_symbol_types_for_string(getValue());
    final boolean hasAngleBracket=getValue().startsWith("String_Node_Str") || getValue().startsWith("String_Node_Str");
    if (!possible.possible_sc || possible.possible_id || possible.possible_var|| possible.possible_ic|| possible.possible_fc|| !possible.rereadable|| hasAngleBracket) {
      stringToWrite=StringTools.string_to_escaped_string(getValue(),'|');
    }
 else {
      stringToWrite=getValue();
    }
  }
 else {
    stringToWrite=getValue();
  }
  try {
    formatter.out().append(stringToWrite);
  }
 catch (  IOException e) {
  }
}
Program: 12236
Project: 12236
Buggy source:
@Test public void testFormatToWhenStringContainsPercent(){
  final SymbolFactoryImpl syms=new SymbolFactoryImpl();
  final StringSymbol s=syms.createString("String_Node_Str");
  assertEquals("String_Node_Str",s.toString());
  assertEquals("String_Node_Str",String.format("String_Node_Str",s));
  assertEquals("String_Node_Str",String.format("String_Node_Str",s));
}

Fixed version (ground truth):
@Test public void testFormatToWhenStringContainsPercent(){
  final StringSymbol s=syms.createString("String_Node_Str");
  assertEquals("String_Node_Str",s.toString());
  assertEquals("String_Node_Str",String.format("String_Node_Str",s));
  assertEquals("String_Node_Str",String.format("String_Node_Str",s));
}
Program: 12238
Project: 12238
Buggy source:
/** 
 * Execute the given callable in the agent thread, wait for its result and return it.
 * @param < V > return type
 * @param callable the callable to run
 * @param finish called after the callable is executed. Ignored if <code>null</code>.
 * @throws RuntimeException if an exception is thrown while waiting for theresult.
 */
public <V>void execute(final Callable<V> callable,final CompletionHandler<V> finish){
  execute(new Runnable(){
    @Override public void run(){
      try {
        final V result=callable.call();
        if (finish != null) {
          finish.finish(result);
        }
      }
 catch (      InterruptAgentException e) {
        throw e;
      }
catch (      Exception e) {
        e.printStackTrace();
        final Throwable cause=e.getCause();
        agent.getPrinter().error((cause != null ? cause.getMessage() : e.getMessage()) + "String_Node_Str");
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Schedule the given callable for execution in the agent thread and return immediately. This is the correct way to access the agent in a thread-safe manner without deadlocks.
 * @param < V > return type
 * @param callable the callable to run
 * @param finish called after the callable is executed. Ignored if <code>null</code>.
 * @throws RuntimeException if an exception is thrown while waiting for theresult.
 */
public <V>void execute(final Callable<V> callable,final CompletionHandler<V> finish){
  execute(new Runnable(){
    @Override public void run(){
      try {
        final V result=callable.call();
        if (finish != null) {
          finish.finish(result);
        }
      }
 catch (      InterruptAgentException e) {
        throw e;
      }
catch (      Exception e) {
        e.printStackTrace();
        final Throwable cause=e.getCause();
        agent.getPrinter().error((cause != null ? cause.getMessage() : e.getMessage()) + "String_Node_Str");
      }
    }
  }
);
}
Program: 12239
Project: 12239
Buggy source:
@Override public Void call() throws Exception {
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  inputReady=true;
  return null;
}
Program: 12240
Project: 12240
Buggy source:
private synchronized boolean isDoneWaiting(){
  return agent.getAgent().getReasonForStop() != null || inputReady.get() || Thread.currentThread().isInterrupted();
}

Fixed version (ground truth):
private synchronized boolean isDoneWaiting(){
  return agent.getAgent().getReasonForStop() != null || inputReady || Thread.currentThread().isInterrupted();
}
Program: 12241
Project: 12241
Buggy source:
@Override public void onEvent(SoarEvent event){
  doWait();
}

Fixed version (ground truth):
@Override public void onEvent(SoarEvent event){
  inputReady=false;
}
Program: 12242
Project: 12242
Buggy source:
public void detach(){
  if (agent != null) {
    agent.getEvents().removeListener(null,inputReadyListener);
    agent.getEvents().removeListener(null,afterDecisionCycleListener);
    agent.getRhsFunctions().unregisterHandler(getName());
    if (oldHandler != null) {
      agent.getRhsFunctions().registerHandler(oldHandler);
      oldHandler=null;
    }
    agent=null;
  }
}

Fixed version (ground truth):
public void detach(){
  if (agent != null) {
    agent.getEvents().removeListener(null,inputReadyListener);
    agent.getEvents().removeListener(null,afterInputListener);
    agent.getEvents().removeListener(null,afterDecisionCycleListener);
    agent.getRhsFunctions().unregisterHandler(getName());
    if (oldHandler != null) {
      agent.getRhsFunctions().registerHandler(oldHandler);
      oldHandler=null;
    }
    agent=null;
  }
}
Program: 12243
Project: 12243
Buggy source:
private void doWait(){
  if (!requestedWaitInfo.waiting) {
    inputReady.set(false);
    return;
  }
synchronized (this) {
    waitInfo.set(requestedWaitInfo);
  }
  final long start=System.currentTimeMillis();
  final BlockingQueue<Runnable> commands=agent.getCommandQueue();
  boolean done=isDoneWaiting();
  while (!done) {
    try {
      final long remaining=requestedWaitInfo.timeout - (System.currentTimeMillis() - start);
      if (remaining <= 0) {
        done=true;
      }
      final Runnable command=commands.poll(remaining,TimeUnit.MILLISECONDS);
      if (command != null) {
        command.run();
        done=isDoneWaiting();
      }
 else {
        done=true;
      }
    }
 catch (    InterruptedException e) {
      done=true;
      Thread.currentThread().interrupt();
      break;
    }
  }
  requestedWaitInfo=WaitInfo.NOT_WAITING;
synchronized (this) {
    inputReady.set(false);
    waitInfo.set(WaitInfo.NOT_WAITING);
  }
}

Fixed version (ground truth):
private void doWait(){
  if (!requestedWaitInfo.waiting) {
    inputReady=false;
    return;
  }
synchronized (this) {
    waitInfo.set(requestedWaitInfo);
  }
  final long start=System.currentTimeMillis();
  final BlockingQueue<Runnable> commands=agent.getCommandQueue();
  boolean done=isDoneWaiting();
  while (!done) {
    try {
      final long remaining=requestedWaitInfo.timeout - (System.currentTimeMillis() - start);
      if (remaining <= 0) {
        done=true;
      }
      final Runnable command=commands.poll(remaining,TimeUnit.MILLISECONDS);
      if (command != null) {
        command.run();
        done=isDoneWaiting();
      }
 else {
        done=true;
      }
    }
 catch (    InterruptedException e) {
      done=true;
      Thread.currentThread().interrupt();
      break;
    }
  }
  requestedWaitInfo=WaitInfo.NOT_WAITING;
synchronized (this) {
    inputReady=false;
    waitInfo.set(WaitInfo.NOT_WAITING);
  }
}
Program: 12244
Project: 12244
Buggy source:
private synchronized void setNewInputAvailable(){
  inputReady.set(true);
  if (waitInfo.get().waiting) {
    WaitRhsFunction.this.agent.execute(inputReadyCommand,null);
  }
}

Fixed version (ground truth):
private synchronized void setNewInputAvailable(){
  if (agent.isAgentThread()) {
    inputReady=true;
  }
 else {
    agent.execute(inputReadyCommand,null);
  }
}
Program: 12245
Project: 12245
Buggy source:
public void attach(ThreadedAgent agent){
  Arguments.checkNotNull(agent,"String_Node_Str");
  if (this.agent != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  this.agent=agent;
  this.agent.getEvents().addListener(AsynchronousInputReadyEvent.class,inputReadyListener=new SoarEventListener(){
    @Override public void onEvent(    SoarEvent event){
      setNewInputAvailable();
    }
  }
);
  this.agent.getEvents().addListener(AfterDecisionCycleEvent.class,afterDecisionCycleListener=new SoarEventListener(){
    @Override public void onEvent(    SoarEvent event){
      doWait();
    }
  }
);
  this.agent.getProperties().setProvider(SoarProperties.WAIT_INFO,waitInfoProp);
  this.oldHandler=this.agent.getRhsFunctions().registerHandler(this);
}

Fixed version (ground truth):
public void attach(ThreadedAgent agent){
  Arguments.checkNotNull(agent,"String_Node_Str");
  if (this.agent != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  this.agent=agent;
  this.agent.getEvents().addListener(AsynchronousInputReadyEvent.class,inputReadyListener=new SoarEventListener(){
    @Override public void onEvent(    SoarEvent event){
      setNewInputAvailable();
    }
  }
);
  this.agent.getEvents().addListener(AfterDecisionCycleEvent.class,afterDecisionCycleListener=new SoarEventListener(){
    @Override public void onEvent(    SoarEvent event){
      doWait();
    }
  }
);
  this.agent.getEvents().addListener(AfterInput.class,afterInputListener=new SoarEventListener(){
    @Override public void onEvent(    SoarEvent event){
      inputReady=false;
    }
  }
);
  this.agent.getProperties().setProvider(SoarProperties.WAIT_INFO,waitInfoProp);
  this.oldHandler=this.agent.getRhsFunctions().registerHandler(this);
}
Program: 12246
Project: 12246
Buggy source:
@Test(timeout=10000) public void testDoesNotWaitIfAsynchInputIsReadyAndInputPhaseHasntRunYet() throws Exception {
  this.agent.getProductions().loadProduction("String_Node_Str");
  this.agent.getInputOutput().asynchronousInputReady();
  final Object signal=new String("String_Node_Str");
  agent.execute(new Callable<Void>(){
    @Override public Void call() throws Exception {
      agent.runFor(2,RunType.DECISIONS);
      return null;
    }
  }
,new CompletionHandler<Void>(){
    @Override public void finish(    Void result){
synchronized (signal) {
        signal.notifyAll();
      }
    }
  }
);
synchronized (signal) {
    signal.wait();
  }
}

Fixed version (ground truth):
@Test(timeout=10000) public void testDoesNotWaitIfAsynchInputIsReadyAndInputPhaseHasntRunYet() throws Exception {
  agent.executeAndWait(new Callable<Void>(){
    @Override public Void call() throws Exception {
      agent.runFor(2,RunType.PHASES);
      return null;
    }
  }
,Long.MAX_VALUE,TimeUnit.MILLISECONDS);
  this.agent.getProductions().loadProduction("String_Node_Str");
  this.agent.getInputOutput().asynchronousInputReady();
  agent.executeAndWait(new Callable<Void>(){
    @Override public Void call() throws Exception {
      agent.runFor(2,RunType.DECISIONS);
      return null;
    }
  }
,Long.MAX_VALUE,TimeUnit.MILLISECONDS);
}
Program: 12248
Project: 12248
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  this.agent=new Agent();
  this.agent.getTrace().disableAll();
  this.agent.initialize();
}
Program: 12249
Project: 12249
Buggy source:
@Test public void testThatRequiredAgentInternalsArePresent(){
  final Agent agent=new Agent();
  assertNotNull("String_Node_Str",Adaptables.adapt(agent,Decider.class));
  assertNotNull("String_Node_Str",Adaptables.adapt(agent,PredefinedSymbols.class));
}

Fixed version (ground truth):
@Test public void testThatRequiredAgentInternalsArePresent(){
  assertNotNull("String_Node_Str",Adaptables.adapt(agent,Decider.class));
  assertNotNull("String_Node_Str",Adaptables.adapt(agent,PredefinedSymbols.class));
}
Program: 12250
Project: 12250
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  if (this.agent != null) {
    this.agent.dispose();
    this.agent=null;
  }
}
Program: 12252
Project: 12252
Buggy source:
public StringSymbolImpl getName(){
  return name;
}

Fixed version (ground truth):
/** 
 * @return the name of the RHS function
 */
public StringSymbol getName(){
  return name;
}
Program: 12253
Project: 12253
Buggy source:
@Override public void formatTo(Formatter formatter,int flags,int width,int precision){
  formatter.format("String_Node_Str",getName());
  for (  RhsValue v : arguments) {
    formatter.format("String_Node_Str",v);
  }
  formatter.format("String_Node_Str");
}

Fixed version (ground truth):
@Override public void formatTo(Formatter formatter,int flags,int width,int precision){
  final StringSymbol name=getName();
  if ("String_Node_Str".equals(name.getValue()) || "String_Node_Str".equals(name.getValue())) {
    formatter.format("String_Node_Str",name.getValue());
  }
 else {
    formatter.format("String_Node_Str",name);
  }
  for (  RhsValue v : arguments) {
    formatter.format("String_Node_Str",v);
  }
  formatter.format("String_Node_Str");
}
Program: 12254
Project: 12254
Buggy source:
/** 
 * @return the standalone
 */
public boolean isStandalone(){
  return standalone;
}

Fixed version (ground truth):
/** 
 * @return true if the function is in a standalone context
 */
public boolean isStandalone(){
  return standalone;
}
Program: 12255
Project: 12255
Buggy source:
@Test public void testFunctionCallAfterLParen() throws Exception {
  OriginalParserImpl parser=createParser("String_Node_Str");
  RhsFunctionCall rfc=parser.parse_function_call_after_lparen(false);
  assertNotNull(rfc);
  verifyStringSymbol(rfc.getName(),"String_Node_Str");
  List<RhsValue> args=rfc.getArguments();
  assertEquals(5,args.size());
  verifyIntSymbol(args.get(0).asSymbolValue().getSym(),1);
  verifyIntSymbol(args.get(1).asSymbolValue().getSym(),2);
  assertNotNull(args.get(2).asFunctionCall());
  verifyVariableSymbol(args.get(3).asSymbolValue().getSym(),"String_Node_Str");
  verifyVariableSymbol(args.get(4).asSymbolValue().getSym(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testFunctionCallAfterLParen() throws Exception {
  OriginalParserImpl parser=createParser("String_Node_Str");
  RhsFunctionCall rfc=parser.parse_function_call_after_lparen(false);
  assertNotNull(rfc);
  verifyStringSymbol((SymbolImpl)rfc.getName(),"String_Node_Str");
  List<RhsValue> args=rfc.getArguments();
  assertEquals(5,args.size());
  verifyIntSymbol(args.get(0).asSymbolValue().getSym(),1);
  verifyIntSymbol(args.get(1).asSymbolValue().getSym(),2);
  assertNotNull(args.get(2).asFunctionCall());
  verifyVariableSymbol(args.get(3).asSymbolValue().getSym(),"String_Node_Str");
  verifyVariableSymbol(args.get(4).asSymbolValue().getSym(),"String_Node_Str");
}
Program: 12256
Project: 12256
Buggy source:
/** 
 * Formattable implementation for symbolic constants. Use in conjunction with the %s format. Since the csoar kernel uses rereadable==true in 90%  of calls to symbol_to_string(), we'll make that the default format. To  get the raw format, use the alternate, i.e. "%#s". <p>print.cpp:216:symbol_to_string / SYM_CONSTANT_SYMBOL_TYPE
 * @see java.util.Formattable#formatTo(java.util.Formatter,int,int,int)
 */
@Override public void formatTo(Formatter formatter,int flags,int width,int precision){
  final boolean rereadable=(FormattableFlags.ALTERNATE & flags) == 0;
  if (!rereadable) {
    formatter.format(getValue());
    return;
  }
  final PossibleSymbolTypes possible=Lexer.determine_possible_symbol_types_for_string(getValue());
  final boolean hasAngleBracket=getValue().startsWith("String_Node_Str") || getValue().startsWith("String_Node_Str");
  if (!possible.possible_sc || possible.possible_var || possible.possible_ic|| possible.possible_fc|| !possible.rereadable|| hasAngleBracket) {
    formatter.format(StringTools.string_to_escaped_string(getValue(),'|'));
  }
 else {
    formatter.format(getValue());
  }
}

Fixed version (ground truth):
/** 
 * Formattable implementation for symbolic constants. Use in conjunction with the %s format. Since the csoar kernel uses rereadable==true in 90%  of calls to symbol_to_string(), we'll make that the default format. To  get the raw format, use the alternate, i.e. "%#s". <p>print.cpp:216:symbol_to_string / SYM_CONSTANT_SYMBOL_TYPE
 * @see java.util.Formattable#formatTo(java.util.Formatter,int,int,int)
 */
@Override public void formatTo(Formatter formatter,int flags,int width,int precision){
  final boolean rereadable=(FormattableFlags.ALTERNATE & flags) == 0;
  final String stringToWrite;
  if (rereadable) {
    final PossibleSymbolTypes possible=Lexer.determine_possible_symbol_types_for_string(getValue());
    final boolean hasAngleBracket=getValue().startsWith("String_Node_Str") || getValue().startsWith("String_Node_Str");
    if (!possible.possible_sc || possible.possible_var || possible.possible_ic|| possible.possible_fc|| !possible.rereadable|| hasAngleBracket) {
      stringToWrite=StringTools.string_to_escaped_string(getValue(),'|');
    }
 else {
      stringToWrite=getValue();
    }
  }
 else {
    stringToWrite=getValue();
  }
  try {
    formatter.out().append(stringToWrite);
  }
 catch (  IOException e) {
  }
}
Program: 12257
Project: 12257
Buggy source:
/** 
 * Test method for   {@link org.jsoar.kernel.symbols.StringSymbolImpl#formatTo(java.util.Formatter,int,int,int)}.
 */
@Test public void testFormatTo(){
  SymbolFactoryImpl syms=new SymbolFactoryImpl();
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
}

Fixed version (ground truth):
@Test public void testFormatTo(){
  SymbolFactoryImpl syms=new SymbolFactoryImpl();
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
  assertEquals("String_Node_Str",String.format("String_Node_Str",syms.createString("String_Node_Str")));
}