nus-yam/ex-repair huggingface dataset:
Program: 13227
Project: 13227
Buggy source:
/** 
 * Adds a Trigger to the list of acquired triggers.
 * @param trigger    the Trigger to add
 * @param instanceId the instance ID
 * @throws JobPersistenceException
 * @throws ObjectSetException
 */
private void addAcquiredTrigger(Trigger trigger,String instanceId) throws JobPersistenceException {
synchronized (lock) {
    try {
      int retries=0;
      while (writeRetries == -1 || retries <= writeRetries) {
        try {
          addRepoListName(getTriggerId(trigger.getGroup(),trigger.getName()),getAcquiredTriggersRepoId(),instanceId);
          break;
        }
 catch (        PreconditionFailedException e) {
          logger.debug("String_Node_Str",e);
          retries++;
        }
      }
    }
 catch (    ResourceException e) {
      throw new JobPersistenceException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a Trigger to the list of acquired triggers.
 * @param trigger    the Trigger to add
 * @param instanceId the instance ID
 * @throws JobPersistenceException
 * @throws ObjectSetException
 */
private void addAcquiredTrigger(Trigger trigger,String instanceId) throws JobPersistenceException {
synchronized (lock) {
    try {
      logger.debug("String_Node_Str",new Object[]{trigger.getName(),instanceId});
      int retries=0;
      while (writeRetries == -1 || retries <= writeRetries) {
        try {
          addRepoListName(getTriggerId(trigger.getGroup(),trigger.getName()),getAcquiredTriggersRepoId(),instanceId);
          break;
        }
 catch (        PreconditionFailedException e) {
          logger.debug("String_Node_Str",e);
          retries++;
        }
      }
    }
 catch (    ResourceException e) {
      throw new JobPersistenceException("String_Node_Str",e);
    }
  }
}
Program: 13229
Project: 13229
Buggy source:
/** 
 * <p> Called by the QuartzScheduler before the <code>JobStore</code> is used, in order to give the it a chance to initialize. </p>
 */
@Override public void initialize(ClassLoadHelper loadHelper,SchedulerSignaler schedSignaler){
  logger.debug("String_Node_Str");
  this.schedulerSignaler=schedSignaler;
  this.loadHelper=loadHelper;
  this.writeRetries=Integer.parseInt(IdentityServer.getInstance().getProperty("String_Node_Str","String_Node_Str"));
  if (!isClustered()) {
    cleanUpInstance();
  }
}

Fixed version (ground truth):
/** 
 * <p> Called by the QuartzScheduler before the <code>JobStore</code> is used, in order to give the it a chance to initialize. </p>
 */
@Override public void initialize(ClassLoadHelper loadHelper,SchedulerSignaler schedSignaler){
  logger.debug("String_Node_Str");
  this.schedulerSignaler=schedSignaler;
  this.loadHelper=loadHelper;
  this.writeRetries=Integer.parseInt(IdentityServer.getInstance().getProperty("String_Node_Str","String_Node_Str"));
  cleanUpInstance();
}
Program: 13230
Project: 13230
Buggy source:
@Override public boolean handleEvent(ClusterEvent event){
  String eventInstanceId=event.getInstanceId();
switch (event.getType()) {
case RECOVERY_INITIATED:
    try {
      AcquiredTriggers triggers=getAcquiredTriggers(eventInstanceId);
      for (      Trigger trigger : triggers.getTriggers()) {
        boolean removed=false;
        int retry=0;
        while (writeRetries == -1 || retry <= writeRetries) {
          try {
            removed=removeAcquiredTrigger(trigger,eventInstanceId);
            break;
          }
 catch (          JobPersistenceException e) {
            logger.debug("String_Node_Str",e);
            retry++;
          }
        }
        if (removed) {
          retry=0;
          while (writeRetries == -1 || retry <= writeRetries) {
            try {
              addWaitingTrigger(trigger);
              break;
            }
 catch (            JobPersistenceException e) {
              logger.debug("String_Node_Str",e);
              retry++;
            }
          }
        }
        logger.info("String_Node_Str",trigger.getName(),eventInstanceId);
        clusterManager.renewRecoveryLease(eventInstanceId);
      }
      schedulerSignaler.signalSchedulingChange(0L);
    }
 catch (    JobPersistenceException e) {
      logger.warn("String_Node_Str",eventInstanceId,e.getMessage());
      return false;
    }
  break;
case INSTANCE_FAILED:
break;
case INSTANCE_RUNNING:
cleanUpInstance();
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean handleEvent(ClusterEvent event){
  String eventInstanceId=event.getInstanceId();
switch (event.getType()) {
case RECOVERY_INITIATED:
    try {
      AcquiredTriggers triggers=getAcquiredTriggers(eventInstanceId);
      for (      Trigger trigger : triggers.getTriggers()) {
        boolean removed=false;
        int retry=0;
        while (writeRetries == -1 || retry <= writeRetries) {
          try {
            removed=removeAcquiredTrigger(trigger,eventInstanceId);
            break;
          }
 catch (          JobPersistenceException e) {
            logger.debug("String_Node_Str",e);
            retry++;
          }
        }
        if (removed) {
          retry=0;
          while (writeRetries == -1 || retry <= writeRetries) {
            try {
              addWaitingTrigger(trigger);
              break;
            }
 catch (            JobPersistenceException e) {
              logger.debug("String_Node_Str",e);
              retry++;
            }
          }
        }
        logger.info("String_Node_Str",trigger.getName(),eventInstanceId);
        clusterManager.renewRecoveryLease(eventInstanceId);
      }
      schedulerSignaler.signalSchedulingChange(0L);
    }
 catch (    JobPersistenceException e) {
      logger.warn("String_Node_Str",eventInstanceId,e.getMessage());
      return false;
    }
  break;
case INSTANCE_FAILED:
break;
case INSTANCE_RUNNING:
break;
}
return true;
}
Program: 13231
Project: 13231
Buggy source:
/** 
 * Removes a Trigger from the list of acquired triggers.
 * @param trigger    the Trigger to remove
 * @param instanceId the instance ID
 * @throws JobPersistenceException
 * @throws ObjectSetException
 */
private boolean removeAcquiredTrigger(Trigger trigger,String instanceId) throws JobPersistenceException {
synchronized (lock) {
    try {
      boolean result=false;
      int retries=0;
      while (writeRetries == -1 || retries <= writeRetries) {
        try {
          result=removeRepoListName(getTriggerId(trigger.getGroup(),trigger.getName()),getAcquiredTriggersRepoId(),instanceId);
          break;
        }
 catch (        PreconditionFailedException e) {
          logger.debug("String_Node_Str",e);
          retries++;
        }
      }
      return result;
    }
 catch (    ResourceException e) {
      throw new JobPersistenceException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes a Trigger from the list of acquired triggers.
 * @param trigger    the Trigger to remove
 * @param instanceId the instance ID
 * @throws JobPersistenceException
 * @throws ObjectSetException
 */
private boolean removeAcquiredTrigger(Trigger trigger,String instanceId) throws JobPersistenceException {
synchronized (lock) {
    try {
      logger.debug("String_Node_Str",new Object[]{trigger.getName(),instanceId});
      boolean result=false;
      int retries=0;
      while (writeRetries == -1 || retries <= writeRetries) {
        try {
          result=removeRepoListName(getTriggerId(trigger.getGroup(),trigger.getName()),getAcquiredTriggersRepoId(),instanceId);
          break;
        }
 catch (        PreconditionFailedException e) {
          logger.debug("String_Node_Str",e);
          retries++;
        }
      }
      return result;
    }
 catch (    ResourceException e) {
      throw new JobPersistenceException("String_Node_Str",e);
    }
  }
}
Program: 13232
Project: 13232
Buggy source:
@Override public void removedService(ServiceReference reference,Object service){
  if (cluster != null) {
    cluster.unregister(LISTENER_ID);
    cluster=null;
  }
}

Fixed version (ground truth):
@Override public void removedService(ServiceReference reference,Object service){
  if (cluster != null) {
    cluster.unregister(LISTENER_ID);
    cluster=null;
    clusterUp=false;
  }
}
Program: 13233
Project: 13233
Buggy source:
/** 
 * <p> Called by the QuartzScheduler before the <code>JobStore</code> is used, in order to give the it a chance to initialize. </p>
 */
@Override public void initialize(ClassLoadHelper loadHelper,SchedulerSignaler schedSignaler){
  logger.debug("String_Node_Str");
  this.schedulerSignaler=schedSignaler;
  this.loadHelper=loadHelper;
  this.writeRetries=Integer.parseInt(IdentityServer.getInstance().getProperty("String_Node_Str","String_Node_Str"));
synchronized (lock) {
    if (!isClustered()) {
      try {
        logger.trace("String_Node_Str");
        AcquiredTriggers at=getAcquiredTriggers(instanceId);
        List<Trigger> acquiredTriggers=at.getTriggers();
        for (Iterator<Trigger> it=acquiredTriggers.iterator(); it.hasNext(); ) {
          Trigger t=it.next();
          if (hasTriggerMisfired(t)) {
            logger.trace("String_Node_Str",t.getName());
            processTriggerMisfired(getTriggerWrapper(t.getGroup(),t.getName()));
            if (t.getNextFireTime() != null) {
              addWaitingTrigger(t);
              removeAcquiredTrigger(t,instanceId);
            }
          }
 else {
            releaseAcquiredTrigger(null,t);
          }
        }
      }
 catch (      JobPersistenceException e) {
        logger.warn("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * <p> Called by the QuartzScheduler before the <code>JobStore</code> is used, in order to give the it a chance to initialize. </p>
 */
@Override public void initialize(ClassLoadHelper loadHelper,SchedulerSignaler schedSignaler){
  logger.debug("String_Node_Str");
  this.schedulerSignaler=schedSignaler;
  this.loadHelper=loadHelper;
  this.writeRetries=Integer.parseInt(IdentityServer.getInstance().getProperty("String_Node_Str","String_Node_Str"));
  if (!isClustered()) {
    cleanUpInstance();
  }
}
Program: 13234
Project: 13234
Buggy source:
@Override public boolean handleEvent(ClusterEvent event){
switch (event.getType()) {
case RECOVERY_INITIATED:
    try {
      AcquiredTriggers triggers=getAcquiredTriggers(instanceId);
      for (      Trigger trigger : triggers.getTriggers()) {
        boolean removed=false;
        int retry=0;
        while (writeRetries == -1 || retry <= writeRetries) {
          try {
            removed=removeAcquiredTrigger(trigger,instanceId);
            break;
          }
 catch (          JobPersistenceException e) {
            logger.debug("String_Node_Str",e);
            retry++;
          }
        }
        if (removed) {
          retry=0;
          while (writeRetries == -1 || retry <= writeRetries) {
            try {
              addWaitingTrigger(trigger);
              break;
            }
 catch (            JobPersistenceException e) {
              logger.debug("String_Node_Str",e);
              retry++;
            }
          }
        }
        logger.info("String_Node_Str",trigger.getName(),instanceId);
        clusterManager.renewRecoveryLease(instanceId);
      }
      schedulerSignaler.signalSchedulingChange(0L);
    }
 catch (    JobPersistenceException e) {
      logger.warn("String_Node_Str",instanceId,e.getMessage());
      return false;
    }
  break;
case INSTANCE_FAILED:
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean handleEvent(ClusterEvent event){
  String eventInstanceId=event.getInstanceId();
switch (event.getType()) {
case RECOVERY_INITIATED:
    try {
      AcquiredTriggers triggers=getAcquiredTriggers(eventInstanceId);
      for (      Trigger trigger : triggers.getTriggers()) {
        boolean removed=false;
        int retry=0;
        while (writeRetries == -1 || retry <= writeRetries) {
          try {
            removed=removeAcquiredTrigger(trigger,eventInstanceId);
            break;
          }
 catch (          JobPersistenceException e) {
            logger.debug("String_Node_Str",e);
            retry++;
          }
        }
        if (removed) {
          retry=0;
          while (writeRetries == -1 || retry <= writeRetries) {
            try {
              addWaitingTrigger(trigger);
              break;
            }
 catch (            JobPersistenceException e) {
              logger.debug("String_Node_Str",e);
              retry++;
            }
          }
        }
        logger.info("String_Node_Str",trigger.getName(),eventInstanceId);
        clusterManager.renewRecoveryLease(eventInstanceId);
      }
      schedulerSignaler.signalSchedulingChange(0L);
    }
 catch (    JobPersistenceException e) {
      logger.warn("String_Node_Str",eventInstanceId,e.getMessage());
      return false;
    }
  break;
case INSTANCE_FAILED:
break;
case INSTANCE_RUNNING:
cleanUpInstance();
break;
}
return true;
}
Program: 13237
Project: 13237
Buggy source:
private void handleAuthenticate(ServerContext context,ActionRequest request,ResultHandler<JsonValue> handler) throws ResourceException, IOException {
  try {
    final ConnectorFacade facade=getConnectorFacade0(handler,AuthenticationApiOp.class);
    if (null == facade) {
      return;
    }
    final JsonValue params=new JsonValue(request.getAdditionalParameters());
    final String username=params.get("String_Node_Str").required().asString();
    final String password=params.get("String_Node_Str").required().asString();
    OperationOptions operationOptions=operations.get(AuthenticationApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
    Uid uid=facade.authenticate(objectClassInfoHelper.getObjectClass(),username,new GuardedString(password.toCharArray()),operationOptions);
    JsonValue result=new JsonValue(new HashMap<String,Object>());
    result.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
    if (null != uid.getRevision()) {
      result.put(Resource.FIELD_CONTENT_REVISION,uid.getRevision());
    }
    handler.handleResult(result);
  }
 catch (  ConnectorException e) {
    handleConnectorException(context,request,e,null,null,null,handler,ContextUtil.isExternal(context) ? activityLogger : NullActivityLogger.INSTANCE);
  }
}

Fixed version (ground truth):
private void handleAuthenticate(ServerContext context,ActionRequest request,ResultHandler<JsonValue> handler) throws ResourceException, IOException {
  try {
    final ConnectorFacade facade=getConnectorFacade0(handler,AuthenticationApiOp.class);
    if (null == facade) {
      return;
    }
    final JsonValue params=new JsonValue(request.getAdditionalParameters());
    final String username=params.get("String_Node_Str").required().asString();
    final String password=params.get("String_Node_Str").required().asString();
    OperationOptions operationOptions=operations.get(AuthenticationApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
    Uid uid=facade.authenticate(objectClassInfoHelper.getObjectClass(),username,new GuardedString(password.toCharArray()),operationOptions);
    JsonValue result=new JsonValue(new HashMap<String,Object>());
    result.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
    if (null != uid.getRevision()) {
      result.put(Resource.FIELD_CONTENT_REVISION,uid.getRevision());
    }
    handler.handleResult(result);
  }
 catch (  ConnectorException e) {
    handleConnectorException(context,request,e,null,null,null,null,handler,ContextUtil.isExternal(context) ? activityLogger : NullActivityLogger.INSTANCE);
  }
}
Program: 13239
Project: 13239
Buggy source:
@Override public void deleteInstance(ServerContext context,String resourceId,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    final ConnectorFacade facade=getConnectorFacade0(handler,DeleteApiOp.class);
    if (null == facade) {
      return;
    }
    final Uid uid=request.getRevision() != null ? new Uid(resourceId,request.getRevision()) : new Uid(resourceId);
    Resource before=getCurrentResource(facade,uid,null);
    OperationOptions operationOptions=operations.get(DeleteApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
    facade.delete(objectClassInfoHelper.getObjectClass(),uid,operationOptions);
    JsonValue result=new JsonValue(new HashMap<String,Object>());
    result.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
    if (null != uid.getRevision()) {
      result.put(Resource.FIELD_CONTENT_REVISION,uid.getRevision());
    }
    activityLogger.log(context,RequestType.DELETE,"String_Node_Str",getSource(objectClass,uid.getUidValue()),before.getContent(),null,Status.SUCCESS);
    handler.handleResult(new Resource(uid.getUidValue(),uid.getRevision(),result));
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  ConnectorException e) {
    handleConnectorException(context,request,e,resourceId,null,null,handler,activityLogger);
  }
catch (  JsonValueException e) {
    handler.handleError(new BadRequestException(e.getMessage(),e));
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}

Fixed version (ground truth):
@Override public void deleteInstance(ServerContext context,String resourceId,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    final ConnectorFacade facade=getConnectorFacade0(handler,DeleteApiOp.class);
    if (null == facade) {
      return;
    }
    final Uid uid=request.getRevision() != null ? new Uid(resourceId,request.getRevision()) : new Uid(resourceId);
    Resource before=getCurrentResource(facade,uid,null);
    OperationOptions operationOptions=operations.get(DeleteApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
    facade.delete(objectClassInfoHelper.getObjectClass(),uid,operationOptions);
    JsonValue result=new JsonValue(new HashMap<String,Object>());
    result.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
    if (null != uid.getRevision()) {
      result.put(Resource.FIELD_CONTENT_REVISION,uid.getRevision());
    }
    activityLogger.log(context,RequestType.DELETE,"String_Node_Str",getSource(objectClass,uid.getUidValue()),before.getContent(),null,Status.SUCCESS);
    handler.handleResult(new Resource(uid.getUidValue(),uid.getRevision(),result));
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  ConnectorException e) {
    handleConnectorException(context,request,e,getSource(objectClass),resourceId,null,null,handler,activityLogger);
  }
catch (  JsonValueException e) {
    handler.handleError(new BadRequestException(e.getMessage(),e));
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13241
Project: 13241
Buggy source:
@Activate protected void activate(ComponentContext context) throws ServletException, NamespaceException {
  logger.info("String_Node_Str",context.getProperties());
  JsonValue config=new JSONEnhancedConfig().getConfigurationAsJson(context);
  if (!config.get(CONFIG_ENABLED).isNull() && Boolean.FALSE.equals(config.get(CONFIG_ENABLED).asBoolean())) {
    logger.info("String_Node_Str");
    return;
  }
 else   if (config.get(CONFIG_CONTEXT_ROOT) == null || config.get(CONFIG_CONTEXT_ROOT).isNull()) {
    logger.info("String_Node_Str");
    return;
  }
 else   if (config.get(CONFIG_BUNDLE) == null || config.get(CONFIG_BUNDLE).isNull() || !config.get(CONFIG_BUNDLE).isMap() || config.get(CONFIG_BUNDLE).get(CONFIG_NAME) == null || config.get(CONFIG_BUNDLE).get(CONFIG_NAME).isNull()) {
    logger.info("String_Node_Str");
    return;
  }
 else   if (config.get(CONFIG_BUNDLE) == null || config.get(CONFIG_BUNDLE).isNull() || !config.get(CONFIG_BUNDLE).isMap() || config.get(CONFIG_BUNDLE).get(CONFIG_RESOURCE_DIR) == null || config.get(CONFIG_BUNDLE).get(CONFIG_RESOURCE_DIR).isNull()) {
    logger.info("String_Node_Str");
    return;
  }
  bundleName=config.get(CONFIG_BUNDLE).get(CONFIG_NAME).asString();
  resourceDir=prependSlash(config.get(CONFIG_BUNDLE).get(CONFIG_RESOURCE_DIR).asString());
  contextRoot=prependSlash(config.get(CONFIG_CONTEXT_ROOT).asString());
  if (bundleName != null) {
    for (    Bundle aBundle : context.getBundleContext().getBundles()) {
      if (bundleName.equals(aBundle.getSymbolicName())) {
        this.bundle=aBundle;
        break;
      }
    }
  }
  if (bundle == null) {
    logger.info("String_Node_Str" + bundleName + "String_Node_Str");
  }
  bundleListener=new BundleListener(){
    public void bundleChanged(    BundleEvent event){
      if (event == null) {
        logger.debug("String_Node_Str",bundleName);
        return;
      }
      Bundle bundle=event.getBundle();
      if (bundle != null && bundle.getSymbolicName() != null && bundle.getSymbolicName().equals(bundleName)) {
        if (event.getType() == BundleEvent.STARTED) {
          ResourceServlet.this.bundle=bundle;
          logger.info("String_Node_Str" + bundleName + "String_Node_Str");
        }
 else         if (event.getType() == BundleEvent.STOPPED) {
          ResourceServlet.this.bundle=null;
          logger.info("String_Node_Str" + bundleName + "String_Node_Str");
        }
      }
    }
  }
;
  context.getBundleContext().addBundleListener(bundleListener);
  extFolders=new ArrayList<String>();
  extFolders.add("String_Node_Str");
  extFolders.add("String_Node_Str");
  extFolders.add("String_Node_Str");
  extFolders.add("String_Node_Str");
  Dictionary<String,Object> props=new Hashtable<String,Object>();
  webContainer.registerServlet(contextRoot,this,props,webContainer.getDefaultSharedHttpContext());
  logger.debug("String_Node_Str",contextRoot);
}

Fixed version (ground truth):
@Activate protected void activate(ComponentContext context) throws ServletException, NamespaceException {
  logger.info("String_Node_Str",context.getProperties());
  init(context);
}
Program: 13242
Project: 13242
Buggy source:
@Deactivate protected void deactivate(ComponentContext context){
  if (bundleListener != null) {
    bundle.getBundleContext().removeBundleListener(bundleListener);
  }
  webContainer.unregister(contextRoot);
  logger.debug("String_Node_Str",contextRoot);
}

Fixed version (ground truth):
@Deactivate protected void deactivate(ComponentContext context){
  logger.info("String_Node_Str",context.getProperties());
  clear();
}
Program: 13247
Project: 13247
Buggy source:
public void evaluateOnFailure(final ServerContext context,final ScriptState state,final ResourceException error,final ResultHandler<?> handler) throws ResourceException {
  if (onFailure != null) {
    ScriptEntry scriptEntry=onFailure.getRight();
    if (!scriptEntry.isActive()) {
      throw new ServiceUnavailableException("String_Node_Str" + onFailure.getRight().getName());
    }
    Script script=populateScript(scriptEntry,context,state.request);
    script.put("String_Node_Str",error.toJsonValue().asMap());
    try {
      state.state=script.eval();
    }
 catch (    Throwable t) {
      logger.debug("String_Node_Str",onFailure.getRight().getName(),onFailure.getLeft(),t);
      throw Utils.adapt(t);
    }
  }
}

Fixed version (ground truth):
public void evaluateOnFailure(final ServerContext context,final ScriptState state,final ResourceException error,final ResultHandler<?> handler) throws ResourceException {
  if (onFailure != null) {
    ScriptEntry scriptEntry=onFailure.getRight();
    if (!scriptEntry.isActive()) {
      throw new ServiceUnavailableException("String_Node_Str" + onFailure.getRight().getName());
    }
    Script script=populateScript(scriptEntry,context,state.request);
    script.put("String_Node_Str",error.includeCauseInJsonValue().toJsonValue().asMap());
    try {
      state.state=script.eval();
    }
 catch (    Throwable t) {
      logger.debug("String_Node_Str",onFailure.getRight().getName(),onFailure.getLeft(),t);
      throw Utils.adapt(t);
    }
  }
}
Program: 13248
Project: 13248
Buggy source:
@Override public void createInstance(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  try {
    if (objectClassInfoHelper.isCreateable()) {
      if (null == request.getNewResourceId()) {
        final ConnectorFacade facade=getConnectorFacade0(handler,CreateApiOp.class);
        if (null == facade) {
          return;
        }
        final Set<Attribute> createAttributes=objectClassInfoHelper.getCreateAttributes(request,cryptoService);
        OperationOptions operationOptions=operations.get(CreateApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
        Uid uid=facade.create(objectClassInfoHelper.getObjectClass(),AttributeUtil.filterUid(createAttributes),operationOptions);
        returnResource(request,handler,facade,uid);
      }
 else {
        final ResourceException e=new NotSupportedException("String_Node_Str");
        handler.handleError(e);
      }
    }
 else {
      final ResourceException e=new NotSupportedException("String_Node_Str" + objectClassInfoHelper.getObjectClass());
      handler.handleError(e);
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  ConnectorException e) {
    handleConnectorException(context,request,e,request.getNewResourceId(),request.getContent(),null,handler,activityLogger);
  }
catch (  JsonValueException e) {
    handler.handleError(new BadRequestException(e.getMessage()));
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage()));
  }
}

Fixed version (ground truth):
@Override public void createInstance(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  try {
    if (objectClassInfoHelper.isCreateable()) {
      if (null == request.getNewResourceId()) {
        final ConnectorFacade facade=getConnectorFacade0(handler,CreateApiOp.class);
        if (null == facade) {
          return;
        }
        final Set<Attribute> createAttributes=objectClassInfoHelper.getCreateAttributes(request,cryptoService);
        OperationOptions operationOptions=operations.get(CreateApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
        Uid uid=facade.create(objectClassInfoHelper.getObjectClass(),AttributeUtil.filterUid(createAttributes),operationOptions);
        returnResource(request,handler,facade,uid);
      }
 else {
        final ResourceException e=new NotSupportedException("String_Node_Str");
        handler.handleError(e);
      }
    }
 else {
      final ResourceException e=new NotSupportedException("String_Node_Str" + objectClassInfoHelper.getObjectClass());
      handler.handleError(e);
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  ConnectorException e) {
    handleConnectorException(context,request,e,request.getNewResourceId(),request.getContent(),null,handler,activityLogger);
  }
catch (  JsonValueException e) {
    handler.handleError(new BadRequestException(e.getMessage(),e));
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13250
Project: 13250
Buggy source:
public void handlePatch(ServerContext context,PatchRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handlePatch(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handlePatch(ServerContext context,PatchRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handlePatch(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13251
Project: 13251
Buggy source:
public void handleRead(ServerContext context,ReadRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleRead(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handleRead(ServerContext context,ReadRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleRead(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13252
Project: 13252
Buggy source:
public void handleQuery(ServerContext context,QueryRequest request,QueryResultHandler handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleQuery(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handleQuery(ServerContext context,QueryRequest request,QueryResultHandler handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleQuery(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13253
Project: 13253
Buggy source:
public void handleUpdate(ServerContext context,UpdateRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleUpdate(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handleUpdate(ServerContext context,UpdateRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleUpdate(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13254
Project: 13254
Buggy source:
public void handleDelete(ServerContext context,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleDelete(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handleDelete(ServerContext context,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleDelete(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13255
Project: 13255
Buggy source:
@Override public void deleteInstance(ServerContext context,String resourceId,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    final ConnectorFacade facade=getConnectorFacade0(handler,DeleteApiOp.class);
    if (null == facade) {
      return;
    }
    OperationOptions operationOptions=operations.get(DeleteApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
    Uid uid=null != request.getRevision() ? new Uid(resourceId,request.getRevision()) : new Uid(resourceId);
    facade.delete(objectClassInfoHelper.getObjectClass(),uid,operationOptions);
    JsonValue result=new JsonValue(new HashMap<String,Object>());
    result.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
    if (null != uid.getRevision()) {
      result.put(Resource.FIELD_CONTENT_REVISION,uid.getRevision());
    }
    handler.handleResult(new Resource(uid.getUidValue(),uid.getRevision(),result));
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  ConnectorException e) {
    handleConnectorException(context,request,e,resourceId,null,null,handler,activityLogger);
  }
catch (  JsonValueException e) {
    handler.handleError(new BadRequestException(e.getMessage()));
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage()));
  }
}

Fixed version (ground truth):
@Override public void deleteInstance(ServerContext context,String resourceId,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    final ConnectorFacade facade=getConnectorFacade0(handler,DeleteApiOp.class);
    if (null == facade) {
      return;
    }
    OperationOptions operationOptions=operations.get(DeleteApiOp.class).build(jsonConfiguration,objectClassInfoHelper).build();
    Uid uid=null != request.getRevision() ? new Uid(resourceId,request.getRevision()) : new Uid(resourceId);
    facade.delete(objectClassInfoHelper.getObjectClass(),uid,operationOptions);
    JsonValue result=new JsonValue(new HashMap<String,Object>());
    result.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
    if (null != uid.getRevision()) {
      result.put(Resource.FIELD_CONTENT_REVISION,uid.getRevision());
    }
    handler.handleResult(new Resource(uid.getUidValue(),uid.getRevision(),result));
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  ConnectorException e) {
    handleConnectorException(context,request,e,resourceId,null,null,handler,activityLogger);
  }
catch (  JsonValueException e) {
    handler.handleError(new BadRequestException(e.getMessage(),e));
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13256
Project: 13256
Buggy source:
@Override public void actionCollection(ServerContext context,ActionRequest request,ResultHandler<JsonValue> handler){
  try {
switch (request.getActionAsEnum(ObjectClassAction.class)) {
case authenticate:
      handleAuthenticate(context,request,handler);
    break;
case liveSync:
  handleLiveSync(context,request,handler);
break;
default :
throw new BadRequestException("String_Node_Str" + request.getAction());
}
}
 catch (ResourceException e) {
handler.handleError(e);
}
catch (JsonValueException e) {
handler.handleError(new BadRequestException(e));
}
catch (Exception e) {
handler.handleError(new InternalServerErrorException(e));
}
}

Fixed version (ground truth):
@Override public void actionCollection(ServerContext context,ActionRequest request,ResultHandler<JsonValue> handler){
  try {
switch (request.getActionAsEnum(ObjectClassAction.class)) {
case authenticate:
      handleAuthenticate(context,request,handler);
    break;
case liveSync:
  handleLiveSync(context,request,handler);
break;
default :
throw new BadRequestException("String_Node_Str" + request.getAction());
}
}
 catch (ResourceException e) {
handler.handleError(e);
}
catch (JsonValueException e) {
handler.handleError(new BadRequestException(e.getMessage(),e));
}
catch (Exception e) {
handler.handleError(new InternalServerErrorException(e.getMessage(),e));
}
}
Program: 13257
Project: 13257
Buggy source:
public void handleAction(ServerContext context,ActionRequest request,ResultHandler<JsonValue> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleAction(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handleAction(ServerContext context,ActionRequest request,ResultHandler<JsonValue> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleAction(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13259
Project: 13259
Buggy source:
public void handleCreate(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleCreate(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
public void handleCreate(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  try {
    String objectClass=getObjectClass(context);
    RequestHandler delegate=objectClassHandlers.get(objectClass);
    if (null != delegate) {
      delegate.handleCreate(context,request,handler);
    }
 else {
      handler.handleError(new NotFoundException("String_Node_Str" + objectClass));
    }
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13263
Project: 13263
Buggy source:
/** 
 * TODO: Description.
 * @param query TODO.
 * @return TODO.
 * @throws SynchronizationException TODO.
 */
private Map<String,Object> queryTargetObjectSet(Map<String,Object> query) throws SynchronizationException {
  try {
    Map<String,Object> result=new HashMap<String,Object>(1);
    final Collection<Object> list=new HashSet<Object>();
    result.put(QueryResult.FIELD_RESULT,list);
    QueryRequest r=Requests.newQueryRequest(targetObjectSet);
    r.setQueryId((String)query.get("String_Node_Str" + QueryRequest.FIELD_QUERY_ID));
    r.setQueryExpression((String)query.get("String_Node_Str" + QueryRequest.FIELD_QUERY_EXPRESSION));
    for (    Map.Entry<String,Object> e : query.entrySet()) {
      r.setAdditionalQueryParameter(e.getKey(),String.valueOf(e.getValue()));
    }
    service.getRouter().getConnection().query(service.getRouter(),r,new QueryResultHandler(){
      @Override public void handleError(      ResourceException error){
      }
      @Override public boolean handleResource(      Resource resource){
        list.add(resource.getContent().asMap());
        return true;
      }
      @Override public void handleResult(      QueryResult result){
      }
    }
);
    return result;
  }
 catch (  ResourceException ose) {
    throw new SynchronizationException(ose);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param query TODO.
 * @return TODO.
 * @throws SynchronizationException TODO.
 */
private Map<String,Object> queryTargetObjectSet(Map<String,Object> query) throws SynchronizationException {
  try {
    Map<String,Object> result=new HashMap<String,Object>(1);
    final Collection<Object> list=new ArrayList<Object>();
    result.put(QueryResult.FIELD_RESULT,list);
    QueryRequest r=Requests.newQueryRequest(targetObjectSet);
    r.setQueryId((String)query.get("String_Node_Str" + QueryRequest.FIELD_QUERY_ID));
    r.setQueryExpression((String)query.get("String_Node_Str" + QueryRequest.FIELD_QUERY_EXPRESSION));
    for (    Map.Entry<String,Object> e : query.entrySet()) {
      r.setAdditionalQueryParameter(e.getKey(),String.valueOf(e.getValue()));
    }
    service.getRouter().getConnection().query(service.getRouter(),r,new QueryResultHandler(){
      @Override public void handleError(      ResourceException error){
      }
      @Override public boolean handleResource(      Resource resource){
        list.add(resource.getContent().asMap());
        return true;
      }
      @Override public void handleResult(      QueryResult result){
      }
    }
);
    return result;
  }
 catch (  ResourceException ose) {
    throw new SynchronizationException(ose);
  }
}
Program: 13264
Project: 13264
Buggy source:
@Override public void createInstance(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  logger.debug("String_Node_Str",name,request.getNewResourceId());
  try {
    JsonValue value=decrypt(request.getContent());
    execScript(context,"String_Node_Str",onCreate,value);
    onStore(context,value);
    CreateRequest createRequest=Requests.copyOfCreateRequest(request);
    createRequest.setContent(value);
    createRequest.setResourceName(repoId(null));
    Resource _new=context.getConnection().create(context,createRequest);
    ActivityLog.log(context,request.getRequestType(),"String_Node_Str",managedId(_new.getId()),null,_new.getContent(),Status.SUCCESS);
    onCreate(context,managedId(_new.getId()),_new);
    handler.handleResult(_new);
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}

Fixed version (ground truth):
@Override public void createInstance(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  String id=request.getNewResourceId();
  JsonValue content=request.getContent();
  if (!content.get(Resource.FIELD_CONTENT_ID).isNull()) {
    id=content.get(Resource.FIELD_CONTENT_ID).asString();
  }
  logger.debug("String_Node_Str",name,id);
  try {
    JsonValue value=decrypt(request.getContent());
    execScript(context,"String_Node_Str",onCreate,value);
    onStore(context,value);
    CreateRequest createRequest=Requests.copyOfCreateRequest(request);
    createRequest.setNewResourceId(id);
    createRequest.setContent(value);
    createRequest.setResourceName(repoId(null));
    Resource _new=context.getConnection().create(context,createRequest);
    ActivityLog.log(context,request.getRequestType(),"String_Node_Str",managedId(_new.getId()),null,_new.getContent(),Status.SUCCESS);
    onCreate(context,managedId(_new.getId()),_new);
    handler.handleResult(_new);
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e));
  }
}
Program: 13266
Project: 13266
Buggy source:
/** 
 * Source synchronization
 * @param id fully-qualified source object identifier.
 * @param value null to have it query the source state if applicable,or JsonValue to tell it the value of the existing source to sync
 * @param sourceDeleted Whether the source object has been deleted
 * @throws SynchronizationException if sync-ing fails.
 */
private void doSourceSync(String id,JsonValue value,boolean sourceDeleted,JsonValue oldValue) throws SynchronizationException {
  LOGGER.trace("String_Node_Str",id,(value == null ? "String_Node_Str" : "String_Node_Str"));
  String localId=id.substring(sourceObjectSet.length() + 1);
  SourceSyncOperation op=new SourceSyncOperation();
  op.oldValue=oldValue;
  if (sourceDeleted) {
    op.sourceObjectAccessor=new LazyObjectAccessor(service,sourceObjectSet,localId,null);
  }
 else   if (value != null) {
    value.put("String_Node_Str",localId);
    op.sourceObjectAccessor=new LazyObjectAccessor(service,sourceObjectSet,localId,value);
  }
 else {
    op.sourceObjectAccessor=new LazyObjectAccessor(service,sourceObjectSet,localId);
  }
  op.sync();
}

Fixed version (ground truth):
/** 
 * Source synchronization
 * @param id fully-qualified source object identifier.
 * @param value null to have it query the source state if applicable,or JsonValue to tell it the value of the existing source to sync
 * @param sourceDeleted Whether the source object has been deleted
 * @throws SynchronizationException if sync-ing fails.
 */
private void doSourceSync(String id,JsonValue value,boolean sourceDeleted,JsonValue oldValue) throws SynchronizationException {
  LOGGER.trace("String_Node_Str",id,(value == null ? "String_Node_Str" : "String_Node_Str"));
  String localId=id.substring(sourceObjectSet.length() + 2);
  SourceSyncOperation op=new SourceSyncOperation();
  op.oldValue=oldValue;
  if (sourceDeleted) {
    op.sourceObjectAccessor=new LazyObjectAccessor(service,sourceObjectSet,localId,null);
  }
 else   if (value != null) {
    value.put("String_Node_Str",localId);
    op.sourceObjectAccessor=new LazyObjectAccessor(service,sourceObjectSet,localId,value);
  }
 else {
    op.sourceObjectAccessor=new LazyObjectAccessor(service,sourceObjectSet,localId);
  }
  op.sync();
}
Program: 13267
Project: 13267
Buggy source:
/** 
 * Returns   {@code true} if the specified object identifer is in this mapping's sourceobject set.
 */
private boolean isSourceObject(String id){
  return (id.startsWith(sourceObjectSet + '/') && id.length() > sourceObjectSet.length() + 1);
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the specified object identifer is in this mapping's sourceobject set.
 */
private boolean isSourceObject(String id){
  return (id.startsWith("String_Node_Str" + sourceObjectSet + '/') && id.length() > sourceObjectSet.length() + 2);
}