nus-yam/ex-repair huggingface dataset:
Program: 37890
Project: 37890
Buggy source:
public void run(){
  bossGroup=new NioEventLoopGroup(1);
  workerGroup=new NioEventLoopGroup();
  try {
    SSLEngine engine=createSSLEngine();
    ServerBootstrap b=new ServerBootstrap();
    b.group(bossGroup,workerGroup);
    b.channel(NioServerSocketChannel.class);
    b.childHandler(new ChannelInitializer<SocketChannel>(){
      @Override public void initChannel(      SocketChannel ch) throws Exception {
        ChannelPipeline pipeline=ch.pipeline();
        pipeline.addLast("String_Node_Str",new ReadTimeoutHandler(30));
        pipeline.addLast("String_Node_Str",new WriteTimeoutHandler(30));
        pipeline.addLast("String_Node_Str",new SslHandler(engine));
        pipeline.addLast("String_Node_Str",new HttpServerCodec());
        pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
        pipeline.addLast("String_Node_Str",new BergamotAgentServerHandler(BergamotAgentServer.this,engine));
      }
    }
);
    Channel ch=b.bind(this.configuration.getPort()).sync().channel();
    logger.info("String_Node_Str" + this.configuration.getPort() + '.');
    ch.closeFuture().sync();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
 finally {
    bossGroup.shutdownGracefully();
    workerGroup.shutdownGracefully();
  }
}

Fixed version (ground truth):
public void run(){
  bossGroup=new NioEventLoopGroup(1);
  workerGroup=new NioEventLoopGroup();
  try {
    ServerBootstrap b=new ServerBootstrap();
    b.group(bossGroup,workerGroup);
    b.channel(NioServerSocketChannel.class);
    b.childHandler(new ChannelInitializer<SocketChannel>(){
      @Override public void initChannel(      SocketChannel ch) throws Exception {
        SSLEngine engine=createSSLEngine();
        ChannelPipeline pipeline=ch.pipeline();
        pipeline.addLast("String_Node_Str",new ReadTimeoutHandler(30));
        pipeline.addLast("String_Node_Str",new WriteTimeoutHandler(30));
        pipeline.addLast("String_Node_Str",new SslHandler(engine));
        pipeline.addLast("String_Node_Str",new HttpServerCodec());
        pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
        pipeline.addLast("String_Node_Str",new BergamotAgentServerHandler(BergamotAgentServer.this,engine));
      }
    }
);
    Channel ch=b.bind(this.configuration.getPort()).sync().channel();
    logger.info("String_Node_Str" + this.configuration.getPort() + '.');
    ch.closeFuture().sync();
    logger.info("String_Node_Str");
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
 finally {
    bossGroup.shutdownGracefully();
    workerGroup.shutdownGracefully();
  }
}
Program: 37891
Project: 37891
Buggy source:
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipeline=ch.pipeline();
  pipeline.addLast("String_Node_Str",new ReadTimeoutHandler(30));
  pipeline.addLast("String_Node_Str",new WriteTimeoutHandler(30));
  pipeline.addLast("String_Node_Str",new SslHandler(engine));
  pipeline.addLast("String_Node_Str",new HttpServerCodec());
  pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
  pipeline.addLast("String_Node_Str",new BergamotAgentServerHandler(BergamotAgentServer.this,engine));
}

Fixed version (ground truth):
@Override public void initChannel(SocketChannel ch) throws Exception {
  SSLEngine engine=createSSLEngine();
  ChannelPipeline pipeline=ch.pipeline();
  pipeline.addLast("String_Node_Str",new ReadTimeoutHandler(30));
  pipeline.addLast("String_Node_Str",new WriteTimeoutHandler(30));
  pipeline.addLast("String_Node_Str",new SslHandler(engine));
  pipeline.addLast("String_Node_Str",new HttpServerCodec());
  pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
  pipeline.addLast("String_Node_Str",new BergamotAgentServerHandler(BergamotAgentServer.this,engine));
}
Program: 37892
Project: 37892
Buggy source:
public void registerAgent(BergamotAgentServerHandler agent){
  AgentHello hello=agent.getHello();
  this.agents.put(hello.getHostId(),agent);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    for (    BergamotAgentServerHandler ag : this.agents.values()) {
      logger.info("String_Node_Str" + ag.getHello().getHostId() + "String_Node_Str"+ ag.getHello().getHostName()+ "String_Node_Str"+ ag.getHello().getServiceId()+ "String_Node_Str"+ ag.getHello().getServiceName());
    }
  }
  if (this.onAgentRegister != null)   this.onAgentRegister.accept(agent);
}

Fixed version (ground truth):
public void registerAgent(BergamotAgentServerHandler agent){
  this.agents.put(agent.getHello().getHostId(),agent);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    for (    BergamotAgentServerHandler ag : this.agents.values()) {
      logger.info("String_Node_Str" + ag.getHello().getHostId() + "String_Node_Str"+ ag.getHello().getHostName()+ "String_Node_Str"+ ag.getHello().getServiceId()+ "String_Node_Str"+ ag.getHello().getServiceName());
    }
  }
  if (this.onAgentRegister != null)   this.onAgentRegister.accept(agent);
}
Program: 37895
Project: 37895
Buggy source:
@Test public void testSingleOkToBadTransition(){
  Transition transition;
  RealCheck<?,?> check=newCheck(1,1);
  CheckState state=newState(Status.PENDING,"String_Node_Str",true,1,false);
  Result result=newResult(false,"String_Node_Str","String_Node_Str");
  transition=this.computeResultTransition(check,state,result);
  System.out.println("String_Node_Str" + transition.stateChange + "String_Node_Str"+ transition.hardChange+ "String_Node_Str"+ transition.previousState+ "String_Node_Str"+ transition.nextState);
}

Fixed version (ground truth):
@Test public void testSingleOkToBadTransition(){
  System.out.println("String_Node_Str");
  Transition transition;
  RealCheck<?,?> check=newCheck(1,1);
  CheckState state=newState(Status.PENDING,"String_Node_Str",true,1,false);
  Result result=newResult(false,"String_Node_Str","String_Node_Str");
  transition=this.computeResultTransition(check,state,result);
  System.out.println("String_Node_Str" + transition.stateChange + "String_Node_Str"+ transition.hardChange+ "String_Node_Str"+ transition.previousState+ "String_Node_Str"+ transition.nextState);
  System.out.println("String_Node_Str");
}
Program: 37896
Project: 37896
Buggy source:
private CheckState newState(Status status,String output,boolean hard,int attempt,boolean transitioning){
  CheckState state=new CheckState();
  state.setCheckId(UUID.randomUUID());
  state.setStatus(status);
  state.setOk(state.isOk());
  state.setOutput(output);
  state.setHard(hard);
  state.setAttempt(attempt);
  state.setTransitioning(transitioning);
  return state;
}

Fixed version (ground truth):
private CheckState newState(Status status,String output,boolean hard,int attempt,boolean transitioning){
  CheckState state=new CheckState();
  state.setCheckId(UUID.randomUUID());
  state.setStatus(status);
  state.setOk(status.isOk());
  state.setOutput(output);
  state.setHard(hard);
  state.setAttempt(attempt);
  state.setTransitioning(transitioning);
  return state;
}
Program: 37897
Project: 37897
Buggy source:
public void execute(){
  if (this.port == -1)   this.port=this.ssl ? 443 : 80;
  if (this.virtualHost == null)   this.virtualHost=this.address;
  FullHttpRequest request=new DefaultFullHttpRequest(this.version,this.method,this.path);
  request.headers().add(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.CLOSE);
  if (this.port == 80)   request.headers().add(HttpHeaders.Names.HOST,this.virtualHost);
 else   request.headers().add(HttpHeaders.Names.HOST,this.virtualHost + "String_Node_Str" + this.port);
  request.headers().add(HttpHeaders.Names.USER_AGENT,"String_Node_Str");
  for (  Entry<String,String> e : this.headers) {
    request.headers().add(e.getKey(),e.getValue());
  }
  this.submit(this.address,this.port,this.connectTimeout,this.requestTimeout,this.ssl,this.permitInvalidCerts,this.virtualHost,this.protocols,this.ciphers,request,this.responseHandler,this.errorHandler);
}

Fixed version (ground truth):
public void execute(){
  if (this.port == -1)   this.port=this.ssl ? 443 : 80;
  if (this.virtualHost == null)   this.virtualHost=this.address;
  FullHttpRequest request=new DefaultFullHttpRequest(this.version,this.method,this.path);
  request.headers().add(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.CLOSE);
  if (this.port == 80 || this.port == 443)   request.headers().add(HttpHeaders.Names.HOST,this.virtualHost);
 else   request.headers().add(HttpHeaders.Names.HOST,this.virtualHost + "String_Node_Str" + this.port);
  request.headers().add(HttpHeaders.Names.USER_AGENT,"String_Node_Str");
  for (  Entry<String,String> e : this.headers) {
    request.headers().add(e.getKey(),e.getValue());
  }
  this.submit(this.address,this.port,this.connectTimeout,this.requestTimeout,this.ssl,this.permitInvalidCerts,this.virtualHost,this.protocols,this.ciphers,request,this.responseHandler,this.errorHandler);
}
Program: 37898
Project: 37898
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx){
  logger.debug("String_Node_Str");
  this.start=System.currentTimeMillis();
  ctx.writeAndFlush(this.request);
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx){
  logger.debug("String_Node_Str");
  this.start=System.currentTimeMillis();
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + this.request);
  ctx.writeAndFlush(this.request);
}
Program: 37899
Project: 37899
Buggy source:
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  FullHttpResponse response=(FullHttpResponse)msg;
  long runtime=System.currentTimeMillis() - this.start;
  logger.debug("String_Node_Str" + response.getStatus() + "String_Node_Str"+ runtime+ "String_Node_Str");
  TLSInfo tlsInfo=null;
  if (this.sslEngine != null) {
    try {
      tlsInfo=new TLSInfo(this.sslEngine);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
  }
  this.responseHandler.accept(new HTTPCheckResponse(runtime,response,tlsInfo));
  if (ctx.channel().isActive())   ctx.close();
}

Fixed version (ground truth):
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  FullHttpResponse response=(FullHttpResponse)msg;
  long runtime=System.currentTimeMillis() - this.start;
  logger.debug("String_Node_Str" + response.getStatus() + "String_Node_Str"+ runtime+ "String_Node_Str");
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + response);
  TLSInfo tlsInfo=null;
  if (this.sslEngine != null) {
    try {
      tlsInfo=new TLSInfo(this.sslEngine);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
  }
  this.responseHandler.accept(new HTTPCheckResponse(runtime,response,tlsInfo));
  if (ctx.channel().isActive())   ctx.close();
}
Program: 37900
Project: 37900
Buggy source:
public void configure(C configuration){
  this.setId(configuration.getId());
  this.setSiteId(Site.getSiteId(this.getId()));
  for (  CfgParameter param : configuration.getParameters()) {
    this.parameters.clear();
    this.parameters.add(new Parameter(param.getName(),param.getValueOrText()));
  }
  this.setConfiguration(configuration);
}

Fixed version (ground truth):
public void configure(C configuration){
  this.setId(configuration.getId());
  this.setSiteId(Site.getSiteId(this.getId()));
  this.parameters.clear();
  for (  CfgParameter param : configuration.getParameters()) {
    this.parameters.add(new Parameter(param.getName(),param.getValueOrText()));
  }
  this.setConfiguration(configuration);
}
Program: 37901
Project: 37901
Buggy source:
protected void toMO(CheckMO mo,boolean stub){
  super.toMO(mo,stub);
  mo.setEnabled(this.isEnabled());
  mo.setState(this.getState().toMO());
  mo.setSuppressed(this.isSuppressed());
  if (!stub) {
    mo.setGroups(this.getGroups().stream().map(Group::toStubMO).collect(Collectors.toList()));
    mo.setContacts(this.getContacts().stream().map(Contact::toStubMO).collect(Collectors.toList()));
    mo.setTeams(this.getTeams().stream().map(Team::toStubMO).collect(Collectors.toList()));
    mo.setReferencedBy(this.getReferencedBy().stream().map(VirtualCheck::toStubMO).collect(Collectors.toList()));
    mo.setNotifications(this.getNotifications().toMO());
  }
}

Fixed version (ground truth):
protected void toMO(CheckMO mo,boolean stub){
  super.toMO(mo,stub);
  mo.setEnabled(this.isEnabled());
  mo.setState(this.getState().toMO());
  mo.setSuppressed(this.isSuppressed());
  if (!stub) {
    mo.setGroups(this.getGroups().stream().map(Group::toStubMO).collect(Collectors.toList()));
    mo.setContacts(this.getContacts().stream().map(Contact::toStubMO).collect(Collectors.toList()));
    mo.setTeams(this.getTeams().stream().map(Team::toStubMO).collect(Collectors.toList()));
    mo.setReferencedBy(this.getReferencedBy().stream().map((v) -> {
      return (VirtualCheckMO)v.toStubMO();
    }
).collect(Collectors.toList()));
    mo.setNotifications(this.getNotifications().toMO());
  }
}
Program: 37902
Project: 37902
Buggy source:
@Override public GroupMO toMO(boolean stub){
  GroupMO mo=new GroupMO();
  super.toMO(mo,stub);
  mo.setState(this.getState().toMO());
  if (!stub) {
    mo.setChecks(this.getChecks().stream().map(Check::toStubMO).collect(Collectors.toList()));
    mo.setGroups(this.getGroups().stream().map(Group::toStubMO).collect(Collectors.toList()));
    mo.setChildren(this.getChildren().stream().map(Group::toStubMO).collect(Collectors.toList()));
  }
  return mo;
}

Fixed version (ground truth):
@Override public GroupMO toMO(boolean stub){
  GroupMO mo=new GroupMO();
  super.toMO(mo,stub);
  mo.setState(this.getState().toMO());
  if (!stub) {
    mo.setChecks(this.getChecks().stream().map((c) -> {
      return (CheckMO)c.toStubMO();
    }
).collect(Collectors.toList()));
    mo.setGroups(this.getGroups().stream().map(Group::toStubMO).collect(Collectors.toList()));
    mo.setChildren(this.getChildren().stream().map(Group::toStubMO).collect(Collectors.toList()));
  }
  return mo;
}
Program: 37905
Project: 37905
Buggy source:
/** 
 * Enable notifications for soil moisture.
 * @param enable  true to enable, false to disable
 */
public void notifySoilMoisture(boolean enable){
  if (timerTaskNotifySoilMoisture != null) {
    timerTaskNotifySoilMoisture.cancel();
    timerTaskNotifySoilMoisture=null;
    timer.purge();
  }
  if (enable) {
    timerTaskNotifySoilMoisture=new TimerTask(){
      public void run(){
        readSoilMoisture();
      }
    }
;
    timer.schedule(timerTaskNotifySoilMoisture,0,1000);
  }
}

Fixed version (ground truth):
/** 
 * Enable notifications for soil moisture.
 * @param enable  true to enable, false to disable
 */
public void notifySoilMoisture(boolean enable){
  if (timerTaskNotifySoilMoisture != null) {
    timerTaskNotifySoilMoisture.cancel();
    timerTaskNotifySoilMoisture=null;
    timer.purge();
  }
  if (enable && isConnected()) {
    timerTaskNotifySoilMoisture=new TimerTask(){
      public void run(){
        readSoilMoisture();
      }
    }
;
    timer.schedule(timerTaskNotifySoilMoisture,0,1000);
  }
}
Program: 37906
Project: 37906
Buggy source:
/** 
 * Enable notifications for temperature.
 * @param enable  true to enable, false to disable
 */
public void notifyTemperature(boolean enable){
  queue.enqueueNotify(getFlowerPowerService().getCharacteristic(UUID.fromString(FlowerPowerConstants.CHARACTERISTIC_UUID_TEMPERATURE)),enable);
}

Fixed version (ground truth):
/** 
 * Enable notifications for temperature.
 * @param enable  true to enable, false to disable
 */
public void notifyTemperature(boolean enable){
  if (isConnected())   queue.enqueueNotify(getFlowerPowerService().getCharacteristic(UUID.fromString(FlowerPowerConstants.CHARACTERISTIC_UUID_TEMPERATURE)),enable);
}
Program: 37907
Project: 37907
Buggy source:
/** 
 * Enable notifications for battery level.
 * @param enable  true to enable, false to disable
 */
public void notifyBatteryLevel(boolean enable){
  if (timerTaskNotifyBatteryLevel != null) {
    timerTaskNotifyBatteryLevel.cancel();
    timerTaskNotifyBatteryLevel=null;
    timer.purge();
  }
  if (enable) {
    timerTaskNotifyBatteryLevel=new TimerTask(){
      public void run(){
        readBatteryLevel();
      }
    }
;
    timer.schedule(timerTaskNotifyBatteryLevel,0,1000);
  }
}

Fixed version (ground truth):
/** 
 * Enable notifications for battery level.
 * @param enable  true to enable, false to disable
 */
public void notifyBatteryLevel(boolean enable){
  if (timerTaskNotifyBatteryLevel != null) {
    timerTaskNotifyBatteryLevel.cancel();
    timerTaskNotifyBatteryLevel=null;
    timer.purge();
  }
  if (enable && isConnected()) {
    timerTaskNotifyBatteryLevel=new TimerTask(){
      public void run(){
        readBatteryLevel();
      }
    }
;
    timer.schedule(timerTaskNotifyBatteryLevel,0,1000);
  }
}
Program: 37908
Project: 37908
Buggy source:
/** 
 * Enable notifications for sunlight.
 * @param enable  true to enable, false to disable
 */
public void notifySunlight(boolean enable){
  queue.enqueueNotify(getFlowerPowerService().getCharacteristic(UUID.fromString(FlowerPowerConstants.CHARACTERISTIC_UUID_SUNLIGHT)),enable);
}

Fixed version (ground truth):
/** 
 * Enable notifications for sunlight.
 * @param enable  true to enable, false to disable
 */
public void notifySunlight(boolean enable){
  if (isConnected())   queue.enqueueNotify(getFlowerPowerService().getCharacteristic(UUID.fromString(FlowerPowerConstants.CHARACTERISTIC_UUID_SUNLIGHT)),enable);
}
Program: 37909
Project: 37909
Buggy source:
public synchronized void empty(){
  timestamps.clear();
  values.clear();
  lowestValue=-1999;
  highestValue=1999;
}

Fixed version (ground truth):
public synchronized void empty(){
  timestamps.clear();
  values.clear();
  lowestValue=1999;
  highestValue=-1999;
}
Program: 37911
Project: 37911
Buggy source:
public void onClick(View v){
  Log.i(FlowerPowerConstants.TAG,"String_Node_Str" + (checkBox.isChecked() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ serviceManager.isConnected());
  device.notifyTemperature(checkBox.isChecked());
  device.notifySunlight(checkBox.isChecked());
  device.notifySoilMoisture(checkBox.isChecked());
  device.notifyBatteryLevel(checkBox.isChecked());
  serviceManager.enablePersistency(5000,1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str");
}

Fixed version (ground truth):
public void onClick(View v){
  Log.i(FlowerPowerConstants.TAG,"String_Node_Str" + (checkBox.isChecked() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ serviceManager.isConnected());
  device.notifyTemperature(checkBox.isChecked());
  device.notifySunlight(checkBox.isChecked());
  device.notifySoilMoisture(checkBox.isChecked());
  device.notifyBatteryLevel(checkBox.isChecked());
  serviceManager.enablePersistency(5000,1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str");
  serviceManager.enableReconnect(60000);
}
Program: 37912
Project: 37912
Buggy source:
public void deviceConnected(){
  Log.i(FlowerPowerConstants.TAG,"String_Node_Str");
  invalidateOptionsMenu();
  serviceManager.enableAutoConnect(1000 * 60 * 10);
}

Fixed version (ground truth):
public void deviceConnected(){
  Log.i(FlowerPowerConstants.TAG,"String_Node_Str");
  invalidateOptionsMenu();
  serviceManager.enableReconnect(1000 * 60 * 10);
}
Program: 37913
Project: 37913
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.flowerpower_plot);
  Intent intent=getIntent();
  final String deviceName=intent.getStringExtra(FlowerPowerConstants.EXTRAS_DEVICE_NAME);
  getActionBar().setTitle(deviceName);
  FlowerPowerPlotFragment fragment=(FlowerPowerPlotFragment)getFragmentManager().findFragmentById(R.id.frag_temperature);
  fragment.init(PersistencyManager.TIMESERIES_TYPE_TEMPERATURE,"String_Node_Str",1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str",-10,55,Color.RED,Color.WHITE,200,Color.parseColor("String_Node_Str"));
  fragment=(FlowerPowerPlotFragment)getFragmentManager().findFragmentById(R.id.frag_sunlight);
  fragment.init(PersistencyManager.TIMESERIES_TYPE_SUNLIGHT,"String_Node_Str",1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str",0,50,Color.YELLOW,Color.WHITE,200,Color.parseColor("String_Node_Str"));
  fragment=(FlowerPowerPlotFragment)getFragmentManager().findFragmentById(R.id.frag_soilmoisture);
  fragment.init(PersistencyManager.TIMESERIES_TYPE_SOILMOISTURE,"String_Node_Str",1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str",0,60,Color.GREEN,Color.WHITE,200,Color.parseColor("String_Node_Str"));
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.flowerpower_plot);
  Intent intent=getIntent();
  final String deviceName=intent.getStringExtra(FlowerPowerConstants.EXTRAS_DEVICE_NAME);
  getActionBar().setTitle(deviceName);
  FlowerPowerPlotFragment fragment=(FlowerPowerPlotFragment)getFragmentManager().findFragmentById(R.id.frag_temperature);
  fragment.init(PersistencyManager.TIMESERIES_TYPE_TEMPERATURE,"String_Node_Str",1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str",Color.RED,Color.WHITE,200,Color.parseColor("String_Node_Str"));
  fragment=(FlowerPowerPlotFragment)getFragmentManager().findFragmentById(R.id.frag_sunlight);
  fragment.init(PersistencyManager.TIMESERIES_TYPE_SUNLIGHT,"String_Node_Str",1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str",Color.YELLOW,Color.WHITE,200,Color.parseColor("String_Node_Str"));
  fragment=(FlowerPowerPlotFragment)getFragmentManager().findFragmentById(R.id.frag_soilmoisture);
  fragment.init(PersistencyManager.TIMESERIES_TYPE_SOILMOISTURE,"String_Node_Str",1000,FlowerPowerConstants.PERSISTENCY_STORAGE_LOCATION_INTERNAL,"String_Node_Str",Color.GREEN,Color.WHITE,200,Color.parseColor("String_Node_Str"));
}
Program: 37915
Project: 37915
Buggy source:
public void dataAvailable(FlowerPower fp){
  try {
    if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_TEMPERATURE))     timeSeries.addMeasurement(fp.getTemperatureTimestamp(),(float)fp.getTemperature());
 else     if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_SUNLIGHT))     timeSeries.addMeasurement(fp.getSunlightTimestamp(),(float)fp.getSunlight());
 else     if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_SOILMOISTURE))     timeSeries.addMeasurement(fp.getSoilMoistureTimestamp(),(float)fp.getSoilMoisture());
 else     if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_BATTERY))     timeSeries.addMeasurement(fp.getBatteryLevelTimestamp(),(float)fp.getBatteryLevelTimestamp());
 else     Log.w(FlowerPowerConstants.TAG,"String_Node_Str" + seriesType + "String_Node_Str");
    plot.redraw();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void dataAvailable(FlowerPower fp){
  float oldLowest=timeSeries.getLowestValue();
  float oldHighest=timeSeries.getHighestValue();
  try {
    if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_TEMPERATURE)) {
      if (fp.getTemperature() != -1)       timeSeries.addMeasurement(fp.getTemperatureTimestamp(),(float)fp.getTemperature());
    }
 else     if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_SUNLIGHT)) {
      if (fp.getSunlight() >= 0)       timeSeries.addMeasurement(fp.getSunlightTimestamp(),(float)fp.getSunlight());
    }
 else     if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_SOILMOISTURE)) {
      if (fp.getSoilMoisture() >= 0)       timeSeries.addMeasurement(fp.getSoilMoistureTimestamp(),(float)fp.getSoilMoisture());
    }
 else     if (seriesType.equals(PersistencyManager.TIMESERIES_TYPE_BATTERY)) {
      if (fp.getBatteryLevel() >= 0)       timeSeries.addMeasurement(fp.getBatteryLevelTimestamp(),(float)fp.getBatteryLevelTimestamp());
    }
 else     Log.w(FlowerPowerConstants.TAG,"String_Node_Str" + seriesType + "String_Node_Str");
    if ((timeSeries.getLowestValue() != oldLowest) || (timeSeries.getHighestValue() != oldHighest))     plot.setRangeBoundaries(timeSeries.getLowestValue() - (timeSeries.getLowestValue() / 10),timeSeries.getHighestValue() + (timeSeries.getHighestValue() / 10),BoundaryMode.FIXED);
    plot.redraw();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 37917
Project: 37917
Buggy source:
public StringBuffer format(Object obj,StringBuffer toAppendTo,FieldPosition pos){
  long timestamp=((Number)obj).longValue();
  Date date=new Date(timestamp);
  return formatHour.format(date,toAppendTo,pos);
}

Fixed version (ground truth):
public StringBuffer format(Object obj,StringBuffer toAppendTo,FieldPosition pos){
  long timestamp=((Number)obj).longValue();
  Date date=new Date(timestamp);
  return format.format(date,toAppendTo,pos);
}
Program: 37918
Project: 37918
Buggy source:
public synchronized void addDataSet(FlowerPower fp,String seriesId) throws Exception {
  if ((fp.getBatteryLevelTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_BATTERY,seriesId)) {
    seriesToBePersisted.get(TIMESERIES_TYPE_BATTERY + "String_Node_Str" + seriesId).addMeasurement(fp.getBatteryLevelTimestamp(),(float)fp.getBatteryLevel());
  }
  if ((fp.getTemperatureTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_TEMPERATURE,seriesId)) {
    seriesToBePersisted.get(TIMESERIES_TYPE_TEMPERATURE + "String_Node_Str" + seriesId).addMeasurement(fp.getTemperatureTimestamp(),(float)fp.getTemperature());
  }
  if ((fp.getSunlightTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_SUNLIGHT,seriesId)) {
    seriesToBePersisted.get(TIMESERIES_TYPE_SUNLIGHT + "String_Node_Str" + seriesId).addMeasurement(fp.getSunlightTimestamp(),(float)fp.getSunlight());
  }
  if ((fp.getSoilMoistureTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_SOILMOISTURE,seriesId)) {
    seriesToBePersisted.get(TIMESERIES_TYPE_SOILMOISTURE + "String_Node_Str" + seriesId).addMeasurement(fp.getSoilMoistureTimestamp(),(float)fp.getSoilMoisture());
  }
}

Fixed version (ground truth):
public synchronized void addDataSet(FlowerPower fp,String seriesId) throws Exception {
  if ((fp.getBatteryLevelTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_BATTERY,seriesId)) {
    if (fp.getBatteryLevel() >= 0)     seriesToBePersisted.get(TIMESERIES_TYPE_BATTERY + "String_Node_Str" + seriesId).addMeasurement(fp.getBatteryLevelTimestamp(),(float)fp.getBatteryLevel());
  }
  if ((fp.getTemperatureTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_TEMPERATURE,seriesId)) {
    if (fp.getTemperature() != -1)     seriesToBePersisted.get(TIMESERIES_TYPE_TEMPERATURE + "String_Node_Str" + seriesId).addMeasurement(fp.getTemperatureTimestamp(),(float)fp.getTemperature());
  }
  if ((fp.getSunlightTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_SUNLIGHT,seriesId)) {
    if (fp.getSunlight() >= 0)     seriesToBePersisted.get(TIMESERIES_TYPE_SUNLIGHT + "String_Node_Str" + seriesId).addMeasurement(fp.getSunlightTimestamp(),(float)fp.getSunlight());
  }
  if ((fp.getSoilMoistureTimestamp() > 0) && isEnabled(TIMESERIES_TYPE_SOILMOISTURE,seriesId)) {
    if (fp.getSoilMoisture() >= 0)     seriesToBePersisted.get(TIMESERIES_TYPE_SOILMOISTURE + "String_Node_Str" + seriesId).addMeasurement(fp.getSoilMoistureTimestamp(),(float)fp.getSoilMoisture());
  }
}
Program: 37919
Project: 37919
Buggy source:
public void enableReconnect(long period){
  timerReconnect=new Timer();
  timerTaskReconnect=new TimerTask(){
    public void run(){
      if (!isConnected()) {
        Log.i(FlowerPowerConstants.TAG,"String_Node_Str");
        connect(bluetoothDeviceAddress);
        timerReconnect.schedule(new TimerTask(){
          public void run(){
            Log.d(FlowerPowerConstants.TAG,"String_Node_Str");
            if (notifyBatteryLevel)             notifyBatteryLevel(true);
            if (notifyTemperature)             notifyTemperature(true);
            if (notifySoilMoisture)             notifySoilMoisture(true);
            if (notifySunlight)             notifySunlight(true);
          }
        }
,10000);
      }
    }
  }
;
  timerReconnect.schedule(timerTaskReconnect,period,period);
}

Fixed version (ground truth):
/** 
 * Enables reconnect. If the bluetooth device is out of reach, then an automatic reconnect is tried periodically
 * @param period  Period in ms.
 */
public void enableReconnect(final long period){
  timerReconnect=new Timer();
  timerTaskReconnect=new TimerTask(){
    public void run(){
      if (!isConnected()) {
        Log.i(FlowerPowerConstants.TAG,"String_Node_Str");
        connect(bluetoothDeviceAddress);
        timerReconnect.schedule(new TimerTask(){
          public void run(){
            Log.d(FlowerPowerConstants.TAG,"String_Node_Str");
            if (notifyBatteryLevel)             notifyBatteryLevel(true);
            if (notifyTemperature)             notifyTemperature(true);
            if (notifySoilMoisture)             notifySoilMoisture(true);
            if (notifySunlight)             notifySunlight(true);
          }
        }
,period);
      }
    }
  }
;
  timerReconnect.schedule(timerTaskReconnect,period,period);
}
Program: 37920
Project: 37920
Buggy source:
public synchronized void enqueueNotify(BluetoothGattCharacteristic chara,boolean enable){
  QueueJob job=new QueueJob(chara,QueueJob.JOB_TYPE_NOTIFY,enable);
  if (!isContained(job))   queue.offer(job);
  if (queue.size() == 1)   service.notify(chara,enable);
}

Fixed version (ground truth):
public synchronized void enqueueNotify(BluetoothGattCharacteristic chara,boolean enable){
  Log.d(FlowerPowerConstants.TAG,"String_Node_Str" + queue.size() + "String_Node_Str"+ chara+ "String_Node_Str");
  QueueJob job=new QueueJob(chara,QueueJob.JOB_TYPE_NOTIFY,enable);
  if (!isContained(job))   queue.offer(job);
  if (queue.size() == 1)   service.notify(chara,enable);
}
Program: 37921
Project: 37921
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  QueueJob other=(QueueJob)obj;
  if (!getOuterType().equals(other.getOuterType()))   return false;
  if (chara == null) {
    if (other.chara != null)     return false;
  }
 else   if (!chara.equals(other.chara))   return false;
  if (enable != other.enable)   return false;
  if (jobType != other.jobType)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  QueueJob other=(QueueJob)obj;
  if (!getOuterType().equals(other.getOuterType()))   return false;
  if (chara == null) {
    if (other.chara != null)     return false;
  }
 else   if (!chara.getUuid().equals(other.chara.getUuid()))   return false;
  if (enable != other.enable)   return false;
  if (jobType != other.jobType)   return false;
  return true;
}
Program: 37922
Project: 37922
Buggy source:
/** 
 * Get some content stored on the JSocialKademliaDHT
 * @param param The parameters used to search for the content
 * @return DHTContent The content
 * @throws java.io.IOException
 * @throws kademlia.exceptions.ContentNotFoundException
 */
@Override public JSocialKademliaStorageEntry get(GetParameter param) throws NoSuchElementException, IOException, ContentNotFoundException {
  if (this.dht.contains(param)) {
    JSocialKademliaStorageEntry e=this.dht.get(param);
    if (e.getContentMetadata().isKNode()) {
      return this.decompressStorageEntry(e);
    }
 else     if (e.getContentMetadata().isCached()) {
      GetParameterFUC gpf=new GetParameterFUC(e.getContentMetadata());
      try {
        return this.decompressStorageEntry(this.getUpdated(gpf));
      }
 catch (      UpToDateContentException ex) {
        return this.decompressStorageEntry(e);
      }
    }
 else {
      return this.decompressStorageEntry(e);
    }
  }
  long startTime=System.nanoTime();
  ContentLookupOperation clo=new ContentLookupOperation(server,this,param,this.config);
  clo.execute();
  long endTime=System.nanoTime();
  this.statistician.addContentLookup(endTime - startTime,clo.routeLength(),clo.isContentFound());
  return this.decompressStorageEntry(clo.getContentFound());
}

Fixed version (ground truth):
/** 
 * Get some content stored on the JSocialKademliaDHT
 * @param param The parameters used to search for the content
 * @return DHTContent The content
 * @throws java.io.IOException
 * @throws kademlia.exceptions.ContentNotFoundException
 */
@Override public JSocialKademliaStorageEntry get(GetParameter param) throws NoSuchElementException, IOException, ContentNotFoundException {
  if (this.dht.contains(param)) {
    JSocialKademliaStorageEntry e=this.dht.get(param);
    if (e.getContentMetadata().isCached()) {
      GetParameterFUC gpf=new GetParameterFUC(e.getContentMetadata());
      try {
        return this.decompressStorageEntry(this.getUpdated(gpf));
      }
 catch (      UpToDateContentException ex) {
        return this.decompressStorageEntry(e);
      }
    }
 else     if (e.getContentMetadata().isKNode()) {
      return this.decompressStorageEntry(e);
    }
 else {
      return this.decompressStorageEntry(e);
    }
  }
  long startTime=System.nanoTime();
  ContentLookupOperation clo=new ContentLookupOperation(server,this,param,this.config);
  clo.execute();
  long endTime=System.nanoTime();
  this.statistician.addContentLookup(endTime - startTime,clo.routeLength(),clo.isContentFound());
  return this.decompressStorageEntry(clo.getContentFound());
}
Program: 37923
Project: 37923
Buggy source:
@Override public void remove(SocialKademliaStorageEntryMetadata entry) throws ContentNotFoundException {
  if (this.contentManager.get(entry).isCached()) {
    this.contentManager.get(entry).setKNode(false);
    return;
  }
  String folder=this.getContentStorageFolderName(entry.getKey());
  File file=new File(folder + File.separator + entry.hashCode()+ "String_Node_Str");
  contentManager.remove(entry);
  if (file.exists()) {
    file.delete();
  }
 else {
    throw new ContentNotFoundException();
  }
}

Fixed version (ground truth):
@Override public void remove(SocialKademliaStorageEntryMetadata entry) throws ContentNotFoundException {
  if (this.contentManager.get(entry).isCached()) {
    this.contentManager.get(entry).setKNode(false);
    return;
  }
  this.absoluteRemove(entry);
}
Program: 37924
Project: 37924
Buggy source:
/** 
 * @return List A List of all Nodes in this RoutingTable
 */
@Override public final List getAllNodes(){
  List<Node> nodes=new ArrayList<>();
  for (  KadBucket b : this.buckets) {
    for (    Contact c : b.getContacts()) {
      nodes.add(c.getNode());
    }
  }
  return nodes;
}

Fixed version (ground truth):
/** 
 * @return List A List of all Nodes in this RoutingTable
 */
@Override public synchronized final List getAllNodes(){
  List<Node> nodes=new ArrayList<>();
  for (  KadBucket b : this.buckets) {
    for (    Contact c : b.getContacts()) {
      nodes.add(c.getNode());
    }
  }
  return nodes;
}
Program: 37925
Project: 37925
Buggy source:
/** 
 * Update a content; the operation is only done iff we already have a copy of the content here
 */
public void update(StorageEntry newContent){
  if (this.contentManager.contains(newContent.getContentMetadata())) {
    this.store(newContent);
  }
 else {
    throw new NoSuchElementException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Update a content; the operation is only done iff we already have a copy of the content here
 */
public void update(StorageEntry newContent) throws IOException {
  if (this.contentManager.contains(newContent.getContentMetadata())) {
    this.store(newContent);
  }
 else {
    throw new NoSuchElementException("String_Node_Str");
  }
}
Program: 37927
Project: 37927
Buggy source:
private void call(final UDPCallback callback,final Object... args){
  loop.callbackHandler.handleUDPCallback(onRecv,args);
}

Fixed version (ground truth):
private void call(final UDPCallback callback,final Object... args){
  loop.callbackHandler.handleUDPCallback(callback,args);
}
Program: 37928
Project: 37928
Buggy source:
public static void main(final String[] args) throws Exception {
  final CheckHandleTest test=new CheckHandleTest();
  test.testCheck();
}

Fixed version (ground truth):
public static void main(final String[] args) throws Exception {
  final IdleHandleTest test=new IdleHandleTest();
  test.testIdle();
}
Program: 37929
Project: 37929
Buggy source:
/** 
 * Contains the main event loop that drives the game. This method will not  return until   {@link LanternaFrontend#shutdown} is called.
 */
final void doStartup(){
  Vec2i screenSize=getSize();
  System.out.print("String_Node_Str" + screenSize.y + "String_Node_Str"+ screenSize.x+ "String_Node_Str");
  Screen screen=TerminalFacade.createScreen();
  screen.startScreen();
{
    TerminalSize size=screen.getTerminalSize();
    onResize(new Vec2i(size.getColumns(),size.getRows()));
  }
  long time=new Date().getTime();
  while (running) {
    try {
      if (screen.resizePending()) {
        screen.refresh();
        TerminalSize size=screen.getTerminalSize();
        onResize(new Vec2i(size.getColumns(),size.getRows()));
      }
      screen.clear();
      onDraw(new Section(screen,new Vec2i(0,0),screenSize));
      screen.refresh();
      Key key=screen.readInput();
      if (key != null)       onKeyPressed(key);
      long currentTime=new Date().getTime();
      onTick(currentTime - time);
      time=currentTime;
    }
 catch (    Exception e) {
    }
  }
  screen.stopScreen();
}

Fixed version (ground truth):
/** 
 * Contains the main event loop that drives the game. This method will not  return until   {@link LanternaFrontend#shutdown} is called.
 */
final void doStartup(){
  Vec2i screenSize=getSize();
  if (isTTY)   System.out.print("String_Node_Str" + screenSize.y + "String_Node_Str"+ screenSize.x+ "String_Node_Str");
  Screen screen=TerminalFacade.createScreen();
  screen.startScreen();
{
    TerminalSize size=screen.getTerminalSize();
    onResize(new Vec2i(size.getColumns(),size.getRows()));
  }
  long time=new Date().getTime();
  while (running) {
    try {
      if (screen.resizePending()) {
        screen.refresh();
        TerminalSize size=screen.getTerminalSize();
        onResize(new Vec2i(size.getColumns(),size.getRows()));
      }
      screen.clear();
      onDraw(new Section(screen,new Vec2i(0,0),screenSize));
      screen.refresh();
      Key key=screen.readInput();
      if (key != null)       onKeyPressed(key);
      long currentTime=new Date().getTime();
      onTick(currentTime - time);
      time=currentTime;
    }
 catch (    NullPointerException e) {
    }
  }
  screen.stopScreen();
}
Program: 37930
Project: 37930
Buggy source:
@Override public Vec2i getSize(){
  return new Vec2i(80,30);
}

Fixed version (ground truth):
@Override public Vec2i getSize(){
  return new Vec2i(100,30);
}
Program: 37931
Project: 37931
Buggy source:
public GUIApp(Arguments args){
  super("String_Node_Str");
  configDir=args.getConfig();
}

Fixed version (ground truth):
public GUIApp(Arguments args){
  super("String_Node_Str");
  configDir=args.getConfig();
  isTTY=args.getTty();
  if (isTTY)   System.setProperty("String_Node_Str","String_Node_Str");
}
Program: 37932
Project: 37932
Buggy source:
int getRandom(int min,int max){
  return min + getRandom(max - min + 1);
}

Fixed version (ground truth):
public int getRandom(int min,int max){
  return min + getRandom(max - min + 1);
}
Program: 37933
Project: 37933
Buggy source:
private Action getAction(){
  Level l=me.getLevel();
  List<EntityActionManager> players=l.getManager().getEntity("String_Node_Str");
  if (players.size() == 0) {
    return new Move(0,me,Direction.RIGHT);
  }
  EntityActionManager player=players.get(0);
  Tile myTile=me.getLocation();
  Tile playerTile=player.getEntity().getLocation();
  AStar<Tile> pathfinder=new AStar<Tile>();
  List<Tile> path=pathfinder.computePath(myTile,playerTile);
  if (path.size() <= 1)   return new Wait();
  Tile dest=path.get(1);
  Vec2i curLoc=myTile.getLocation();
  Vec2i destLoc=dest.getLocation();
  Direction dir;
  if (destLoc.x < curLoc.x)   dir=Direction.LEFT;
 else   if (destLoc.x > curLoc.x)   dir=Direction.RIGHT;
 else   if (destLoc.y < curLoc.y)   dir=Direction.UP;
 else   dir=Direction.DOWN;
  return new Move(moveCost,me,dir);
}

Fixed version (ground truth):
private Action getAction(){
  Level l=me.getLevel();
  List<EntityActionManager> players=l.getManager().getEntity("String_Node_Str");
  if (players.size() == 0) {
    return new Move(100,me,Direction.RIGHT);
  }
  EntityActionManager player=players.get(0);
  Tile myTile=me.getLocation();
  Tile playerTile=player.getEntity().getLocation();
  AStar<Tile> pathfinder=new AStar<Tile>();
  List<Tile> path=pathfinder.computePath(myTile,playerTile);
  if (path.size() <= 1)   return new Wait();
  Tile dest=path.get(1);
  Vec2i curLoc=myTile.getLocation();
  Vec2i destLoc=dest.getLocation();
  Direction dir;
  if (destLoc.x < curLoc.x)   dir=Direction.LEFT;
 else   if (destLoc.x > curLoc.x)   dir=Direction.RIGHT;
 else   if (destLoc.y < curLoc.y)   dir=Direction.UP;
 else   dir=Direction.DOWN;
  return new Move(moveCost,me,dir);
}
Program: 37934
Project: 37934
Buggy source:
@Override public boolean isReady(MonsterInput i){
  Level l=i.getLevel();
  EntityActionManager player=l.getManager().getEntity("String_Node_Str").get(0);
  Space mySpace=me.getLocation().getSpace();
  Space playerSpace=player.getEntity().getLocation().getSpace();
  return (mySpace.equals(playerSpace));
}

Fixed version (ground truth):
@Override public boolean isReady(MonsterInput i){
  Level l=i.getLevel();
  List<EntityActionManager> players=l.getManager().getEntity("String_Node_Str");
  if (players.size() == 0) {
    return false;
  }
  EntityActionManager player=players.get(0);
  Space mySpace=me.getLocation().getSpace();
  Space playerSpace=player.getEntity().getLocation().getSpace();
  return (mySpace.equals(playerSpace));
}
Program: 37935
Project: 37935
Buggy source:
private void drawStats(ScreenWriter sw){
  Level currentLevel=game.getCurrentLevel();
  String divider="String_Node_Str";
  for (int i=0; i < size.x; i++) {
    divider+='_';
  }
  sw.drawString(0,ANNOUNCE_OFFSET + MAP_SIZE.y,divider);
  int statStart=ANNOUNCE_OFFSET + MAP_SIZE.y + 1;
  List<EntityActionManager> monsters=currentLevel.getManager().getEntity("String_Node_Str");
  List<EntityActionManager> main=currentLevel.getManager().getEntity("String_Node_Str");
  if (monsters.isEmpty()) {
    sw.drawString(0,statStart,"String_Node_Str");
    return;
  }
 else   if (main.isEmpty()) {
    sw.drawString(0,statStart,"String_Node_Str");
    return;
  }
  MainCharacter player=(MainCharacter)main.get(0).getEntity();
  String line1="String_Node_Str";
  line1+="String_Node_Str";
  line1+="String_Node_Str";
  line1+=player.getHP();
  line1+="String_Node_Str";
  line1+=player.getStartHP();
  line1+="String_Node_Str";
  line1+=player.getXP();
  line1+="String_Node_Str";
  line1+=player.getNextLevelXP();
  line1+="String_Node_Str";
  sw.drawString(0,statStart,line1);
  String depthString="String_Node_Str" + currentLevel.getDepth();
  sw.drawString(size.x - depthString.length() - 2,statStart,depthString);
  String line2="String_Node_Str";
  line2="String_Node_Str" + player.getPlayerLevel();
  line2+="String_Node_Str";
  line2+=player.getStats().getAttack();
  line2+="String_Node_Str";
  line2+=String.valueOf(player.getStats().getDefense());
  line2+="String_Node_Str";
  sw.drawString(0,statStart + 1,line2);
}

Fixed version (ground truth):
private void drawStats(ScreenWriter sw){
  Level currentLevel=game.getCurrentLevel();
  String divider="String_Node_Str";
  for (int i=0; i < size.x; i++) {
    divider+='_';
  }
  sw.drawString(0,ANNOUNCE_OFFSET + MAP_SIZE.y,divider);
  int statStart=ANNOUNCE_OFFSET + MAP_SIZE.y + 1;
  List<EntityActionManager> main=currentLevel.getManager().getEntity("String_Node_Str");
  if (main.size() == 0) {
    sw.drawString(0,statStart,"String_Node_Str");
    return;
  }
  MainCharacter player=(MainCharacter)main.get(0).getEntity();
  String line1="String_Node_Str";
  line1+="String_Node_Str";
  line1+="String_Node_Str";
  line1+=player.getHP();
  line1+="String_Node_Str";
  line1+=player.getStartHP();
  line1+="String_Node_Str";
  line1+=player.getXP();
  line1+="String_Node_Str";
  line1+=player.getNextLevelXP();
  line1+="String_Node_Str";
  sw.drawString(0,statStart,line1);
  String depthString="String_Node_Str" + currentLevel.getDepth();
  sw.drawString(size.x - depthString.length() - 2,statStart,depthString);
  String line2="String_Node_Str";
  line2="String_Node_Str" + player.getPlayerLevel();
  line2+="String_Node_Str";
  line2+=player.getStats().getAttack();
  line2+="String_Node_Str";
  line2+=String.valueOf(player.getStats().getDefense());
  line2+="String_Node_Str";
  sw.drawString(0,statStart + 1,line2);
}
Program: 37936
Project: 37936
Buggy source:
/** 
 * Saves the current level, obliterating anything that was already there
 * @throws SaveLoadException
 */
public void saveLevel(Level l) throws SaveLoadException {
  try {
    FileOutputStream fos=new FileOutputStream(this.saveFile);
    ObjectOutputStream oos=new ObjectOutputStream(fos);
    oos.writeObject(l);
    oos.close();
  }
 catch (  Exception e) {
    throw new SaveLoadException(e);
  }
}

Fixed version (ground truth):
/** 
 * Saves the current level, obliterating anything that was already there
 * @throws SaveLoadException
 */
public void saveLevel(Level l) throws SaveLoadException {
  try {
    FileOutputStream fos=new FileOutputStream(this.saveFile);
    ObjectOutputStream oos=new ObjectOutputStream(fos);
    oos.writeObject(l);
    fos.close();
    oos.close();
  }
 catch (  Exception e) {
    throw new SaveLoadException(e);
  }
}
Program: 37939
Project: 37939
Buggy source:
@Override public GameAction getActionForKey(Key k){
switch (k.getKind()) {
case NormalKey:
{
switch (k.getCharacter()) {
case 'N':
        return new GameAction(1,1);
case 'S':
      return new GameAction(1,2);
case 'Q':
    return new GameAction(1,4);
case 'h':
  return new GameAction(1,5);
case 'j':
return new GameAction(1,7);
case 'k':
return new GameAction(1,6);
case 'l':
return new GameAction(1,8);
case 'i':
return new GameAction(1,9);
case 'q':
return new GameAction(1,10);
case 'w':
return new GameAction(1,11);
case 'o':
return new GameAction(1,12);
case '<':
return new GameAction(1,13);
case '>':
return new GameAction(1,14);
case 'd':
return new GameAction(1,15);
default :
return new GameAction(1,0);
}
}
case ArrowLeft:
return new GameAction(1,5);
case ArrowUp:
return new GameAction(1,6);
case ArrowDown:
return new GameAction(1,7);
case ArrowRight:
return new GameAction(1,8);
default :
return new GameAction(1,0);
}
}

Fixed version (ground truth):
@Override public GameAction getActionForKey(Key k){
switch (k.getKind()) {
case NormalKey:
{
switch (k.getCharacter()) {
case 'N':
        return new GameAction(1,1);
case 'S':
      return new GameAction(1,2);
case 'Q':
    return new GameAction(1,4);
case 'h':
  return new GameAction(1,5);
case 'j':
return new GameAction(1,7);
case 'k':
return new GameAction(1,6);
case 'l':
return new GameAction(1,8);
case 'i':
return new GameAction(1,9);
case 'q':
return new GameAction(1,10);
case 'w':
return new GameAction(1,11);
case 'o':
return new GameAction(1,12);
case '<':
return new GameAction(1,13);
case '>':
return new GameAction(1,14);
case 'd':
return new GameAction(1,15);
case '?':
return new GameAction(1,16);
default :
return new GameAction(1,0);
}
}
case ArrowLeft:
return new GameAction(1,5);
case ArrowUp:
return new GameAction(1,6);
case ArrowDown:
return new GameAction(1,7);
case ArrowRight:
return new GameAction(1,8);
default :
return new GameAction(1,0);
}
}