nus-yam/ex-repair huggingface dataset:
Program: 20591
Project: 20591
Buggy source:
@Test public void testDumpDouble(){
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(0.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(.0020001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(10100000122222222.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(10000.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(-10100000122222222.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(-10000.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(0d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(-0d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(Double.MAX_VALUE));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(Double.MIN_VALUE));
}

Fixed version (ground truth):
@Test public void testDumpDouble(){
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(0.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(.0020001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(10100000122222222.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(10000.0000001001000d));
  Locale.setDefault(Locale.GERMANY);
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(0.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(.0020001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(10100000122222222.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(10000.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(-10100000122222222.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(-10000.0000001001000d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(0d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(-0d));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(Double.MAX_VALUE));
  assertArrayEquals("String_Node_Str".getBytes(ASCII),TNetstring.dump(Double.MIN_VALUE));
}
Program: 20592
Project: 20592
Buggy source:
/** 
 * @see org.jibble.pircbot.PircBot#onJoin(String,String,String,String) onJoin 
 */
public void onJoin(String channel,String sender,String login,String hostname){
  boolean found=false;
  for (  TestSubject ts : this.subjects) {
    if (ts.checkForAlias(sender)) {
      ts.setNick(sender);
      if (ts.getMode() == TestSubject.Mode.OP)       this.op(channel,ts.getNick());
      if (ts.getMode() == TestSubject.Mode.VOICE)       this.voice(channel,ts.getNick());
      found=true;
      break;
    }
  }
  if (!found) {
    String[] alias={sender};
    this.subjects.add(new TestSubject(sender,alias,TestSubject.Mode.NONE));
  }
}

Fixed version (ground truth):
/** 
 * @see org.jibble.pircbot.PircBot#onJoin(String,String,String,String) onJoin 
 */
public void onJoin(String channel,String sender,String login,String hostname){
  boolean found=false;
  for (  TestSubject ts : this.subjects) {
    if (ts.checkForAlias(sender)) {
      ts.setNick(sender);
      if (ts.getMode() == TestSubject.Mode.OP)       this.op(channel,ts.getNick());
      if (ts.getMode() == TestSubject.Mode.VOICE)       this.voice(channel,ts.getNick());
      found=true;
      break;
    }
  }
  if (!found) {
    String[] alias={sender};
    this.subjects.add(new TestSubject(sender,alias,TestSubject.Mode.NONE,false));
  }
}
Program: 20593
Project: 20593
Buggy source:
/** 
 * Default constructor for GLaDOS
 * @throws ActionException 
 * @throws MalformedURLException 
 */
public GLaDOS() throws MalformedURLException, ActionException {
  this.setName("String_Node_Str");
  this.wernickMod=new WernickeModule();
  this.gup=new GenericUtilityProcessor();
  this.cam=new CentralAIMatrix();
  this.silence=true;
  this.backupTimer=10000;
  this.sm=new SearchModule();
  this.prevTime=(int)System.currentTimeMillis();
  this.subjects=new ArrayList<TestSubject>();
  this.quotes=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  this.start();
}

Fixed version (ground truth):
/** 
 * Default constructor for GLaDOS
 * @throws ActionException 
 * @throws MalformedURLException 
 */
public GLaDOS() throws MalformedURLException {
  this.setName("String_Node_Str");
  this.wernickMod=new WernickeModule();
  this.gup=new GenericUtilityProcessor();
  this.cam=new CentralAIMatrix();
  this.silence=true;
  this.backupTimer=10000;
  this.sm=new SearchModule();
  this.prevTime=(int)System.currentTimeMillis();
  this.subjects=new ArrayList<TestSubject>();
  this.quotes=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  this.start();
}
Program: 20594
Project: 20594
Buggy source:
/** 
 * Starts GLaDOS, connects to server and join channels.
 * @param args Runtime arguments
 * @throws ActionException 
 * @throws MalformedURLException 
 */
public static void main(String[] args) throws MalformedURLException, ActionException {
  GLaDOS bot=new GLaDOS();
  bot.setVerbose(true);
  try {
    bot.connect("String_Node_Str");
  }
 catch (  NickAlreadyInUseException e) {
    System.err.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  IrcException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  bot.joinChannel("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Starts GLaDOS, connects to server and join channels.
 * @param args Runtime arguments
 * @throws ActionException 
 * @throws MalformedURLException 
 */
public static void main(String[] args) throws MalformedURLException {
  GLaDOS bot=new GLaDOS();
  bot.setVerbose(true);
  try {
    bot.connect("String_Node_Str");
  }
 catch (  NickAlreadyInUseException e) {
    System.err.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  IrcException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  bot.joinChannel("String_Node_Str");
}
Program: 20595
Project: 20595
Buggy source:
/** 
 * Constructor for TestSubject.
 * @param nick Current nick.
 * @param alias Known aliases.
 * @param mode Current mode.
 */
public TestSubject(String nick,String[] alias,Mode mode){
  this.setNick(nick);
  this.alias=alias;
  this.setMode(mode);
}

Fixed version (ground truth):
/** 
 * Constructor for TestSubject.
 * @param nick Current nick.
 * @param alias Known aliases.
 * @param mode Current mode.
 */
public TestSubject(String nick,String[] alias,Mode mode,boolean admin){
  this.setNick(nick);
  this.alias=alias;
  this.setMode(mode);
  this.admin=admin;
}
Program: 20596
Project: 20596
Buggy source:
/** 
 * Checks if the test subject have a specific alias
 * @param toFind The alias to search for.
 * @return Returns true if the alias is found, false otherwise 
 */
public boolean checkForAlias(String toFind){
  boolean found=false;
  for (  String alias : this.alias) {
    if (alias.equals(toFind))     found=true;
  }
  return found;
}

Fixed version (ground truth):
/** 
 * Checks if the test subject have a specific alias
 * @param toFind The alias to search for.
 * @return Returns true if the alias is found, false otherwise
 */
public boolean checkForAlias(String toFind){
  boolean found=false;
  for (  String alias : this.alias) {
    if (alias.equals(toFind))     found=true;
  }
  return found;
}
Program: 20597
Project: 20597
Buggy source:
/** 
 * @return the nick 
 */
public String getNick(){
  return nick;
}

Fixed version (ground truth):
/** 
 * @return the nick
 */
public String getNick(){
  return nick;
}
Program: 20598
Project: 20598
Buggy source:
/** 
 * @return the mode 
 */
public Mode getMode(){
  return mode;
}

Fixed version (ground truth):
/** 
 * @return the mode
 */
public Mode getMode(){
  return mode;
}
Program: 20602
Project: 20602
Buggy source:
/** 
 * If an argument is defined multiple times, this will return the values of each definition.
 * @param shortArg the short version of the argument (example: "h" for "-h")
 * @param longArg the long version of the argument (example: "help" for"--help")
 * @param defaultValue the value to return if the argument has no value
 * @return each of the argument's values or a Collection containingdefaultValue if the argument does not exist, or null if defaultValue is null (example: ["bar", "car"] is returned for the argument "--foo=bar --foo=car")
 */
@SuppressWarnings("String_Node_Str") public Collection<String> valueList(String shortArg,String longArg,String defaultValue){
  Collection<String> values=(Collection<String>)args.getCollection(shortArg);
  if (values == null) {
    values=(Collection<String>)args.getCollection(longArg);
  }
  if (values == null && defaultValue != null) {
    values=new ArrayList<String>();
    values.add(defaultValue);
  }
  return values;
}

Fixed version (ground truth):
/** 
 * If an argument is defined multiple times, this will return the values of each definition.
 * @param shortArg the short version of the argument (example: "h" for "-h")
 * @param longArg the long version of the argument (example: "help" for"--help")
 * @param defaultValue the value to return if the argument has no value
 * @return each of the argument's values or a Collection containingdefaultValue if the argument does not exist, or null if defaultValue is null (example: ["bar", "car"] is returned for the argument "--foo=bar --foo=car")
 */
@SuppressWarnings("String_Node_Str") public Collection<String> valueList(String shortArg,String longArg,String defaultValue){
  Collection<String> shortArgValues=(Collection<String>)args.getCollection(shortArg);
  Collection<String> longArgValues=(Collection<String>)args.getCollection(longArg);
  Collection<String> values=new ArrayList<String>();
  if (shortArgValues == null && longArgValues == null && defaultValue != null) {
    values.add(defaultValue);
  }
 else {
    if (shortArgValues != null) {
      values.addAll(shortArgValues);
    }
    if (longArgValues != null) {
      values.addAll(longArgValues);
    }
  }
  return values;
}
Program: 20603
Project: 20603
Buggy source:
/** 
 * Gets the value of an argument.
 * @param shortArg the short version of the argument (example: "h" for "-h")
 * @param longArg the long version of the argument (example: "help" for"--help")
 * @param defaultValue the value to return if the argument has no value
 * @return the argument's value or defaultValue if it has no value (example:"bar" is returned for the argument "--foo=bar")
 */
public String value(String shortArg,String longArg,String defaultValue){
  Collection<String> values=valueList(shortArg,longArg,defaultValue);
  if (values != null) {
    return values.iterator().next();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the value of an argument.
 * @param shortArg the short version of the argument (example: "h" for "-h")
 * @param longArg the long version of the argument (example: "help" for"--help")
 * @param defaultValue the value to return if the argument has no value
 * @return the argument's value or defaultValue if it has no value (example:"bar" is returned for the argument "--foo=bar")
 */
public String value(String shortArg,String longArg,String defaultValue){
  Collection<String> values=valueList(shortArg,longArg,defaultValue);
  if (values.isEmpty()) {
    return null;
  }
  return values.iterator().next();
}
Program: 20604
Project: 20604
Buggy source:
@Override public boolean canRemove(){
  if (this.fsm.getCurrentState() == FSM.END_STATE) {
    if (interpreter.countPlansOfType(this.type) <= 1) {
      ConversationMulticast temp=spawn(null,null);
      interpreter.addPlan(temp);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canRemove(){
  if (this.fsm.getCurrentState() == FSM.END_STATE) {
    if (interpreter.countPlansOfType(this.type) <= 1) {
      ConversationMulticastMultiRole temp=spawn(null,null);
      interpreter.addPlan(temp);
    }
    return true;
  }
  return false;
}
Program: 20605
Project: 20605
Buggy source:
@Override public void handle(Message msg){
  if ((msg.getToKey() == null)) {
    if (myKey != null) {
      String key=dm.keyGen.getKey();
      msg.setToKey(key);
      ConversationMulticastMultiRole conv=spawn(key,msg);
      interpreter.addPlan(conv);
      interpreter.addInput(msg);
      return;
    }
 else {
      this.myKey=dm.keyGen.getKey();
      TreeMap<String,String> map=new TreeMap<String,String>();
      map.put(msg.getFrom(),msg.getFromKey());
      this.role_to_toKey=map;
    }
  }
  if (!this.role_to_toKey.containsKey(msg.getFrom()))   return;
  handleFSMTransistion(msg);
}

Fixed version (ground truth):
@Override public void handle(Message msg){
  if ((msg.getToKey() == null)) {
    if (myKey != null) {
      String key=dm.keyGen.getKey();
      msg.setToKey(key);
      ConversationMulticastMultiRole conv=spawn(key,msg);
      interpreter.addPlan(conv);
      interpreter.addInput(msg);
      return;
    }
 else {
      this.myKey=dm.keyGen.getKey();
      TreeMap<String,String> map=new TreeMap<String,String>();
      map.put(msg.getFrom(),msg.getFromKey());
    }
  }
  if (!this.role_to_toKey.containsKey(msg.getFrom()))   return;
  handleFSMTransistion(msg);
}
Program: 20606
Project: 20606
Buggy source:
public synchronized void sendBuffer(byte[] msgBuffer){
  if (outStream == null) {
    return;
  }
  for (  final byte element : msgBuffer) {
    try {
      outStream.write(element);
      outStream.flush();
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str");
      outStream=null;
    }
    sleep(50);
  }
}

Fixed version (ground truth):
public synchronized void sendBuffer(byte[] msgBuffer){
  if (outStream == null) {
    return;
  }
  for (  final byte element : msgBuffer) {
    try {
      outStream.write(element);
      outStream.flush();
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str");
      outStream=null;
      return;
    }
    sleep(50);
  }
}
Program: 20607
Project: 20607
Buggy source:
public boolean checkBluetoothAvailable(){
  return mBluetoothAdapter != null && mBluetoothAdapter.isEnabled();
}

Fixed version (ground truth):
public synchronized boolean checkBluetoothAvailable(){
  return mBluetoothAdapter != null && mBluetoothAdapter.isEnabled();
}
Program: 20608
Project: 20608
Buggy source:
public boolean connect(){
  Log.d(TAG,"String_Node_Str");
  if (device == null) {
    device=mBluetoothAdapter.getRemoteDevice(address);
  }
  if (btSocket == null) {
    Log.d(TAG,"String_Node_Str" + device.getName());
    try {
      btSocket=device.createRfcommSocketToServiceRecord(MY_UUID);
    }
 catch (    final IOException e) {
      Log.e(TAG,"String_Node_Str",e);
      return false;
    }
    mBluetoothAdapter.cancelDiscovery();
    try {
      btSocket.connect();
      Log.e(TAG,"String_Node_Str");
    }
 catch (    final IOException e) {
      Log.e(TAG,"String_Node_Str",e);
      try {
        btSocket.close();
      }
 catch (      final IOException e2) {
        Log.e(TAG,"String_Node_Str",e2);
      }
      return false;
    }
  }
  if (outStream == null) {
    try {
      outStream=btSocket.getOutputStream();
    }
 catch (    final IOException e) {
      Log.e(TAG,"String_Node_Str",e);
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public synchronized boolean connect(){
  Log.d(TAG,"String_Node_Str");
  if (device == null) {
    device=mBluetoothAdapter.getRemoteDevice(address);
  }
  if (btSocket == null) {
    Log.d(TAG,"String_Node_Str" + device.getName());
    try {
      btSocket=device.createRfcommSocketToServiceRecord(MY_UUID);
    }
 catch (    final IOException e) {
      Log.e(TAG,"String_Node_Str",e);
      return false;
    }
    mBluetoothAdapter.cancelDiscovery();
    try {
      btSocket.connect();
      Log.e(TAG,"String_Node_Str");
    }
 catch (    final IOException e) {
      Log.e(TAG,"String_Node_Str",e);
      try {
        btSocket.close();
      }
 catch (      final IOException e2) {
        Log.e(TAG,"String_Node_Str",e2);
      }
      return false;
    }
  }
  if (outStream == null) {
    try {
      outStream=btSocket.getOutputStream();
    }
 catch (    final IOException e) {
      Log.e(TAG,"String_Node_Str",e);
      return false;
    }
  }
  return true;
}
Program: 20609
Project: 20609
Buggy source:
public void run(){
  if (!bluetooth.isConnected()) {
    bluetooth.connect();
  }
 else {
    robotControl.sendCommandString(RobotControl.UPDOWN_AXIS,updownValue);
    robotControl.sendCommandString(RobotControl.SIDEWAYS_AXIS,sidewaysValue);
  }
  bluetoothConnectionStatusToggle.setChecked(bluetooth.checkBluetoothAvailable());
  deviceConnectedStatusToggle.setChecked(bluetooth.isConnected());
  handlerTimer.postDelayed(this,300);
}

Fixed version (ground truth):
public void run(){
  if (!bluetooth.isConnected()) {
    if (bluetooth.checkBluetoothAvailable()) {
      bluetooth.connect();
    }
  }
 else {
    robotControl.sendCommandString(RobotControl.UPDOWN_AXIS,updownValue);
    robotControl.sendCommandString(RobotControl.SIDEWAYS_AXIS,sidewaysValue);
  }
  bluetoothConnectionStatusToggle.setChecked(bluetooth.checkBluetoothAvailable());
  deviceConnectedStatusToggle.setChecked(bluetooth.isConnected());
  handlerTimer.postDelayed(this,300);
}
Program: 20611
Project: 20611
Buggy source:
@Override public Object datapack(MuleMessage message,String outputEncoding) throws TransformerException {
  this.generateHeadersIfNecessary(message);
  StringBuilder output=new StringBuilder();
  for (int i=0; i < columns.size(); i++) {
    Column column=columns.get(i);
    String value=this.evaluate(message,column);
    String encloseChar=determineEncloseChar(column);
    this.encloseIfNessesary(output,encloseChar);
    Integer columnLength=0;
    if (!StringUtils.isEmpty(column.getLength())) {
      try {
        columnLength=Integer.parseInt(column.getLength());
      }
 catch (      NumberFormatException e) {
        columnLength=0;
      }
    }
    if (columnLength > 0) {
      int vlen=value.length();
      if (this.trimToLength) {
        value=value.substring(0,vlen < columnLength ? vlen : columnLength);
      }
 else       if (this.fillToLength && vlen < columnLength) {
        value=StringUtils.rightPad(value,columnLength - vlen + 1,this.fillLengthChar);
      }
 else       if (this.prefixToLength && vlen < columnLength) {
        value=StringUtils.leftPad(value,columnLength - vlen + 1,this.fillLengthChar);
      }
    }
    output.append(value);
    if (addSpace && value.length() == 0) {
      output.append(' ');
    }
    this.encloseIfNessesary(output,encloseChar);
    if (column.getLineBreak() != null && Boolean.parseBoolean(column.getLineBreak())) {
      output.append(newlineChar);
    }
 else     if (i < columns.size() - 1) {
      output.append(delimiterChar);
    }
  }
  output.append(newlineChar);
  return output.toString();
}

Fixed version (ground truth):
@Override public Object datapack(MuleMessage message,String outputEncoding) throws TransformerException {
  this.generateHeadersIfNecessary(message);
  StringBuilder output=new StringBuilder();
  for (int i=0; i < columns.size(); i++) {
    Column column=columns.get(i);
    String value=this.evaluate(message,column);
    String encloseChar=determineEncloseChar(column);
    this.encloseIfNessesary(output,encloseChar);
    int columnLength=0;
    if (!StringUtils.isEmpty(column.getLength())) {
      try {
        columnLength=Integer.parseInt(column.getLength());
      }
 catch (      NumberFormatException e) {
        columnLength=0;
      }
    }
    if (columnLength > 0) {
      int vlen=value.length();
      if (this.trimToLength) {
        value=value.substring(0,vlen < columnLength ? vlen : columnLength);
      }
 else       if (this.fillToLength && vlen < columnLength) {
        value=StringUtils.rightPad(value,columnLength,this.fillLengthChar);
      }
 else       if (this.prefixToLength && vlen < columnLength) {
        value=StringUtils.leftPad(value,columnLength,this.fillLengthChar);
      }
    }
    output.append(value);
    if (addSpace && value.length() == 0) {
      output.append(' ');
    }
    this.encloseIfNessesary(output,encloseChar);
    if (column.getLineBreak() != null && Boolean.parseBoolean(column.getLineBreak())) {
      output.append(newlineChar);
    }
 else     if (i < columns.size() - 1) {
      output.append(delimiterChar);
    }
  }
  output.append(newlineChar);
  return output.toString();
}
Program: 20612
Project: 20612
Buggy source:
public void testFillLength() throws Exception {
  MuleClient client=new MuleClient(muleContext);
  MuleMessage msg=new DefaultMuleMessage("String_Node_Str",muleContext);
  MuleMessage result=client.send("String_Node_Str",msg);
  String transformation=result.getPayload().toString();
  assertNotNull(transformation);
  String[] values=transformation.split("String_Node_Str");
  assertEquals(values.length,2);
  assertEquals(values[0].length(),5);
  assertEquals(values[1].length(),6);
  assertEquals(values[0].substring(1),"String_Node_Str");
  assertEquals(values[1].substring(1,values[1].length() - 1),"String_Node_Str");
}

Fixed version (ground truth):
public void testFillLength() throws Exception {
  MuleClient client=new MuleClient(muleContext);
  MuleMessage msg=new DefaultMuleMessage("String_Node_Str",muleContext);
  MuleMessage result=client.send("String_Node_Str",msg);
  String transformation=result.getPayload().toString();
  assertNotNull(transformation);
  String[] values=transformation.split("String_Node_Str");
  assertEquals(values.length,3);
  assertEquals(values[0],"String_Node_Str");
  assertEquals(values[1],"String_Node_Str");
  assertEquals(values[2],"String_Node_Str");
}
Program: 20613
Project: 20613
Buggy source:
public void testPrefixLength() throws Exception {
  MuleClient client=new MuleClient(muleContext);
  MuleMessage msg=new DefaultMuleMessage("String_Node_Str",muleContext);
  MuleMessage result=client.send("String_Node_Str",msg);
  String transformation=result.getPayload().toString();
  assertNotNull(transformation);
  String[] values=transformation.split("String_Node_Str");
  assertEquals(values.length,2);
  assertEquals(values[0].length(),5);
  assertEquals(values[1].length(),6);
  assertEquals(values[0].substring(0,values[0].length() - 1),"String_Node_Str","String_Node_Str");
  assertEquals(values[1].substring(0,values[1].length() - 2),"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testPrefixLength() throws Exception {
  MuleClient client=new MuleClient(muleContext);
  MuleMessage msg=new DefaultMuleMessage("String_Node_Str",muleContext);
  MuleMessage result=client.send("String_Node_Str",msg);
  String transformation=result.getPayload().toString();
  assertNotNull(transformation);
  String[] values=transformation.split("String_Node_Str");
  assertEquals(values.length,3);
  assertEquals(values[0],"String_Node_Str");
  assertEquals(values[1],"String_Node_Str");
  assertEquals(values[2],"String_Node_Str");
}
Program: 20615
Project: 20615
Buggy source:
@Override protected Executor executor(){
  return executor();
}

Fixed version (ground truth):
@Override protected Executor executor(){
  return executor;
}
Program: 20616
Project: 20616
Buggy source:
public LoginCookies(DataSource dataSource,Timer timer){
  this.dataSource=dataSource;
  timer.scheduleAtFixedRate(cleanupTask,ONE_MINUTE,ONE_HOUR);
}

Fixed version (ground truth):
public LoginCookies(DataSource dataSource,Timer timer){
  this.dataSource=dataSource;
  timer.scheduleAtFixedRate(cleanupTask,ONE_MINUTE * 1000,ONE_HOUR * 1000);
}
Program: 20617
Project: 20617
Buggy source:
public Collection<AuditResult> getResults(){
  try {
    ImmutableList.Builder<AuditResult> listBuilder=ImmutableList.<AuditResult>builder();
    for (    TaskAssignment a : unusedTaskAssignments()) {
      listBuilder.add(new AuditResult(AuditResultType.warning,String.format("String_Node_Str",a.getTask().getName(),a.getTask().getId(),a.getEmployee().getDisplayName()),a.getEmployee().getURL()));
    }
    for (    TaskAssignment a : duplicateTaskAssignments()) {
      listBuilder.add(new AuditResult(AuditResultType.warning,String.format("String_Node_Str",a.getTask().getName(),a.getTask().getId(),a.getEmployee().getDisplayName()),a.getEmployee().getURL()));
    }
    for (    TaskAssignment a : oldTaskAssignments()) {
      listBuilder.add(new AuditResult(AuditResultType.warning,String.format("String_Node_Str",a.getTask().getName(),a.getTask().getId(),a.getEmployee().getDisplayName()),a.getEmployee().getURL()));
    }
    return listBuilder.build();
  }
 catch (  SQLException se) {
    throw new RuntimeException(se);
  }
}

Fixed version (ground truth):
public Collection<AuditResult> getResults(){
  try {
    ImmutableList.Builder<AuditResult> listBuilder=ImmutableList.<AuditResult>builder();
    for (    TaskAssignment a : unusedTaskAssignments()) {
      listBuilder.add(new AuditResult(AuditResultType.warning,String.format("String_Node_Str",a.getTask().getName(),a.getTask().getId(),a.getEmployee().getDisplayName()),a.getURL()));
    }
    for (    TaskAssignment a : duplicateTaskAssignments()) {
      listBuilder.add(new AuditResult(AuditResultType.warning,String.format("String_Node_Str",a.getTask().getName(),a.getTask().getId(),a.getEmployee().getDisplayName()),a.getURL()));
    }
    for (    TaskAssignment a : oldTaskAssignments()) {
      listBuilder.add(new AuditResult(AuditResultType.warning,String.format("String_Node_Str",a.getTask().getName(),a.getTask().getId(),a.getEmployee().getDisplayName()),a.getURL()));
    }
    return listBuilder.build();
  }
 catch (  SQLException se) {
    throw new RuntimeException(se);
  }
}
Program: 20618
Project: 20618
Buggy source:
/** 
 * Handles the HTTP <code>POST</code> method.
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  String username=request.getParameter("String_Node_Str");
  String password=request.getParameter("String_Node_Str");
  int domainIndex=username.indexOf('@');
  if (domainIndex != -1) {
    username=username.substring(0,domainIndex);
  }
  boolean valid=directory.checkCredentials(username,password);
  HttpSession session=request.getSession();
  if (valid) {
    Employee user=directory.getByUserName().get(username);
    session.setAttribute("String_Node_Str",user);
    request.setAttribute("String_Node_Str",user);
    session.setAttribute("String_Node_Str",null);
    String destination=request.getParameter("String_Node_Str");
    if (destination == null) {
      destination=request.getContextPath();
    }
    response.sendRedirect(destination);
  }
 else {
    session.setAttribute("String_Node_Str",true);
    response.sendRedirect(request.getContextPath() + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Handles the HTTP <code>POST</code> method.
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  String username=request.getParameter("String_Node_Str");
  String password=request.getParameter("String_Node_Str");
  username=username.toLowerCase();
  int domainIndex=username.indexOf('@');
  if (domainIndex != -1) {
    username=username.substring(0,domainIndex);
  }
  boolean valid=directory.checkCredentials(username,password);
  HttpSession session=request.getSession();
  if (valid) {
    Employee user=directory.getByUserName().get(username);
    session.setAttribute("String_Node_Str",user);
    session.setAttribute("String_Node_Str",null);
    String destination=request.getParameter("String_Node_Str");
    if (destination == null) {
      destination=request.getContextPath();
    }
    response.sendRedirect(destination);
  }
 else {
    session.setAttribute("String_Node_Str",true);
    response.sendRedirect(request.getContextPath() + "String_Node_Str");
  }
}
Program: 20619
Project: 20619
Buggy source:
private Map<Date,BigDecimal> overhead(Connection connection) throws SQLException {
  PreparedStatement s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    s.setInt(1,days);
    s.setInt(2,sarariman.getPaidTimeOff().getPaidTimeOffTask().getId());
    ResultSet r=s.executeQuery();
    try {
      ImmutableSortedMap.Builder<Date,BigDecimal> mapBuilder=ImmutableSortedMap.<Date,BigDecimal>naturalOrder();
      while (r.next()) {
        Date date=r.getDate("String_Node_Str");
        BigDecimal total=r.getBigDecimal("String_Node_Str");
        mapBuilder.put(date,total);
      }
      return mapBuilder.build();
    }
  finally {
      r.close();
    }
  }
  finally {
    s.close();
  }
}

Fixed version (ground truth):
private Map<Date,BigDecimal> overhead(Connection connection) throws SQLException {
  PreparedStatement s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    s.setInt(1,days);
    s.setInt(2,sarariman.getPaidTimeOff().getPaidTimeOffTask().getId());
    ResultSet r=s.executeQuery();
    try {
      ImmutableSortedMap.Builder<Date,BigDecimal> mapBuilder=ImmutableSortedMap.<Date,BigDecimal>naturalOrder();
      while (r.next()) {
        Date date=r.getDate("String_Node_Str");
        BigDecimal total=r.getBigDecimal("String_Node_Str");
        mapBuilder.put(date,total);
      }
      return mapBuilder.build();
    }
  finally {
      r.close();
    }
  }
  finally {
    s.close();
  }
}
Program: 20620
Project: 20620
Buggy source:
private Map<Date,BigDecimal> pto(Connection connection) throws SQLException {
  PreparedStatement s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    s.setInt(1,days);
    s.setInt(2,sarariman.getPaidTimeOff().getPaidTimeOffTask().getId());
    ResultSet r=s.executeQuery();
    try {
      ImmutableSortedMap.Builder<Date,BigDecimal> mapBuilder=ImmutableSortedMap.<Date,BigDecimal>naturalOrder();
      while (r.next()) {
        Date date=r.getDate("String_Node_Str");
        BigDecimal total=r.getBigDecimal("String_Node_Str");
        mapBuilder.put(date,total);
      }
      return mapBuilder.build();
    }
  finally {
      r.close();
    }
  }
  finally {
    s.close();
  }
}

Fixed version (ground truth):
private Map<Date,BigDecimal> pto(Connection connection) throws SQLException {
  PreparedStatement s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    s.setInt(1,days);
    s.setInt(2,sarariman.getPaidTimeOff().getPaidTimeOffTask().getId());
    ResultSet r=s.executeQuery();
    try {
      ImmutableSortedMap.Builder<Date,BigDecimal> mapBuilder=ImmutableSortedMap.<Date,BigDecimal>naturalOrder();
      while (r.next()) {
        Date date=r.getDate("String_Node_Str");
        BigDecimal total=r.getBigDecimal("String_Node_Str");
        mapBuilder.put(date,total);
      }
      return mapBuilder.build();
    }
  finally {
      r.close();
    }
  }
  finally {
    s.close();
  }
}
Program: 20621
Project: 20621
Buggy source:
private Map<Date,BigDecimal> billable(Connection connection) throws SQLException {
  PreparedStatement s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    s.setInt(1,days);
    ResultSet r=s.executeQuery();
    try {
      ImmutableSortedMap.Builder<Date,BigDecimal> mapBuilder=ImmutableSortedMap.<Date,BigDecimal>naturalOrder();
      while (r.next()) {
        Date date=r.getDate("String_Node_Str");
        BigDecimal total=r.getBigDecimal("String_Node_Str");
        mapBuilder.put(date,total);
      }
      return mapBuilder.build();
    }
  finally {
      r.close();
    }
  }
  finally {
    s.close();
  }
}

Fixed version (ground truth):
private Map<Date,BigDecimal> billable(Connection connection) throws SQLException {
  PreparedStatement s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  try {
    s.setInt(1,days);
    ResultSet r=s.executeQuery();
    try {
      ImmutableSortedMap.Builder<Date,BigDecimal> mapBuilder=ImmutableSortedMap.<Date,BigDecimal>naturalOrder();
      while (r.next()) {
        Date date=r.getDate("String_Node_Str");
        BigDecimal total=r.getBigDecimal("String_Node_Str");
        mapBuilder.put(date,total);
      }
      return mapBuilder.build();
    }
  finally {
      r.close();
    }
  }
  finally {
    s.close();
  }
}
Program: 20622
Project: 20622
Buggy source:
/** 
 * Handles the HTTP <code>GET</code> method.
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  response.setContentType("String_Node_Str");
  PrintWriter out=response.getWriter();
  try {
    Connection connection=sarariman.openConnection();
    try {
      out.println("String_Node_Str");
      Map<Date,BigDecimal> billable=billable(connection);
      Map<Date,BigDecimal> overhead=overhead(connection);
      Map<Date,BigDecimal> pto=pto(connection);
      Set<Date> allDates=Utilities.<Date,BigDecimal>allKeys(ImmutableList.of(billable,overhead));
      for (      Date date : allDates) {
        out.print(date);
        BigDecimal b=billable.get(date);
        if (b == null) {
          b=BigDecimal.ZERO;
        }
        BigDecimal o=overhead.get(date);
        if (o == null) {
          o=BigDecimal.ZERO;
        }
        BigDecimal p=pto.get(date);
        if (p == null) {
          p=BigDecimal.ZERO;
        }
        out.println(String.format("String_Node_Str",date,b,o,p));
      }
      out.println("String_Node_Str");
    }
  finally {
      connection.close();
    }
  }
 catch (  SQLException e) {
    throw new ServletException(e);
  }
 finally {
    out.close();
  }
}

Fixed version (ground truth):
/** 
 * Handles the HTTP <code>GET</code> method.
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  response.setContentType("String_Node_Str");
  PrintWriter out=response.getWriter();
  try {
    Connection connection=sarariman.openConnection();
    try {
      out.println("String_Node_Str");
      Map<Date,BigDecimal> billable=billable(connection);
      Map<Date,BigDecimal> overhead=overhead(connection);
      Map<Date,BigDecimal> pto=pto(connection);
      Set<Date> allDates=new TreeSet<Date>(Utilities.<Date,BigDecimal>allKeys(ImmutableList.of(billable,overhead)));
      for (      Date date : allDates) {
        BigDecimal b=billable.get(date);
        if (b == null) {
          b=BigDecimal.ZERO;
        }
        BigDecimal o=overhead.get(date);
        if (o == null) {
          o=BigDecimal.ZERO;
        }
        BigDecimal p=pto.get(date);
        if (p == null) {
          p=BigDecimal.ZERO;
        }
        out.println(String.format("String_Node_Str",date,b,o,p));
      }
      out.println("String_Node_Str");
    }
  finally {
      connection.close();
    }
  }
 catch (  SQLException e) {
    throw new ServletException(e);
  }
 finally {
    out.close();
  }
}
Program: 20623
Project: 20623
Buggy source:
public Collection<ProjectedExpense> getProjectedExpenses(PeriodOfPerformance pop){
  Collection<ProjectedExpense> result=new ArrayList<ProjectedExpense>();
  Collection<LaborProjection> laborProjections=getLaborProjections();
  for (  LaborProjection projection : laborProjections) {
    PeriodOfPerformance intersection=projection.getPeriodOfPerformance().intersection(pop);
    ProjectedExpense projectedExpense=new ProjectedExpenseImpl(projection.getEmployee(),intersection,projection.getTask(),workdays,categoriesById,projectBillRates,dataSource);
    result.add(projectedExpense);
  }
  return result;
}

Fixed version (ground truth):
public Collection<ProjectedExpense> getProjectedExpenses(PeriodOfPerformance pop){
  Collection<ProjectedExpense> result=new ArrayList<ProjectedExpense>();
  Collection<LaborProjection> laborProjections=getLaborProjections();
  for (  LaborProjection projection : laborProjections) {
    PeriodOfPerformance intersection=projection.getPeriodOfPerformance().intersection(pop);
    ProjectedExpense projectedExpense=new ProjectedExpenseImpl(projection.getEmployee(),intersection,projection.getTask(),projection.getUtilization(),workdays,categoriesById,projectBillRates,dataSource);
    result.add(projectedExpense);
  }
  return result;
}
Program: 20624
Project: 20624
Buggy source:
public ProjectedExpenseImpl(Employee employee,PeriodOfPerformance pop,Task task,Workdays workdays,Map<Long,LaborCategory> categoriesById,Collection<LaborCategoryAssignment> projectBillRates,DataSource dataSource){
  this.employee=employee;
  this.pop=pop;
  this.task=task;
  this.workdays=workdays;
  this.categoriesById=categoriesById;
  this.projectBillRates=projectBillRates;
  this.dataSource=dataSource;
}

Fixed version (ground truth):
public ProjectedExpenseImpl(Employee employee,PeriodOfPerformance pop,Task task,double utilization,Workdays workdays,Map<Long,LaborCategory> categoriesById,Collection<LaborCategoryAssignment> projectBillRates,DataSource dataSource){
  this.employee=employee;
  this.pop=pop;
  this.task=task;
  this.utilization=utilization;
  this.workdays=workdays;
  this.categoriesById=categoriesById;
  this.projectBillRates=projectBillRates;
  this.dataSource=dataSource;
}
Program: 20625
Project: 20625
Buggy source:
public BigDecimal getCost(){
  Collection<Date> dates=workdays.getWorkdays(pop);
  BigDecimal total=BigDecimal.ZERO;
  for (  Date date : dates) {
    try {
      CostData cost=Invoice.cost(categoriesById,projectBillRates,task.getProject().getId(),employee.getNumber(),task,SQLUtilities.convert(date),8,dataSource);
      if (cost.getLaborCategory() == null) {
        return BigDecimal.ZERO;
      }
      total=total.add(cost.getCost());
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
  return total;
}

Fixed version (ground truth):
public BigDecimal getCost(){
  Collection<Date> dates=workdays.getWorkdays(pop);
  BigDecimal total=BigDecimal.ZERO;
  for (  Date date : dates) {
    double duration=8 * utilization;
    try {
      CostData cost=Invoice.cost(categoriesById,projectBillRates,task.getProject().getId(),employee.getNumber(),task,SQLUtilities.convert(date),duration,dataSource);
      if (cost.getLaborCategory() == null) {
        return BigDecimal.ZERO;
      }
      total=total.add(cost.getCost());
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
  return total;
}
Program: 20627
Project: 20627
Buggy source:
public Collection<AuditResult> getResults(){
  try {
    Connection connection=connectionFactory.openConnection();
    try {
      PreparedStatement p=connection.prepareStatement("String_Node_Str");
      try {
        p.setInt(1,project);
        ResultSet rs=p.executeQuery();
        try {
          Set<Integer> missing=new HashSet<Integer>();
          while (rs.next()) {
            int manager=rs.getInt("String_Node_Str");
            int employee=rs.getInt("String_Node_Str");
            Date date=rs.getDate("String_Node_Str");
            if (employee != manager) {
              Collection<Integer> orgChartManagers=organizationHierarchy.getManagers(employee,date);
              if (!orgChartManagers.contains(manager)) {
                missing.add(employee);
              }
            }
          }
          Collection<AuditResult> results=new ArrayList<AuditResult>();
          for (          Integer employee : missing) {
            String name=directory.getByNumber().get(employee).getDisplayName();
            AuditResult result=new AuditResult(AuditResultType.error,String.format("String_Node_Str",name));
            results.add(result);
          }
          return results;
        }
  finally {
          rs.close();
        }
      }
  finally {
        p.close();
      }
    }
  finally {
      connection.close();
    }
  }
 catch (  SQLException se) {
    throw new RuntimeException(se);
  }
}

Fixed version (ground truth):
public Collection<AuditResult> getResults(){
  try {
    Connection connection=connectionFactory.openConnection();
    try {
      PreparedStatement p=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      try {
        p.setInt(1,project);
        p.setInt(2,project);
        ResultSet rs=p.executeQuery();
        try {
          Set<Integer> missing=new HashSet<Integer>();
          while (rs.next()) {
            int manager=rs.getInt("String_Node_Str");
            int employee=rs.getInt("String_Node_Str");
            Date date=rs.getDate("String_Node_Str");
            Collection<Integer> orgChartManagers=organizationHierarchy.getManagers(employee,date);
            if (orgChartManagers.contains(manager)) {
              missing.remove(employee);
            }
 else {
              missing.add(employee);
            }
          }
          Collection<AuditResult> results=new ArrayList<AuditResult>();
          for (          Integer employee : missing) {
            String name=directory.getByNumber().get(employee).getDisplayName();
            AuditResult result=new AuditResult(AuditResultType.error,String.format("String_Node_Str",name));
            results.add(result);
          }
          return results;
        }
  finally {
          rs.close();
        }
      }
  finally {
        p.close();
      }
    }
  finally {
      connection.close();
    }
  }
 catch (  SQLException se) {
    throw new RuntimeException(se);
  }
}
Program: 20628
Project: 20628
Buggy source:
/** 
 * Synchronized this directory against the backing store.
 */
void reload();

Fixed version (ground truth):
/** 
 * Synchronize this directory against the backing store.
 */
void reload();
Program: 20629
Project: 20629
Buggy source:
/** 
 * Retrieves a Map of Employees with usernamees as the keys.
 * @return a Map of Employees with the username as the key
 */
Map<String,Employee> getByUserName();

Fixed version (ground truth):
/** 
 * Retrieves a Map of Employees with usernames as the keys.
 * @return a Map of Employees with the username as the key
 */
Map<String,Employee> getByUserName();
Program: 20630
Project: 20630
Buggy source:
public static Project create(Sarariman sarariman,String name,Long customer,Date pop_start,Date pop_end,String contract,String subcontract,BigDecimal funded,BigDecimal previouslyBilled,long terms,BigDecimal odc_fee,boolean active) throws SQLException {
  Connection connection=sarariman.openConnection();
  PreparedStatement ps=connection.prepareStatement("String_Node_Str");
  try {
    ps.setString(1,name);
    ps.setLong(2,customer);
    ps.setDate(3,pop_start);
    ps.setDate(4,pop_end);
    ps.setString(5,contract);
    ps.setString(6,subcontract);
    ps.setBigDecimal(7,funded);
    ps.setBigDecimal(8,previouslyBilled);
    ps.setLong(9,terms);
    ps.setLong(10,terms);
    ps.setBoolean(11,active);
    ps.executeUpdate();
    ResultSet rs=ps.getGeneratedKeys();
    try {
      rs.next();
      PeriodOfPerformance pop=new PeriodOfPerformance(pop_start,pop_end);
      return new Project(sarariman,rs.getLong(1),name,customer,contract,subcontract,funded,previouslyBilled,terms,pop,odc_fee,active);
    }
  finally {
      rs.close();
    }
  }
  finally {
    ps.close();
    connection.close();
  }
}

Fixed version (ground truth):
public static Project create(Sarariman sarariman,String name,Long customer,Date pop_start,Date pop_end,String contract,String subcontract,BigDecimal funded,BigDecimal previouslyBilled,long terms,BigDecimal odc_fee,boolean active) throws SQLException {
  Connection connection=sarariman.openConnection();
  PreparedStatement ps=connection.prepareStatement("String_Node_Str");
  try {
    ps.setString(1,name);
    ps.setLong(2,customer);
    ps.setDate(3,pop_start);
    ps.setDate(4,pop_end);
    ps.setString(5,contract);
    ps.setString(6,subcontract);
    ps.setBigDecimal(7,funded);
    ps.setBigDecimal(8,previouslyBilled);
    ps.setLong(9,terms);
    ps.setBigDecimal(10,odc_fee);
    ps.setBoolean(11,active);
    ps.executeUpdate();
    ResultSet rs=ps.getGeneratedKeys();
    try {
      rs.next();
      PeriodOfPerformance pop=new PeriodOfPerformance(pop_start,pop_end);
      return new Project(sarariman,rs.getLong(1),name,customer,contract,subcontract,funded,previouslyBilled,terms,pop,odc_fee,active);
    }
  finally {
      rs.close();
    }
  }
  finally {
    ps.close();
    connection.close();
  }
}
Program: 20631
Project: 20631
Buggy source:
private void scheduleMorningTask(){
  Calendar firstTime=Calendar.getInstance();
  Calendar now=Calendar.getInstance();
  firstTime.set(Calendar.HOUR_OF_DAY,8);
  firstTime.set(Calendar.MINUTE,0);
  firstTime.set(Calendar.SECOND,0);
  if (firstTime.before(now)) {
    firstTime.roll(Calendar.DATE,true);
  }
  long period=ONE_DAY;
  timer.scheduleAtFixedRate(new MorningTask(sarariman,directory,emailDispatcher),firstTime.getTime(),period);
}

Fixed version (ground truth):
private void scheduleMorningTask(){
  Calendar firstTime=Calendar.getInstance();
  Calendar now=Calendar.getInstance();
  firstTime.set(Calendar.HOUR_OF_DAY,8);
  firstTime.set(Calendar.MINUTE,0);
  firstTime.set(Calendar.SECOND,0);
  if (firstTime.before(now)) {
    firstTime.add(Calendar.DATE,1);
  }
  long period=ONE_DAY;
  timer.scheduleAtFixedRate(new MorningTask(sarariman,directory,emailDispatcher),firstTime.getTime(),period);
}