nus-yam/ex-repair huggingface dataset:
Program: 72297
Project: 72297
Buggy source:
@Override public void onMethodCall(MethodCall call,Result result){
switch (call.method) {
case SCHEDULE_NOTIFICATION_METHOD_NAME:
    if (call.arguments != null && call.arguments instanceof List) {
      AlarmScheduler.scheduleNotification((List<Object>)call.arguments,getActiveContext());
    }
  break;
case UNSCHEDULE_NOTIFICATION_METHOD_NAME:
AlarmScheduler.unscheduleNotifications(getActiveContext());
break;
case SET_NOTIFICATION_ICON_METHOD_NAME:
if (call.arguments != null && call.arguments instanceof List) {
setNotificationIcon((List<Object>)call.arguments);
}
break;
default :
result.notImplemented();
}
}

Fixed version (ground truth):
@Override public void onMethodCall(MethodCall call,Result result){
  AlarmScheduler.initialize(getActiveContext());
switch (call.method) {
case SCHEDULE_NOTIFICATION_METHOD_NAME:
    if (call.arguments != null && call.arguments instanceof List) {
      AlarmScheduler.scheduleNotification((List<Object>)call.arguments,getActiveContext());
    }
  break;
case UNSCHEDULE_NOTIFICATION_METHOD_NAME:
AlarmScheduler.unscheduleNotifications(getActiveContext());
break;
case SET_NOTIFICATION_ICON_METHOD_NAME:
if (call.arguments != null && call.arguments instanceof List) {
setNotificationIcon((List<Object>)call.arguments);
}
break;
default :
result.notImplemented();
}
}
Program: 72298
Project: 72298
Buggy source:
/** 
 * Clear the preferences.
 * @param context The context.
 */
public static void clear(Context context){
  SharedPreferences.Editor editor=getPreferences(context).edit();
  editor.clear();
  editor.apply();
}

Fixed version (ground truth):
/** 
 * Clear the preferences.
 * @param context The context.
 */
public static void clear(Context context){
  SharedPreferences.Editor editor=getPreferences(context).edit();
  int icon=getIcon(context);
  editor.clear();
  editor.putInt(ICON_KEY,icon);
  editor.apply();
}
Program: 72299
Project: 72299
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals("String_Node_Str")) {
    AlarmScheduler.rescheduleNotifications(context);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals("String_Node_Str")) {
    AlarmScheduler.initialize(context);
    AlarmScheduler.rescheduleNotifications(context);
  }
}
Program: 72300
Project: 72300
Buggy source:
/** 
 * Schedule a notification.
 * @param title Notification title.
 * @param date Date to schedule.
 * @param repeatAt Days to repeat the alarm.
 * @param context The context.
 */
private static void scheduleNotification(String title,Date date,List<Integer> repeatAt,Context context){
  sAlarmManager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  if (repeatAt.size() > 0) {
    scheduleRepeatNotification(date,title,repeatAt,context);
  }
 else {
    scheduleOneShotNotification(date,title,context);
  }
}

Fixed version (ground truth):
/** 
 * Schedule a notification.
 * @param title Notification title.
 * @param date Date to schedule.
 * @param repeatAt Days to repeat the alarm.
 * @param context The context.
 */
private static void scheduleNotification(String title,Date date,List<Integer> repeatAt,Context context){
  if (repeatAt.size() > 0) {
    scheduleRepeatNotification(date,title,repeatAt,context);
  }
 else {
    scheduleOneShotNotification(date,title,context);
  }
}
Program: 72301
Project: 72301
Buggy source:
/** 
 * Schedule one shot notification.
 * @param when Date to schedule.
 * @param title Notification title.
 */
private void scheduleOneShotNotification(Date when,String title){
  if (when != null) {
    Date now=new Date();
    Date scheduleDate;
    if (when.getTime() > now.getTime()) {
      scheduleDate=when;
    }
 else {
      Calendar calendar=Calendar.getInstance();
      calendar.setTime(when);
      calendar.add(Calendar.DATE,1);
      scheduleDate=calendar.getTime();
    }
    Log.i(LOG_TAG,"String_Node_Str" + scheduleDate);
    mAlarmManager.set(AlarmManager.RTC_WAKEUP,scheduleDate.getTime(),getNotificationIntent(title));
  }
}

Fixed version (ground truth):
/** 
 * Schedule one shot notification.
 * @param when Date to schedule.
 * @param title Notification title.
 */
private void scheduleOneShotNotification(Date when,String title){
  if (when != null) {
    Date now=new Date();
    Date scheduleDate;
    if (when.getTime() > now.getTime()) {
      scheduleDate=when;
    }
 else {
      Calendar calendar=Calendar.getInstance();
      calendar.setTime(when);
      calendar.add(Calendar.DATE,1);
      scheduleDate=calendar.getTime();
    }
    Log.i(LOG_TAG,"String_Node_Str" + scheduleDate);
    mAlarmManager.set(AlarmManager.RTC_WAKEUP,scheduleDate.getTime(),getNotificationIntent(title,0));
  }
}
Program: 72302
Project: 72302
Buggy source:
/** 
 * Get the notification intent.
 * @param title Notification title
 * @return Notification Intent.
 */
private PendingIntent getNotificationIntent(String title){
  Intent intent=new Intent(getActiveContext(),AlarmReceiver.class);
  intent.putExtra(IntentConstants.TITLE_PARAM,title);
  return PendingIntent.getBroadcast(getActiveContext(),0,intent,0);
}

Fixed version (ground truth):
/** 
 * Get the notification intent.
 * @param title Notification title
 * @param requestCode Notification request code.
 * @return Notification Intent.
 */
private PendingIntent getNotificationIntent(String title,int requestCode){
  Intent intent=new Intent(getActiveContext(),AlarmReceiver.class);
  intent.putExtra(IntentConstants.TITLE_PARAM,title);
  return PendingIntent.getBroadcast(getActiveContext(),requestCode,intent,0);
}
Program: 72303
Project: 72303
Buggy source:
/** 
 * Unschedule notifications.
 */
private void unscheduleNotifications(){
  Log.i(LOG_TAG,"String_Node_Str");
  Intent intent=new Intent(getActiveContext(),AlarmReceiver.class);
  PendingIntent pendingIntent=PendingIntent.getBroadcast(getActiveContext(),0,intent,0);
  pendingIntent.cancel();
  mAlarmManager.cancel(pendingIntent);
}

Fixed version (ground truth):
/** 
 * Unschedule notifications.
 */
private void unscheduleNotifications(){
  Log.i(LOG_TAG,"String_Node_Str");
  for (int day=0; day <= 7; day++) {
    Intent intent=new Intent(getActiveContext(),AlarmReceiver.class);
    PendingIntent pendingIntent=PendingIntent.getBroadcast(getActiveContext(),day,intent,0);
    pendingIntent.cancel();
    mAlarmManager.cancel(pendingIntent);
  }
}
Program: 72304
Project: 72304
Buggy source:
/** 
 * Schedule repeat notification.
 * @param when Date to schedule.
 * @param title Notification title.
 * @param repeatAt Days to repeat notification.
 */
private void scheduleRepeatNotification(Date when,String title,List<Integer> repeatAt){
  Calendar calendar=Calendar.getInstance();
  PendingIntent notificationIntent=getNotificationIntent(title);
  for (  int day : repeatAt) {
    calendar.setTime(when);
    calendar.set(Calendar.SECOND,0);
    calendar.set(Calendar.DAY_OF_WEEK,day + 1);
    Date scheduleDate=calendar.getTime();
    Log.i(LOG_TAG,"String_Node_Str" + scheduleDate);
    mAlarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,scheduleDate.getTime(),AlarmManager.INTERVAL_DAY * 7,notificationIntent);
  }
}

Fixed version (ground truth):
/** 
 * Schedule repeat notification.
 * @param when Date to schedule.
 * @param title Notification title.
 * @param repeatAt Days to repeat notification.
 */
private void scheduleRepeatNotification(Date when,String title,List<Integer> repeatAt){
  Calendar calendar=Calendar.getInstance();
  for (  int day : repeatAt) {
    calendar.setTime(when);
    calendar.set(Calendar.SECOND,0);
    calendar.set(Calendar.DAY_OF_WEEK,day + 1);
    Date scheduleDate=calendar.getTime();
    Log.i(LOG_TAG,"String_Node_Str" + scheduleDate);
    mAlarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,scheduleDate.getTime(),AlarmManager.INTERVAL_DAY * 7,getNotificationIntent(title,day));
  }
}
Program: 72306
Project: 72306
Buggy source:
public void registerClientSession(String name,ClientSession clientSession){
  List<ClientSession> sessions=this.getContextNameSessionMap().getOrDefault(name,new LinkedList<>());
  if (!sessions.contains(clientSession)) {
    sessions.add(clientSession);
  }
  this.getContextNameSessionMap().putIfAbsent(name,sessions);
}

Fixed version (ground truth):
public void registerClientSession(String contextName,String clientName,ClientSession clientSession){
  HashMap<String,ClientSession> clientSessionMap=this.getContextNameSessionMap().getOrDefault(contextName,new HashMap<>());
  if (clientSessionMap.containsKey(clientName)) {
    ClientSession oldSession=clientSessionMap.replace(clientName,clientSession);
    oldSession.close();
  }
 else {
    clientSessionMap.putIfAbsent(clientName,clientSession);
  }
  this.getContextNameSessionMap().putIfAbsent(contextName,clientSessionMap);
}
Program: 72307
Project: 72307
Buggy source:
@Override public ClientSession getAvailableSession(String contextName){
  if (!this.getContextNameSessionMap().containsKey(contextName)) {
    return null;
  }
  List<ClientSession> sessions=getContextNameSessionMap().get(contextName);
  return getSession(sessions);
}

Fixed version (ground truth):
@Override public ClientSession getAvailableSession(String contextName){
  if (!this.getContextNameSessionMap().containsKey(contextName)) {
    return null;
  }
  Map sessionsMap=getContextNameSessionMap().get(contextName);
  return getSession(new ArrayList<>(sessionsMap.values()));
}
Program: 72308
Project: 72308
Buggy source:
public boolean isActive(){
  return clientChannel != null && clientChannel.isOpen();
}

Fixed version (ground truth):
public boolean isActive(){
  Calendar ruleTime=Calendar.getInstance();
  ruleTime.add(Calendar.SECOND,-5);
  return lastHeartBeatTime.compareTo(ruleTime.getTime()) > 0;
}
Program: 72309
Project: 72309
Buggy source:
public static Channel createChannel(final String ip,final int port,ChannelInitializer channelInitializer){
  ChannelFuture channelFuture=null;
  try {
    channelFuture=bootstrap.handler(channelInitializer).connect(ip,port).sync();
    return channelFuture.channel();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public static Channel createChannel(final String ip,final int port,ChannelInitializer channelInitializer){
  ChannelFuture channelFuture=null;
  try {
    channelFuture=bootstrap.handler(channelInitializer).connect(ip,port);
    if (channelFuture.await(200,TimeUnit.MILLISECONDS)) {
      return channelFuture.channel();
    }
 else {
      log.error(String.format("String_Node_Str",ip,port));
      return null;
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 72310
Project: 72310
Buggy source:
private GenericObjectPoolConfig getGenericObjectPoolConfig(){
  GenericObjectPoolConfig poolConfig=new GenericObjectPoolConfig();
  if (oneNetClientContextConfig.getPoolConfig() != null) {
    BeanUtils.copyProperties(oneNetClientContextConfig.getPoolConfig(),poolConfig);
  }
  return poolConfig;
}

Fixed version (ground truth):
private GenericObjectPoolConfig getGenericObjectPoolConfig(){
  GenericObjectPoolConfig poolConfig=new GenericObjectPoolConfig();
  if (oneNetClientContextConfig.getPoolConfig() != null) {
    BeanUtils.copyProperties(oneNetClientContextConfig.getPoolConfig(),poolConfig);
  }
  poolConfig.setLifo(false);
  return poolConfig;
}
Program: 72311
Project: 72311
Buggy source:
public void returnChannel(Channel channel){
  if (!oneNetClientContextConfig.isLocalPool()) {
    channel.close();
  }
 else {
    log.debug("String_Node_Str" + localPool.getNumActive() + "String_Node_Str"+ localPool.getNumIdle());
    try {
      if (channel.isActive()) {
        localPool.returnObject(channel);
      }
 else {
        removeFromPool(channel);
      }
    }
 catch (    Exception e) {
      log.info(e.getMessage() + localPool.getNumActive() + "String_Node_Str"+ localPool.getNumIdle());
    }
    log.debug("String_Node_Str" + localPool.getNumActive() + "String_Node_Str"+ localPool.getNumIdle());
  }
}

Fixed version (ground truth):
public void returnChannel(Channel channel){
  if (!oneNetClientContextConfig.isLocalPool()) {
    channel.close();
  }
 else {
    try {
      localPool.returnObject(channel);
    }
 catch (    Exception e) {
      log.info(e.getMessage() + localPool.getNumActive() + "String_Node_Str"+ localPool.getNumIdle());
    }
  }
}
Program: 72312
Project: 72312
Buggy source:
public void removeFromPool(Channel channel){
  try {
    localPool.invalidateObject(channel);
  }
 catch (  Exception e) {
    log.info(e.getMessage() + localPool.getNumActive() + "String_Node_Str"+ localPool.getNumIdle());
  }
}

Fixed version (ground truth):
public void removeFromPool(Channel channel){
  if (!oneNetClientContextConfig.isLocalPool()) {
    channel.close();
  }
 else {
    try {
      localPool.invalidateObject(channel);
    }
 catch (    Exception e) {
      log.info(e.getMessage() + localPool.getNumActive() + "String_Node_Str"+ localPool.getNumIdle());
    }
  }
}
Program: 72313
Project: 72313
Buggy source:
@Override public boolean evict(EvictionConfig config,PooledObject<Channel> underTest,int idleCount){
  if (super.evict(config,underTest,idleCount)) {
    log.debug("String_Node_Str");
    return true;
  }
  if (!underTest.getObject().isActive()) {
    log.debug("String_Node_Str");
    return true;
  }
  log.debug("String_Node_Str");
  return false;
}

Fixed version (ground truth):
@Override public boolean evict(EvictionConfig config,PooledObject<Channel> underTest,int idleCount){
  if (super.evict(config,underTest,idleCount)) {
    log.debug("String_Node_Str");
    return true;
  }
  if (!underTest.getObject().isOpen()) {
    log.debug("String_Node_Str");
    return true;
  }
  log.debug("String_Node_Str");
  return false;
}
Program: 72314
Project: 72314
Buggy source:
@Override public boolean validateObject(PooledObject<Channel> p){
  if (!p.getObject().isActive()) {
    log.debug(String.format("String_Node_Str",System.currentTimeMillis() - p.getCreateTime()));
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean validateObject(PooledObject<Channel> p){
  if (!p.getObject().isOpen()) {
    log.debug(String.format("String_Node_Str",System.currentTimeMillis() - p.getCreateTime()));
    return false;
  }
  return true;
}
Program: 72315
Project: 72315
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  this.oneNetClientContext.close(clientSession);
  super.channelInactive(ctx);
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  this.oneNetClientContext.closeDirectly(clientSession);
  super.channelInactive(ctx);
}
Program: 72316
Project: 72316
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause){
  this.oneNetClientContext.close(clientSession);
  ctx.close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause){
  if (cause instanceof WriteTimeoutException) {
  }
  this.oneNetClientContext.closeDirectly(clientSession);
  ctx.close();
}
Program: 72318
Project: 72318
Buggy source:
@Override protected void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline p=ch.pipeline();
  int bytesPreSecond=0;
  if (clientSession != null) {
    bytesPreSecond=oneNetClientContext.getKBps() * OneNetCommonConstants.KByte;
  }
  p.addLast(CHANNEL_TRAFFIC_HANDLER,new ChannelTrafficShapingHandler(bytesPreSecond,bytesPreSecond)).addLast(LOCAL_RESPONSE_HANDLER,new LocalInboudHandler(oneNetClientContext,clientSession)).addLast(new ByteArrayEncoder());
}

Fixed version (ground truth):
@Override protected void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline p=ch.pipeline();
  int bytesPreSecond=0;
  if (clientSession != null) {
    bytesPreSecond=oneNetClientContext.getKBps() * OneNetCommonConstants.KByte;
  }
  p.addLast(new WriteTimeoutHandler(5)).addLast(CHANNEL_TRAFFIC_HANDLER,new ChannelTrafficShapingHandler(bytesPreSecond,bytesPreSecond)).addLast(LOCAL_RESPONSE_HANDLER,new LocalInboudHandler(oneNetClientContext,clientSession)).addLast(new ByteArrayEncoder());
}
Program: 72319
Project: 72319
Buggy source:
@Override protected void initChannel(SocketChannel ch) throws Exception {
  ch.pipeline().addLast(new OneNetMsgEncoder()).addLast(new OneNetMsgDecoder()).addLast(new OneNetInboundHandler(serverSession));
}

Fixed version (ground truth):
@Override protected void initChannel(SocketChannel ch) throws Exception {
  ch.pipeline().addLast(new WriteTimeoutHandler(5)).addLast(new OneNetMsgEncoder()).addLast(new OneNetMsgDecoder()).addLast(new OneNetInboundHandler(serverSession));
}
Program: 72320
Project: 72320
Buggy source:
public void close(){
  if (this.getServerSession().getServerChannel().isActive()) {
    serverSession.getServerChannel().writeAndFlush(new InvalidSessionPackage(this.getContextName(),sessionId));
  }
}

Fixed version (ground truth):
public void close(){
  if (this.getServerSession().getServerChannel().isOpen()) {
    serverSession.getServerChannel().writeAndFlush(new InvalidSessionPackage(this.getContextName(),sessionId));
  }
}
Program: 72321
Project: 72321
Buggy source:
public void invalidAllClientSessions(){
  oneNetClientContextMap.values().stream().forEach((oneNetClientContext -> oneNetClientContext.closeAll()));
}

Fixed version (ground truth):
public void invalidAllClientSessions(){
  this.lastHeartbeatTime=null;
  oneNetClientContextMap.values().stream().forEach((oneNetClientContext -> oneNetClientContext.closeAll()));
}
Program: 72322
Project: 72322
Buggy source:
/** 
 * Customized system debug message for   {@link #HlaManager}.
 * @param reason The reason to print
 */
private void _hlaDebugSys(String reason){
  String dbgHeader="String_Node_Str" + _federateName + "String_Node_Str"+ _federationName+ "String_Node_Str";
  _hlaDebugSys(dbgHeader + reason);
}

Fixed version (ground truth):
/** 
 * Customized system debug message for   {@link #HlaManager}.
 * @param reason The reason to print
 */
private void _hlaDebugSys(String reason){
  String dbgHeader="String_Node_Str" + _federateName + "String_Node_Str"+ _federationName+ "String_Node_Str";
  System.out.println(dbgHeader + reason);
}
Program: 72323
Project: 72323
Buggy source:
/** 
 * Customized debug message for   {@link #HlaManager}.
 * @param reason The reason to print
 */
private void _hlaDebug(String reason){
  String dbgHeader="String_Node_Str" + _federateName + "String_Node_Str"+ _federationName+ "String_Node_Str";
  _hlaDebug(dbgHeader + reason);
}

Fixed version (ground truth):
/** 
 * Customized debug message for   {@link #HlaManager}.
 * @param reason The reason to print
 */
private void _hlaDebug(String reason){
  String dbgHeader="String_Node_Str" + _federateName + "String_Node_Str"+ _federationName+ "String_Node_Str";
  _debug(dbgHeader + reason);
}
Program: 72329
Project: 72329
Buggy source:
/** 
 * Given an array of derivatives that specifies an input value and its derivatives, set the "input model."
 * @param derivatives The input to this integrator, which represents thederivative of the state and possibly higher-order derivatives.
 * @param currentTime The current time.
 * @exception IllegalActionException If the solver throws an exception whentriggering a rate event.
 */
private void _setInputModel(double[] derivatives,Time currentTime) throws IllegalActionException {
  ModelPolynomial inputModel=_qssSolver.getInputVariableModel(0);
  inputModel.coeffs[0]=derivatives[0];
  if (_maximumInputOrder > 0) {
    int factorial=1;
    for (int i=1; i <= _maximumInputOrder; i++) {
      if (derivatives.length <= i) {
        inputModel.coeffs[i]=0.0;
      }
 else {
        inputModel.coeffs[i]=derivatives[i] / factorial;
        factorial=factorial * i;
      }
    }
  }
  inputModel.tModel=currentTime;
  try {
    _qssSolver.triggerRateEvent();
  }
 catch (  Exception e) {
    throw new IllegalActionException(this,e,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Given an array of derivatives that specifies an input value and its derivatives, set the "input model."
 * @param derivatives The input to this integrator, which represents thederivative of the state and possibly higher-order derivatives.
 * @param currentTime The current time.
 * @exception IllegalActionException If the solver throws an exception whentriggering a rate event.
 */
private void _setInputModel(double[] derivatives,Time currentTime) throws IllegalActionException {
  ModelPolynomial inputModel=_qssSolver.getInputVariableModel(0);
  inputModel.coeffs[0]=derivatives != null && derivatives.length > 0 ? derivatives[0] : 0;
  if (_maximumInputOrder > 0) {
    int factorial=1;
    for (int i=1; i <= _maximumInputOrder; i++) {
      if (derivatives == null || derivatives.length <= i) {
        inputModel.coeffs[i]=0.0;
      }
 else {
        inputModel.coeffs[i]=derivatives[i] / factorial;
        factorial=factorial * i;
      }
    }
  }
  inputModel.tModel=currentTime;
  try {
    _qssSolver.triggerRateEvent();
  }
 catch (  Exception e) {
    throw new IllegalActionException(this,e,e.getMessage());
  }
}
Program: 72331
Project: 72331
Buggy source:
private void _createOrShowWindow(String title){
  if (textArea == null) {
    Effigy containerEffigy=Configuration.findEffigy(_actor.toplevel());
    try {
      if (containerEffigy == null) {
        throw new IllegalActionException("String_Node_Str" + _actor.toplevel().getFullName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      TextEffigy textEffigy=TextEffigy.newTextEffigy(containerEffigy,"String_Node_Str");
      textEffigy.identifier.setExpression(_actor.getFullName());
      _tableau=new DisplayWindowTableau(_actor,textEffigy,title);
      _frame=_tableau.frame.get();
      JScrollPane pane=((TextEditor)_frame).getScrollPane();
      if (pane != null) {
        pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
      }
      textArea=((TextEditor)_frame).text;
      textArea.setRows(10);
      textArea.setColumns(40);
      _actor.setFrame(_frame);
      _frame.pack();
    }
 catch (    Exception ex) {
      MessageHandler.error("String_Node_Str",ex);
    }
  }
 else {
    textArea.setText("String_Node_Str");
  }
  if (_frame != null) {
    _frame.setVisible(true);
    _frame.toFront();
  }
}

Fixed version (ground truth):
private void _createOrShowWindow(String title){
  if (textArea == null) {
    Effigy containerEffigy=Configuration.findEffigy(_actor.toplevel());
    try {
      if (containerEffigy == null) {
        throw new IllegalActionException("String_Node_Str" + _actor.toplevel().getFullName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      TextEffigy textEffigy=TextEffigy.newTextEffigy(containerEffigy,"String_Node_Str");
      textEffigy.identifier.setExpression(_actor.getFullName());
      _tableau=new DisplayWindowTableau(_actor,textEffigy,title);
      _frame=_tableau.frame.get();
      if (_frame != null) {
        JScrollPane pane=((TextEditor)_frame).getScrollPane();
        if (pane != null) {
          pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        }
        textArea=((TextEditor)_frame).text;
        textArea.setRows(10);
        textArea.setColumns(40);
        _actor.setFrame(_frame);
        _frame.pack();
      }
    }
 catch (    Exception ex) {
      MessageHandler.error("String_Node_Str",ex);
    }
  }
 else {
    textArea.setText("String_Node_Str");
  }
  if (_frame != null) {
    _frame.setVisible(true);
    _frame.toFront();
  }
}
Program: 72332
Project: 72332
Buggy source:
/** 
 * Open the camera. This starts a sequence of notifications that call webcamImageObtained() and trigger emission of the "image" event for the corresponding JavaScript object.
 */
public void open(){
  if (_webcam != null) {
    String cameraName=_webcam.getName();
    if (_openCameras != null) {
      WeakReference<JavaScript> actor=_openCameras.get(cameraName);
      if (actor != null && actor.get() != null) {
        _actor.error("String_Node_Str" + cameraName + "String_Node_Str"+ actor.get().getFullName()+ "String_Node_Str"+ _actor.getFullName());
        return;
      }
 else       if (actor != null) {
        _openCameras.remove(cameraName);
      }
    }
 else {
      _openCameras=new HashMap<String,WeakReference<JavaScript>>();
    }
    _webcam.open(true);
    _openCameras.put(cameraName,new WeakReference(_actor));
  }
}

Fixed version (ground truth):
/** 
 * Open the camera. This starts a sequence of notifications that call webcamImageObtained() and trigger emission of the "image" event for the corresponding JavaScript object.
 */
public void open(){
  if (_webcam != null) {
    String cameraName=_webcam.getName();
    if (_openCameras != null) {
      WeakReference<JavaScript> actor=_openCameras.get(cameraName);
      if (actor != null && actor.get() != null) {
        _actor.error("String_Node_Str" + (cameraName == null ? "String_Node_Str" : cameraName) + "String_Node_Str"+ actor.get().getFullName()+ "String_Node_Str"+ _actor.getFullName());
        return;
      }
 else       if (actor != null) {
        _openCameras.remove(cameraName);
      }
    }
 else {
      _openCameras=new HashMap<String,WeakReference<JavaScript>>();
    }
    _webcam.open(true);
    _openCameras.put(cameraName,new WeakReference(_actor));
  }
}
Program: 72333
Project: 72333
Buggy source:
/** 
 * Invoke the specified function after the specified amount of time. The time will be added to the current time of the director, and fireAt() request will be made of the director. If the director cannot fulfill the request, this method will throw an exception. Note that if you want real-time behavior, then the director's synchronizeToRealTime parameter needs to be set to true.
 * @param function The function to invoke.
 * @param milliseconds The number of milliseconds in the future to invoke it.
 * @return A unique ID for this callback.
 * @exception IllegalActionException If the director cannot respect the request.
 * @see #clearTimeout(Object)
 */
@Override public synchronized Object setTimeout(final Runnable function,final int milliseconds) throws IllegalActionException {
  final Integer id=Integer.valueOf(_timeoutCount++);
  _setTimeout(function,milliseconds,id);
  return Integer.valueOf(id);
}

Fixed version (ground truth):
/** 
 * Invoke the specified function after the specified amount of time. The time will be added to the current time of the director, and fireAt() request will be made of the director. If the director cannot fulfill the request, this method will throw an exception. Note that if you want real-time behavior, then the director's synchronizeToRealTime parameter needs to be set to true.
 * @param function The function to invoke.
 * @param milliseconds The number of milliseconds in the future to invoke it.
 * @return A unique ID for this callback.
 * @exception IllegalActionException If the director cannot respect the request.
 * @see #clearTimeout(Object)
 */
@Override public synchronized Object setTimeout(final Runnable function,final int milliseconds) throws IllegalActionException {
  final Integer id=Integer.valueOf(_timeoutCount++);
  _setTimeout(function,milliseconds,id);
  return id;
}
Program: 72335
Project: 72335
Buggy source:
public AWTImageToken convertImageBody(String body){
  int comma=body.indexOf("String_Node_Str");
  if (comma > -1) {
    body=body.substring(comma + 1,body.length());
  }
  try {
    byte[] bytes=new BigInteger(body,64).toByteArray();
    BufferedImage image=ImageIO.read(new ByteArrayInputStream(bytes));
    AWTImageToken token=new AWTImageToken(image);
    return token;
  }
 catch (  IOException e) {
    _error("String_Node_Str" + e.toString());
    AWTImageToken imageToken=new AWTImageToken(null);
    return imageToken;
  }
}

Fixed version (ground truth):
public AWTImageToken convertImageBody(String body){
  int comma=body.indexOf("String_Node_Str");
  if (comma > -1) {
    body=body.substring(comma + 1,body.length());
  }
  try {
    byte[] bytes=Base64.getDecoder().decode(body);
    BufferedImage image=ImageIO.read(new ByteArrayInputStream(bytes));
    AWTImageToken token=new AWTImageToken(image);
    return token;
  }
 catch (  Throwable throwable) {
    System.out.println("String_Node_Str" + throwable);
    throwable.printStackTrace();
    _error(_actor + "String_Node_Str" + throwable.toString());
    AWTImageToken imageToken=new AWTImageToken(null);
    return imageToken;
  }
}
Program: 72339
Project: 72339
Buggy source:
/** 
 * Write some information in a file.
 * @param file The file were the information is going to be written.
 * @param data The information that is going to be written.
 */
private static void _writeInFile(File file,String data){
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"String_Node_Str"));
    writer.write(data);
    writer.flush();
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str");
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        System.out.println("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Write some information in a file.
 * @param file The file were the information is going to be written.
 * @param data The information that is going to be written.
 */
private static void _writeInFile(File file,String data){
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file,true),"String_Node_Str"));
    writer.write(data);
    writer.flush();
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str");
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        System.out.println("String_Node_Str");
      }
    }
  }
}
Program: 72341
Project: 72341
Buggy source:
/** 
 * Write information in a txt file.
 * @param data The information you want to write.
 * @param file The file in which you want to write.
 * @return Return true if the information was successfully written in the file.
 */
public boolean writeInTextFile(File file,String data){
  boolean noExceptionOccured=true;
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"String_Node_Str"));
    writer.write(data);
    writer.newLine();
    writer.flush();
  }
 catch (  IOException e) {
    noExceptionOccured=false;
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        System.out.println("String_Node_Str");
      }
    }
  }
  return noExceptionOccured;
}

Fixed version (ground truth):
/** 
 * Write information in a txt file.
 * @param data The information you want to write.
 * @param file The file in which you want to write.
 * @return Return true if the information was successfully written in the file.
 */
public boolean writeInTextFile(File file,String data){
  boolean noExceptionOccured=true;
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file,true),"String_Node_Str"));
    writer.write(data);
    writer.newLine();
    writer.flush();
  }
 catch (  IOException e) {
    noExceptionOccured=false;
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        System.out.println("String_Node_Str");
      }
    }
  }
  return noExceptionOccured;
}
Program: 72342
Project: 72342
Buggy source:
/** 
 * Create a camera with the specified name. The name is required to be one of those returned by   {@link #cameras()}, or else a exception will be thrown.  If   {@link #cameras()}returns no cameras, then the dummy camera is used.
 * @param name The name of the camera.
 * @param actor The actor associated with this camera.
 * @param currentObj The JavaScript object that this is helping.
 * @exception IOException If the camera does not exist.
 */
public CameraHelper(Object actor,ScriptObjectMirror currentObj,String name) throws IOException {
  super(actor,currentObj);
  if (name == null || name.trim().equals("String_Node_Str")) {
    _webcam=Webcam.getDefault();
  }
 else {
    if (_webcams == null) {
      cameras();
    }
    if (_webcams != null) {
      _webcam=_webcams.get(name);
    }
  }
  if (_webcam == null) {
    System.out.println("String_Node_Str");
    Webcam.setDriver(new WebcamDummyDriver(1));
    _webcam=Webcam.getDefault();
  }
  if (_webcam == null) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str");
  }
  _webcam.addWebcamListener(this);
}

Fixed version (ground truth):
/** 
 * Create a camera with the specified name. The name is required to be one of those returned by   {@link #cameras()}, or else a exception will be thrown.  If   {@link #cameras()}returns no cameras, then the dummy camera is used.
 * @param name The name of the camera.
 * @param actor The actor associated with this camera.
 * @param currentObj The JavaScript object that this is helping.
 * @exception IOException If the camera does not exist.
 */
public CameraHelper(Object actor,ScriptObjectMirror currentObj,String name) throws IOException {
  super(actor,currentObj);
  if (name == null || name.trim().equals("String_Node_Str")) {
    _webcam=Webcam.getDefault();
  }
 else {
    if (_webcams == null) {
      cameras();
    }
    if (_webcams != null) {
      _webcam=_webcams.get(name);
      if (_webcam == null) {
        System.out.println("String_Node_Str" + name);
        System.out.println("String_Node_Str");
        _webcam=Webcam.getDefault();
      }
    }
  }
  if (_webcam == null) {
    System.out.println("String_Node_Str");
    Webcam.setDriver(new WebcamDummyDriver(1));
    _webcam=Webcam.getDefault();
  }
  if (_webcam == null) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str");
  }
  _webcam.addWebcamListener(this);
}
Program: 72343
Project: 72343
Buggy source:
@Override public boolean equals(Object originatedEvent){
  if (!super.equals(originatedEvent)) {
    return false;
  }
 else {
    OriginatedEvent event=(OriginatedEvent)originatedEvent;
    if (objectID == event.objectID) {
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (!super.equals(obj))   return false;
  if (getClass() != obj.getClass())   return false;
  OriginatedEvent other=(OriginatedEvent)obj;
  if (objectID != other.objectID)   return false;
  return true;
}
Program: 72352
Project: 72352
Buggy source:
/** 
 * Callback (TAG) delivered by the RTI (CERTI) to notify that the Federate is authorized to advance its time to <i>theTime</i>. This time is the same or smaller than the time specified when calling the nextEventRequest() or the timeAdvanceRequest() services.
 */
@Override public void timeAdvanceGrant(LogicalTime theTime) throws InvalidFederationTime, TimeAdvanceWasNotInProgress, FederateInternalError {
  double time=((CertiLogicalTime)theTime).getTime();
  time=_hlaTimeUnitValue * time;
  logicalTimeHLA=new CertiLogicalTime(time);
  _TAGDelay.add((System.nanoTime() - _timeOfTheLastAdvanceRequest) / Math.pow(10,9));
  _timeOfTheLastAdvanceRequest=0;
  timeAdvanceGrant=true;
  _numberOfTAGs++;
  _numberOfTicks.add(0);
  if (_debugging) {
    _debug("String_Node_Str" + logicalTimeHLA.toString() + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Callback (TAG) delivered by the RTI (CERTI) to notify that the Federate is authorized to advance its time to <i>theTime</i>. This time is the same or smaller than the time specified when calling the nextEventRequest() or the timeAdvanceRequest() services.
 */
@Override public void timeAdvanceGrant(LogicalTime theTime) throws InvalidFederationTime, TimeAdvanceWasNotInProgress, FederateInternalError {
  double time=((CertiLogicalTime)theTime).getTime();
  logicalTimeHLA=new CertiLogicalTime(time);
  _TAGDelay.add((System.nanoTime() - _timeOfTheLastAdvanceRequest) / Math.pow(10,9));
  _timeOfTheLastAdvanceRequest=0;
  timeAdvanceGrant=true;
  _numberOfTAGs++;
  _numberOfTicks.add(0);
  if (_debugging) {
    _debug("String_Node_Str" + logicalTimeHLA.toString() + "String_Node_Str");
  }
}
Program: 72353
Project: 72353
Buggy source:
/** 
 * Get hlaNextPointInTime in HLA to advance to when TAR is used. hlaNextPointInTime = hlaCurrentTime + Ts.
 * @return next point in time to advance to.
 * @exception IllegalActionException if hlaTimeStep is NULL.
 */
private Time _getHlaNextPointInTime() throws IllegalActionException {
  Double time=_getHlaCurrentTime().add(_hlaTimeStep).getDoubleValue();
  return _convertToPtolemyTime(new CertiLogicalTime(time));
}

Fixed version (ground truth):
/** 
 * Get hlaNextPointInTime in HLA to advance to when TAR is used. hlaNextPointInTime = hlaCurrentTime + Ts.
 * @return next point in time to advance to.
 * @exception IllegalActionException if hlaTimeStep is NULL.
 */
private Time _getHlaNextPointInTime() throws IllegalActionException {
  return _getHlaCurrentTime().add(_hlaTimeStep);
}
Program: 72354
Project: 72354
Buggy source:
private static void _generateCredentials(File directory,String subdirectory) throws IOException {
  if (directory.isFile()) {
    throw new IOException(directory + _badFileMessage);
  }
  final StringBufferExec exec=new StringBufferExec(true);
  List execCommands=new LinkedList<String>();
  String commands="String_Node_Str";
  System.out.println("String_Node_Str" + directory + "String_Node_Str"+ subdirectory);
  File subdirectoryDirectory=new File(directory,subdirectory);
}

Fixed version (ground truth):
private static void _generateCredentials(File directory,String subdirectory) throws IOException {
  if (directory.isFile()) {
    throw new IOException(directory + _badFileMessage);
  }
  System.out.println("String_Node_Str" + directory + "String_Node_Str"+ subdirectory);
}
Program: 72356
Project: 72356
Buggy source:
/** 
 * Execute the arp command on a Windows platform.  The arp command finds MAC addresses for devices on the local area network. The arp command should follow a ping sweep to get the most up-to-date information and to screen out devices that are not accessible at the moment (which may be cached in the arp cache).
 */
private void _arpWindows(){
  if (_ipMap.size() == 0) {
    System.err.println("String_Node_Str" + _pingWindowsCommand + "String_Node_Str");
  }
  try {
    Process process=Runtime.getRuntime().exec(_arpCommand);
    BufferedReader stdOut=null;
    try {
      stdOut=new BufferedReader(new InputStreamReader(process.getInputStream(),"String_Node_Str"));
      String line;
      int index;
      JSONObject object;
      while ((line=stdOut.readLine()) != null) {
        for (        String key : _ipMap.keySet()) {
          object=_ipMap.get(key);
          index=line.indexOf(object.getString("String_Node_Str"));
          if (index != -1) {
            if (index != 2) {
              object.put("String_Node_Str","String_Node_Str");
            }
 else {
              object.put("String_Node_Str",line.substring(index + 22,index + 39));
            }
            _ipMap.put(key,object);
          }
        }
      }
    }
  finally {
      if (stdOut != null) {
        stdOut.close();
      }
    }
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + _arpCommand);
  }
catch (  JSONException e2) {
    System.err.println("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Execute the arp command on a Windows platform.  The arp command finds MAC addresses for devices on the local area network. The arp command should follow a ping sweep to get the most up-to-date information and to screen out devices that are not accessible at the moment (which may be cached in the arp cache).
 */
private void _arpWindows(){
  if (_ipMap.size() == 0) {
    System.err.println("String_Node_Str" + _pingWindowsCommand + "String_Node_Str");
  }
  try {
    Process process=Runtime.getRuntime().exec(_arpCommand);
    BufferedReader stdOut=null;
    try {
      stdOut=new BufferedReader(new InputStreamReader(process.getInputStream(),"String_Node_Str"));
      String line;
      int index;
      JSONObject object;
      while ((line=stdOut.readLine()) != null) {
        for (        Entry<String,JSONObject> entry : _ipMap.entrySet()) {
          object=entry.getValue();
          index=line.indexOf(object.getString("String_Node_Str"));
          if (index != -1) {
            if (index != 2) {
              object.put("String_Node_Str","String_Node_Str");
            }
 else {
              object.put("String_Node_Str",line.substring(index + 22,index + 39));
            }
            _ipMap.put(entry.getKey(),object);
          }
        }
      }
    }
  finally {
      if (stdOut != null) {
        stdOut.close();
      }
    }
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + _arpCommand);
  }
catch (  JSONException e2) {
    System.err.println("String_Node_Str");
  }
}
Program: 72359
Project: 72359
Buggy source:
/** 
 * Take a key and return its value from the local storage if the key exists, otherwise, return null.
 * @param key The key for the value to be returned.
 * @return The string value associated with the key.
 * @exception MqttPersistenceException
 * @see #setItem(String,String)
 */
public String getItem(String key) throws MqttPersistenceException {
  if (_mqttLocalStorage.containsKey(key)) {
    MqttPersistentData message=(MqttPersistentData)_mqttLocalStorage.get(key);
    return new String(message.getHeaderBytes());
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Take a key and return its value from the local storage if the key exists, otherwise, return null.
 * @param key The key for the value to be returned.
 * @return The string value associated with the key.
 * @exception MqttPersistenceException
 * @see #setItem(String,String)
 */
public String getItem(String key) throws MqttPersistenceException {
  if (_mqttLocalStorage.containsKey(key)) {
    MqttPersistentData message=(MqttPersistentData)_mqttLocalStorage.get(key);
    return new String(message.getHeaderBytes(),StandardCharsets.UTF_8);
  }
 else {
    return null;
  }
}
Program: 72360
Project: 72360
Buggy source:
/** 
 * Take a key-value pair and stores the pair into the local storage.
 * @param key The key to be stored.
 * @param value The string value associated with the key.
 * @exception MqttPersistenceException
 * @exception IOException
 * @see #getItem(String)
 */
public void setItem(String key,String value) throws MqttPersistenceException, IOException {
  byte[] bytes=value.getBytes();
  MqttPersistentData message=new MqttPersistentData(value,new byte[0],0,0,bytes,0,bytes.length);
  _mqttLocalStorage.put(key,message);
}

Fixed version (ground truth):
/** 
 * Take a key-value pair and stores the pair into the local storage.
 * @param key The key to be stored.
 * @param value The string value associated with the key.
 * @exception MqttPersistenceException
 * @exception IOException
 * @see #getItem(String)
 */
public void setItem(String key,String value) throws MqttPersistenceException, IOException {
  byte[] bytes=value.getBytes(StandardCharsets.UTF_8);
  MqttPersistentData message=new MqttPersistentData(value,new byte[0],0,0,bytes,0,bytes.length);
  _mqttLocalStorage.put(key,message);
}
Program: 72361
Project: 72361
Buggy source:
/** 
 * Start connection between the client and the broker server.
 * @exception MqttSecurityException
 * @exception MqttException
 */
public void start() throws MqttSecurityException, MqttException {
  _mqttClient.connect(_connOpts,null,new IMqttActionListener(){
    @Override public void onSuccess(    IMqttToken arg0){
      _currentObj.callMember("String_Node_Str","String_Node_Str");
    }
    @Override public void onFailure(    IMqttToken arg0,    Throwable arg1){
      _error(_currentObj,"String_Node_Str");
    }
  }
);
  _mqttClient.setCallback(new MqttCallback(){
    @Override public void messageArrived(    String topic,    MqttMessage message) throws Exception {
      Object messageObject;
      if (_rawBytes) {
        messageObject=_toJSArray(message.getPayload());
      }
 else {
        messageObject=new String(message.getPayload());
      }
      _currentObj.callMember("String_Node_Str","String_Node_Str",topic,messageObject);
    }
    @Override public void deliveryComplete(    IMqttDeliveryToken arg0){
      _currentObj.callMember("String_Node_Str","String_Node_Str");
    }
    @Override public void connectionLost(    Throwable arg0){
      _currentObj.callMember("String_Node_Str","String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Start connection between the client and the broker server.
 * @exception MqttSecurityException
 * @exception MqttException
 */
public void start() throws MqttSecurityException, MqttException {
  _mqttClient.connect(_connOpts,null,new IMqttActionListener(){
    @Override public void onSuccess(    IMqttToken arg0){
      _currentObj.callMember("String_Node_Str","String_Node_Str");
    }
    @Override public void onFailure(    IMqttToken arg0,    Throwable arg1){
      _error(_currentObj,"String_Node_Str");
    }
  }
);
  _mqttClient.setCallback(new MqttCallback(){
    @Override public void messageArrived(    String topic,    MqttMessage message) throws Exception {
      Object messageObject;
      if (_rawBytes) {
        messageObject=_toJSArray(message.getPayload());
      }
 else {
        messageObject=new String(message.getPayload(),StandardCharsets.UTF_8);
      }
      _currentObj.callMember("String_Node_Str","String_Node_Str",topic,messageObject);
    }
    @Override public void deliveryComplete(    IMqttDeliveryToken arg0){
      _currentObj.callMember("String_Node_Str","String_Node_Str");
    }
    @Override public void connectionLost(    Throwable arg0){
      _currentObj.callMember("String_Node_Str","String_Node_Str");
    }
  }
);
}
Program: 72362
Project: 72362
Buggy source:
@Override public void messageArrived(String topic,MqttMessage message) throws Exception {
  Object messageObject;
  if (_rawBytes) {
    messageObject=_toJSArray(message.getPayload());
  }
 else {
    messageObject=new String(message.getPayload());
  }
  _currentObj.callMember("String_Node_Str","String_Node_Str",topic,messageObject);
}

Fixed version (ground truth):
@Override public void messageArrived(String topic,MqttMessage message) throws Exception {
  Object messageObject;
  if (_rawBytes) {
    messageObject=_toJSArray(message.getPayload());
  }
 else {
    messageObject=new String(message.getPayload(),StandardCharsets.UTF_8);
  }
  _currentObj.callMember("String_Node_Str","String_Node_Str",topic,messageObject);
}