Program: 140868
Project: 140868
Buggy source:
@Override public void start() throws IOException {
  log=Logger.getLogger(StressTestcase.class.getName());
  LogHandler.initLogFileHandler(log,StressTestcase.class.getSimpleName());
  Map<String,QueryTestcase> threadPool=new HashMap<String,QueryTestcase>();
  log.info("String_Node_Str");
  long timeLimit=Long.parseLong(String.valueOf(props.get("String_Node_Str")));
  String queryPatterns=String.valueOf(props.get("String_Node_Str"));
  for (  Object key : props.keySet()) {
    if (key == null || props.get(key) == null)     continue;
    propsUpdate.put(key,props.get(key));
  }
  String updateStrategy=String.valueOf(props.get("String_Node_Str"));
  int limit=0;
  try {
    limit=Integer.parseInt(String.valueOf(props.get("String_Node_Str")));
  }
 catch (  Exception e) {
    limit=5000;
  }
  String ldpath=null;
  try {
    ldpath=String.valueOf(props.get("String_Node_Str"));
    propsUpdate.put("String_Node_Str",props.getProperty("String_Node_Str"));
  }
 catch (  Exception e) {
  }
  QueryTestcase.initQH(queryPatterns,updateStrategy,ldpath,limit,log);
  ExecutorService executor=Executors.newFixedThreadPool(users + updateUsers);
  for (Integer i=0; i < users; i++) {
    SPARQLQueryTestcase qt=new SPARQLQueryTestcase();
    qt.setRandomNumber(i + 1);
    qt.setConnection(con);
    qt.setCurrentDBName(currentDBName);
    qt.setCurrentPercent(percent);
    qt.setProperties(props);
    Log.info("String_Node_Str" + i + "String_Node_Str");
    executor.execute(qt);
    threadPool.put("String_Node_Str" + i,qt);
  }
  for (int i=users; i < updateUsers + users; i++) {
    LiveDataQueryTestcase qt=new LiveDataQueryTestcase();
    qt.setConnection(con);
    qt.setCurrentDBName(currentDBName);
    qt.setCurrentPercent(percent);
    qt.setProperties(propsUpdate);
    if (propsUpdate.containsKey("String_Node_Str")) {
      qt.setAmount(Integer.parseInt(String.valueOf(propsUpdate.get("String_Node_Str"))));
    }
    qt.setStrategyRandom(i);
    qt.setStrategy(String.valueOf(propsUpdate.get("String_Node_Str")));
    log.info("String_Node_Str" + (i - users) + "String_Node_Str");
    executor.execute(qt);
    threadPool.put("String_Node_Str" + i,qt);
  }
  executor.shutdown();
  long time=new Date().getTime();
  while (new Date().getTime() - time < timeLimit) {
  }
  for (  String t : threadPool.keySet()) {
    threadPool.get(t).sendEndSignal();
  }
  while (!executor.isTerminated()) {
  }
  log.info("String_Node_Str");
  Collection<Collection<ResultSet>> results=new LinkedList<Collection<ResultSet>>();
  Collection<Collection<ResultSet>> results2=new LinkedList<Collection<ResultSet>>();
  for (  String t : threadPool.keySet()) {
    if (t.startsWith("String_Node_Str"))     results2.add(threadPool.get(t).getResults());
 else     results.add(threadPool.get(t).getResults());
  }
  log.info("String_Node_Str");
  int user=0;
  for (  Collection<ResultSet> resultsUser : results) {
    for (    ResultSet result : resultsUser) {
      String file=new File(result.getFileName()).getName();
      file=file.replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (user < users)       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + user;
 else       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + (user);
      result.setFileName(File.separator + file);
      try {
        result.save();
      }
 catch (      IOException e) {
        log.severe("String_Node_Str");
        LogHandler.writeStackTrace(log,e,Level.SEVERE);
      }
    }
    resU.addAll(resultsUser);
    user++;
  }
  user=0;
  for (  Collection<ResultSet> resultsUser : results2) {
    for (    ResultSet result : resultsUser) {
      String file=new File(result.getFileName()).getName();
      file=file.replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (user < users)       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + user;
 else       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + (user);
      result.setFileName(File.separator + file);
      try {
        result.save();
      }
 catch (      IOException e) {
        log.severe("String_Node_Str");
        LogHandler.writeStackTrace(log,e,Level.SEVERE);
      }
    }
    resUU.addAll(resultsUser);
    user++;
  }
  String dir=Benchmark.TEMP_RESULT_FILE_NAME + File.separator + StressTestcase.class.getName();
  new File(dir).mkdirs();
  for (  ResultSet result : res) {
    result.setFileName(dir + File.separator + result.getFileName().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str");
    try {
      result.save();
    }
 catch (    IOException e) {
      log.severe("String_Node_Str");
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
  log.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void start() throws IOException {
  log=Logger.getLogger(StressTestcase.class.getName());
  LogHandler.initLogFileHandler(log,StressTestcase.class.getSimpleName());
  Map<String,QueryTestcase> threadPool=new HashMap<String,QueryTestcase>();
  log.info("String_Node_Str");
  long timeLimit=Long.parseLong(String.valueOf(props.get("String_Node_Str")));
  String queryPatterns=String.valueOf(props.get("String_Node_Str"));
  for (  Object key : props.keySet()) {
    if (key == null || props.get(key) == null)     continue;
    propsUpdate.put(key,props.get(key));
  }
  String updateStrategy=String.valueOf(props.get("String_Node_Str"));
  int limit=0;
  try {
    limit=Integer.parseInt(String.valueOf(props.get("String_Node_Str")));
  }
 catch (  Exception e) {
    limit=5000;
  }
  String ldpath=null;
  try {
    ldpath=String.valueOf(props.get("String_Node_Str"));
    propsUpdate.put("String_Node_Str",props.getProperty("String_Node_Str"));
  }
 catch (  Exception e) {
  }
  QueryTestcase.initQH(queryPatterns,updateStrategy,ldpath,limit,log);
  ExecutorService executor=Executors.newFixedThreadPool(users + updateUsers);
  for (Integer i=0; i < users; i++) {
    SPARQLQueryTestcase qt=new SPARQLQueryTestcase();
    qt.setRandomNumber(i + 1);
    qt.setConnection(con);
    qt.setCurrentDBName(currentDBName);
    qt.setCurrentPercent(percent);
    qt.setProperties(props);
    Log.info("String_Node_Str" + i + "String_Node_Str");
    executor.execute(qt);
    threadPool.put("String_Node_Str" + i,qt);
  }
  for (int i=users; i < updateUsers + users; i++) {
    LiveDataQueryTestcase qt=new LiveDataQueryTestcase();
    qt.setConnection(con);
    qt.setCurrentDBName(currentDBName);
    qt.setCurrentPercent(percent);
    qt.setProperties(propsUpdate);
    if (propsUpdate.containsKey("String_Node_Str")) {
      qt.setAmount(Integer.parseInt(String.valueOf(propsUpdate.get("String_Node_Str"))));
    }
    qt.setStrategyRandom(i);
    qt.setStrategy(String.valueOf(propsUpdate.get("String_Node_Str")));
    log.info("String_Node_Str" + (i - users) + "String_Node_Str");
    executor.execute(qt);
    threadPool.put("String_Node_Str" + i,qt);
  }
  executor.shutdown();
  long time=new Date().getTime();
  while (new Date().getTime() - time < timeLimit) {
  }
  for (  String t : threadPool.keySet()) {
    threadPool.get(t).sendEndSignal();
  }
  while (!executor.isTerminated()) {
  }
  log.info("String_Node_Str");
  Collection<Collection<ResultSet>> results=new LinkedList<Collection<ResultSet>>();
  Collection<Collection<ResultSet>> results2=new LinkedList<Collection<ResultSet>>();
  for (  String t : threadPool.keySet()) {
    if (t.startsWith("String_Node_Str"))     results2.add(threadPool.get(t).getResults());
 else     results.add(threadPool.get(t).getResults());
  }
  log.info("String_Node_Str");
  int user=0;
  for (  Collection<ResultSet> resultsUser : results) {
    for (    ResultSet result : resultsUser) {
      String file=new File(result.getFileName()).getName();
      file=file.replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (user < users + updateUsers)       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + user;
 else       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + (user);
      result.setFileName(File.separator + file);
      try {
        result.save();
      }
 catch (      IOException e) {
        log.severe("String_Node_Str");
        LogHandler.writeStackTrace(log,e,Level.SEVERE);
      }
    }
    resU.addAll(resultsUser);
    user++;
  }
  user=0;
  for (  Collection<ResultSet> resultsUser : results2) {
    for (    ResultSet result : resultsUser) {
      String file=new File(result.getFileName()).getName();
      file=file.replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (user < users)       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + user;
 else       file=file.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + (user);
      result.setFileName(File.separator + file);
      try {
        result.save();
      }
 catch (      IOException e) {
        log.severe("String_Node_Str");
        LogHandler.writeStackTrace(log,e,Level.SEVERE);
      }
    }
    resUU.addAll(resultsUser);
    user++;
  }
  String dir=Benchmark.TEMP_RESULT_FILE_NAME + File.separator + StressTestcase.class.getName();
  new File(dir).mkdirs();
  for (  ResultSet result : res) {
    result.setFileName(dir + File.separator + result.getFileName().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str");
    try {
      result.save();
    }
 catch (    IOException e) {
      log.severe("String_Node_Str");
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
  log.info("String_Node_Str");
}