nus-yam/ex-repair huggingface dataset:
Program: 13183
Project: 13183
Buggy source:
public void start(BundleContext context){
  logger.debug("String_Node_Str");
  Hashtable<String,String> logHandlerProp=new Hashtable<String,String>();
  logHandlerProp.put("String_Node_Str","String_Node_Str");
  logHandlerProp.put("String_Node_Str","String_Node_Str");
  OsgiLogHandler logHandler=new OsgiLogHandler(context);
  context.registerService(OsgiLogHandler.class.getName(),logHandler,logHandlerProp);
  logger.debug("String_Node_Str");
  Hashtable<String,String> persistenceProp=new Hashtable<String,String>();
  persistenceProp.put("String_Node_Str","String_Node_Str");
  RepoPersistenceManager persistenceMgr=new RepoPersistenceManager(context);
  context.registerService(new String[]{PersistenceManager.class.getName(),ConfigPersisterMarker.class.getName()},persistenceMgr,persistenceProp);
  logger.debug("String_Node_Str");
  JSONConfigInstaller installer=new JSONConfigInstaller();
  installer.start(context);
  Hashtable<String,String> installerProp=new Hashtable<String,String>();
  installerProp.put("String_Node_Str","String_Node_Str");
  context.registerService(new String[]{ArtifactInstaller.class.getName(),ConfigurationListener.class.getName()},installer,installerProp);
  logger.debug("String_Node_Str");
  logger.info("String_Node_Str",IdentityServer.getInstance().getServerRoot());
}

Fixed version (ground truth):
public void start(BundleContext context){
  logger.debug("String_Node_Str");
  Hashtable<String,String> logHandlerProp=new Hashtable<String,String>();
  logHandlerProp.put("String_Node_Str","String_Node_Str");
  logHandlerProp.put("String_Node_Str","String_Node_Str");
  OsgiLogHandler logHandler=new OsgiLogHandler(context);
  context.registerService(OsgiLogHandler.class.getName(),logHandler,logHandlerProp);
  logger.debug("String_Node_Str");
  Hashtable<String,String> persistenceProp=new Hashtable<String,String>();
  persistenceProp.put("String_Node_Str","String_Node_Str");
  RepoPersistenceManager persistenceMgr=new RepoPersistenceManager(context);
  context.registerService(new String[]{PersistenceManager.class.getName(),ConfigPersisterMarker.class.getName()},persistenceMgr,persistenceProp);
  logger.debug("String_Node_Str");
  JSONConfigInstaller installer=new JSONConfigInstaller();
  installer.start(context);
  Hashtable<String,String> installerProp=new Hashtable<String,String>();
  installerProp.put("String_Node_Str","String_Node_Str");
  context.registerService(new String[]{ArtifactInstaller.class.getName(),ConfigurationListener.class.getName()},installer,installerProp);
  logger.debug("String_Node_Str");
  PaxWeb.configurePaxWebProperties();
  logger.info("String_Node_Str",IdentityServer.getInstance().getServerRoot());
}
Program: 13184
Project: 13184
Buggy source:
/** 
 * @return Requested OpenIDM configuration property
 */
public static void add(Object connector){
  int port=-1;
  if (connector instanceof SslConnector) {
    SslConnector sslConnector=(SslConnector)connector;
    port=sslConnector.getPort();
    boolean needClientAuth=sslConnector.getNeedClientAuth();
    if (needClientAuth == false) {
      logger.warn("String_Node_Str",port);
    }
 else {
      logger.info("String_Node_Str",port);
    }
  }
 else   if (connector instanceof Connector) {
    Connector plainConnector=(Connector)connector;
    port=plainConnector.getPort();
    logger.warn("String_Node_Str",port);
  }
 else {
    logger.warn("String_Node_Str",connector);
    return;
  }
  clientAuthOnly.add(Integer.valueOf(port));
  setProperty();
}

Fixed version (ground truth):
/** 
 * Sets openidm.auth.clientauthonlyports if client auth is required.
 * @param serverConnector A instance of the ServerConnector
 */
public static void add(ServerConnector serverConnector){
  int port=-1;
  SslConnectionFactory sslConnectionFactory=(SslConnectionFactory)serverConnector.getConnectionFactory("String_Node_Str");
  port=serverConnector.getPort();
  if (sslConnectionFactory != null) {
    boolean needClientAuth=sslConnectionFactory.getSslContextFactory().getNeedClientAuth();
    if (needClientAuth == false) {
      logger.warn("String_Node_Str",port);
    }
 else {
      logger.info("String_Node_Str",port);
    }
  }
  clientAuthOnly.add(Integer.valueOf(port));
  setProperty();
}
Program: 13185
Project: 13185
Buggy source:
public ClusterManagerThread(long checkinInterval,long checkinOffset){
  this.checkinInterval=checkinInterval;
}

Fixed version (ground truth):
public ClusterManagerThread(long checkinInterval,long checkinOffset){
  this.checkinInterval=checkinInterval;
  this.checkinOffset=checkinOffset;
}
Program: 13186
Project: 13186
Buggy source:
@BeforeMethod public void setUp() throws ResourceException {
  final ClusterManager clusterManager=new ClusterManager();
  final MockRepositoryService mockRepoService=new MockRepositoryService();
  clusterManager.repoService=mockRepoService;
  clusterManager.connectionFactory=Resources.newInternalConnectionFactory(mockRepoService);
  clusterManager.init(config);
  clusterHandler=clusterManager;
  clusterService=clusterManager;
  clusterService.startClusterManagement();
}

Fixed version (ground truth):
@BeforeMethod public void setUp() throws ResourceException, InterruptedException {
  final ClusterManager clusterManager=new ClusterManager();
  final MockRepositoryService mockRepoService=new MockRepositoryService();
  clusterManager.repoService=mockRepoService;
  clusterManager.connectionFactory=Resources.newInternalConnectionFactory(mockRepoService);
  clusterManager.init(config);
  clusterHandler=clusterManager;
  clusterService=clusterManager;
  clusterService.startClusterManagement();
  Thread.sleep(1000);
}
Program: 13187
Project: 13187
Buggy source:
public JsonValue build(ConnectorObject source) throws Exception {
  JsonValue result=objectClassInfoHelper.build(source,cryptoService).getContent();
  resetUid(source.getUid(),result);
  if (null != source.getUid().getRevision()) {
    result.put(Resource.FIELD_CONTENT_REVISION,source.getUid().getRevision());
  }
  return result;
}

Fixed version (ground truth):
public JsonValue build(ConnectorObject source) throws Exception {
  JsonValue result=objectClassInfoHelper.build(source,cryptoService).getContent();
  resetUid(source.getUid(),result);
  if (null != source.getUid().getRevision()) {
    result.put(ResourceResponse.FIELD_CONTENT_REVISION,source.getUid().getRevision());
  }
  return result;
}
Program: 13188
Project: 13188
Buggy source:
public void resetUid(Uid uid,JsonValue target){
  if (null != uid && null != target) {
    target.put(Resource.FIELD_CONTENT_ID,uid.getUidValue());
  }
}

Fixed version (ground truth):
public void resetUid(Uid uid,JsonValue target){
  if (null != uid && null != target) {
    target.put(ResourceResponse.FIELD_CONTENT_ID,uid.getUidValue());
  }
}
Program: 13191
Project: 13191
Buggy source:
public RouteBuilder verify(){
  if ((null == collection) && (null == singleton) && (null == handler)) {
    throw new NullPointerException("String_Node_Str");
  }
  if (uriTemplate != null && uriTemplate.toString().length() > 0) {
    throw new NullPointerException("String_Node_Str");
  }
  return this;
}

Fixed version (ground truth):
public RouteBuilder verify(){
  if ((null == collection) && (null == singleton) && (null == handler)) {
    throw new NullPointerException("String_Node_Str");
  }
  if (uriTemplate == null || uriTemplate.toString().length() == 0) {
    throw new NullPointerException("String_Node_Str");
  }
  return this;
}
Program: 13195
Project: 13195
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ReconQueryResult querySource(int pageSize,String pagingCookie) throws SynchronizationException {
  return query(sourceQuery.get("String_Node_Str").asString(),sourceQuery,reconContext,((Collection<String>)Collections.synchronizedList(new ArrayList<String>())),true,QuerySide.SOURCE,pageSize,pagingCookie);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ReconQueryResult querySource(int pageSize,String pagingCookie) throws SynchronizationException {
  return query(sourceQuery.get("String_Node_Str").asString(),sourceQuery,reconContext,Collections.synchronizedSet(new LinkedHashSet<String>()),true,QuerySide.SOURCE,pageSize,pagingCookie);
}
Program: 13196
Project: 13196
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ResultIterable queryTarget() throws SynchronizationException {
  return query(targetQuery.get("String_Node_Str").asString(),targetQuery,reconContext,Collections.synchronizedList(new ArrayList<String>()),reconContext.getObjectMapping().getLinkType().isTargetCaseSensitive(),QuerySide.TARGET,0,null).getResultIterable();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ResultIterable queryTarget() throws SynchronizationException {
  return query(targetQuery.get("String_Node_Str").asString(),targetQuery,reconContext,Collections.synchronizedSet(new LinkedHashSet<String>()),reconContext.getObjectMapping().getLinkType().isTargetCaseSensitive(),QuerySide.TARGET,0,null).getResultIterable();
}
Program: 13197
Project: 13197
Buggy source:
private void logAuditAccessEntry(final ServerContext context,final AuditState state,final ResourceException resourceException){
  if (!context.containsContext(HttpContext.class) || context.containsContext(InternalServerContext.class)) {
    return;
  }
  final long elapsedTime=System.currentTimeMillis() - state.actionTime;
  final AccessAuditEventBuilder accessAuditEventBuilder=new AccessAuditEventBuilder();
  accessAuditEventBuilder.forHttpCrestRequest(context,state.request).authorizationIdFromSecurityContext(context).serverFromHttpContext(context).resourceOperationFromRequest(state.request).clientFromHttpContext(context).transactionIdFromRootContext(context).timestamp(System.currentTimeMillis()).authenticationFromSecurityContext(context).eventName("String_Node_Str");
  if (resourceException != null) {
    accessAuditEventBuilder.responseWithMessage("String_Node_Str" + String.valueOf(resourceException.getCode()),elapsedTime,resourceException.getReason());
  }
 else {
    accessAuditEventBuilder.response("String_Node_Str",elapsedTime);
  }
  try {
    final CreateRequest createRequest=Requests.newCreateRequest("String_Node_Str",accessAuditEventBuilder.toEvent().getValue());
    connectionFactory.getConnection().create(context,createRequest);
  }
 catch (  ResourceException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void logAuditAccessEntry(final ServerContext context,final AuditState state,final ResourceException resourceException){
  if (!context.containsContext(HttpContext.class) || context.containsContext(InternalServerContext.class)) {
    return;
  }
  final long elapsedTime=System.currentTimeMillis() - state.actionTime;
  final AccessAuditEventBuilder accessAuditEventBuilder=new AccessAuditEventBuilder();
  accessAuditEventBuilder.forHttpCrestRequest(context,state.request).authorizationIdFromSecurityContext(context).serverFromHttpContext(context).resourceOperationFromRequest(state.request).clientFromHttpContext(context).transactionIdFromRootContext(context).timestamp(System.currentTimeMillis()).authenticationFromSecurityContext(context).eventName("String_Node_Str");
  if (resourceException != null) {
    accessAuditEventBuilder.responseWithMessage("String_Node_Str" + String.valueOf(resourceException.getCode()),elapsedTime,resourceException.getReason());
  }
 else {
    accessAuditEventBuilder.response("String_Node_Str",elapsedTime);
  }
  try {
    final CreateRequest createRequest=Requests.newCreateRequest("String_Node_Str",accessAuditEventBuilder.toEvent().getValue());
    connectionFactory.getConnection().create(new InternalServerContext(context),createRequest);
  }
 catch (  ResourceException e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 13198
Project: 13198
Buggy source:
/** 
 * Calls buildAuditEvent() and invokes the request to the audit path.
 * @param connectionFactory
 * @throws ResourceException
 */
public final void log(ConnectionFactory connectionFactory) throws ResourceException {
  try {
    T eventBuilder=getEventBuilder().transactionIdFromRootContext(context).timestamp(System.currentTimeMillis()).eventName(getEventName()).authenticationFromSecurityContext(context).action(null != syncOperation ? syncOperation.action : null).exception(exception).linkQualifier(linkQualifier).mapping(mapping).message(message).messageDetail(messageDetail).situation(null != syncOperation ? syncOperation.situation : null).sourceObjectId(sourceObjectId).status(status).targetObjectId(targetObjectId);
    AuditEvent auditEvent=applyCustomFields(eventBuilder).toEvent();
    connectionFactory.getConnection().create(new ServerContext(context),Requests.newCreateRequest(getAuditPath(),auditEvent.getValue()));
  }
 catch (  ResourceException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InternalServerErrorException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Calls buildAuditEvent() and invokes the request to the audit path.
 * @param connectionFactory
 * @throws ResourceException
 */
public final void log(ConnectionFactory connectionFactory) throws ResourceException {
  try {
    T eventBuilder=getEventBuilder().transactionIdFromRootContext(context).timestamp(System.currentTimeMillis()).eventName(getEventName()).authenticationFromSecurityContext(context).action(null != syncOperation ? syncOperation.action : null).exception(exception).linkQualifier(linkQualifier).mapping(mapping).message(message).messageDetail(messageDetail).situation(null != syncOperation ? syncOperation.situation : null).sourceObjectId(sourceObjectId).status(status).targetObjectId(targetObjectId);
    AuditEvent auditEvent=applyCustomFields(eventBuilder).toEvent();
    connectionFactory.getConnection().create(context,Requests.newCreateRequest(getAuditPath(),auditEvent.getValue()));
  }
 catch (  ResourceException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InternalServerErrorException(e.getMessage(),e);
  }
}
Program: 13201
Project: 13201
Buggy source:
public ActivitiResource(ProcessEngine engine){
  resources.addRoute("String_Node_Str",new ProcessDefinitionResource(engine));
  resources.addRoute("String_Node_Str",new TaskDefinitionResource(engine));
  resources.addRoute("String_Node_Str",new ProcessInstanceResource(engine,engine.getHistoryService().createHistoricProcessInstanceQuery().unfinished()));
  resources.addRoute("String_Node_Str",new ProcessInstanceResource(engine,engine.getHistoryService().createHistoricProcessInstanceQuery()));
  resources.addRoute("String_Node_Str",new TaskInstanceResource(engine));
  resources.addRoute("String_Node_Str",new TaskInstanceHistoryResource(engine));
}

Fixed version (ground truth):
public ActivitiResource(ProcessEngine engine){
  resources.addRoute("String_Node_Str",new ProcessDefinitionResource(engine));
  resources.addRoute("String_Node_Str",new TaskDefinitionResource(engine));
  resources.addRoute("String_Node_Str",new ProcessInstanceResource(engine,new Function<ProcessEngine,HistoricProcessInstanceQuery,NeverThrowsException>(){
    public HistoricProcessInstanceQuery apply(    ProcessEngine engine){
      return engine.getHistoryService().createHistoricProcessInstanceQuery().unfinished();
    }
  }
));
  resources.addRoute("String_Node_Str",new ProcessInstanceResource(engine,new Function<ProcessEngine,HistoricProcessInstanceQuery,NeverThrowsException>(){
    public HistoricProcessInstanceQuery apply(    ProcessEngine engine){
      return engine.getHistoryService().createHistoricProcessInstanceQuery();
    }
  }
));
  resources.addRoute("String_Node_Str",new TaskInstanceResource(engine));
  resources.addRoute("String_Node_Str",new TaskInstanceHistoryResource(engine));
}
Program: 13202
Project: 13202
Buggy source:
@Override public void queryCollection(ServerContext context,QueryRequest request,QueryResultHandler handler){
  try {
    Authentication.setAuthenticatedUserId(context.asContext(SecurityContext.class).getAuthenticationId());
    if (ActivitiConstants.QUERY_ALL_IDS.equals(request.getQueryId())) {
      for (      HistoricProcessInstance i : historicProcessInstanceQuery.list()) {
        Map<String,Object> value=MAPPER.convertValue(i,Map.class);
        value.put(ActivitiConstants.ACTIVITI_PROCESSDEFINITIONRESOURCENAME,getProcessDefName(i));
        Resource r=new Resource(i.getId(),null,new JsonValue(value));
        handler.handleResource(r);
      }
      handler.handleResult(new QueryResult());
    }
 else     if (ActivitiConstants.QUERY_FILTERED.equals(request.getQueryId())) {
      setProcessInstanceParams(historicProcessInstanceQuery,request);
      setSortKeys(historicProcessInstanceQuery,request);
      for (      HistoricProcessInstance processinstance : historicProcessInstanceQuery.list()) {
        Map<String,Object> value=MAPPER.convertValue(processinstance,Map.class);
        value.put(ActivitiConstants.ACTIVITI_PROCESSDEFINITIONRESOURCENAME,getProcessDefName(processinstance));
        handler.handleResource(new Resource(processinstance.getId(),null,new JsonValue(value)));
      }
      handler.handleResult(new QueryResult());
    }
 else {
      handler.handleError(new BadRequestException("String_Node_Str"));
    }
  }
 catch (  Exception ex) {
    handler.handleError(new InternalServerErrorException(ex.getMessage(),ex));
  }
}

Fixed version (ground truth):
@Override public void queryCollection(ServerContext context,QueryRequest request,QueryResultHandler handler){
  try {
    Authentication.setAuthenticatedUserId(context.asContext(SecurityContext.class).getAuthenticationId());
    final HistoricProcessInstanceQuery query=queryFunction.apply(processEngine);
    if (ActivitiConstants.QUERY_ALL_IDS.equals(request.getQueryId())) {
      for (      HistoricProcessInstance i : query.list()) {
        Map<String,Object> value=MAPPER.convertValue(i,Map.class);
        value.put(ActivitiConstants.ACTIVITI_PROCESSDEFINITIONRESOURCENAME,getProcessDefName(i));
        Resource r=new Resource(i.getId(),null,new JsonValue(value));
        handler.handleResource(r);
      }
      handler.handleResult(new QueryResult());
    }
 else     if (ActivitiConstants.QUERY_FILTERED.equals(request.getQueryId())) {
      setProcessInstanceParams(query,request);
      setSortKeys(query,request);
      for (      HistoricProcessInstance processinstance : query.list()) {
        Map<String,Object> value=MAPPER.convertValue(processinstance,Map.class);
        value.put(ActivitiConstants.ACTIVITI_PROCESSDEFINITIONRESOURCENAME,getProcessDefName(processinstance));
        handler.handleResource(new Resource(processinstance.getId(),null,new JsonValue(value)));
      }
      handler.handleResult(new QueryResult());
    }
 else {
      handler.handleError(new BadRequestException("String_Node_Str"));
    }
  }
 catch (  Exception ex) {
    handler.handleError(new InternalServerErrorException(ex.getMessage(),ex));
  }
}
Program: 13203
Project: 13203
Buggy source:
public ProcessInstanceResource(ProcessEngine processEngine,HistoricProcessInstanceQuery query){
  this.processEngine=processEngine;
  historicProcessInstanceQuery=query;
}

Fixed version (ground truth):
/** 
 * Create a new ProcessInstanceResource.
 * @param processEngine Activiti engine used for this resource
 * @param queryFunction a Function to provide a the properly-configured HistoricProcessInstanceQuery as appropriatefor the type of query issued by this CollectionResourceProvider; allows this class to support both present and historic queries
 */
public ProcessInstanceResource(ProcessEngine processEngine,Function<ProcessEngine,HistoricProcessInstanceQuery,NeverThrowsException> queryFunction){
  this.processEngine=processEngine;
  this.queryFunction=queryFunction;
}
Program: 13204
Project: 13204
Buggy source:
private JsonValue applyDefaultMappings(JsonValue source,JsonValue oldSource,JsonValue target,JsonValue existingTarget,String linkQualifier) throws SynchronizationException {
  JsonValue result=null;
  if (defaultMapping != null) {
    Map<String,Object> queryScope=new HashMap<String,Object>();
    queryScope.put("String_Node_Str",source.asMap());
    if (oldSource != null) {
      queryScope.put("String_Node_Str",oldSource.asMap());
    }
    queryScope.put("String_Node_Str",target.asMap());
    queryScope.put("String_Node_Str",config.asMap());
    queryScope.put("String_Node_Str",existingTarget.asMap());
    queryScope.put("String_Node_Str",linkQualifier);
    try {
      result=json(defaultMapping.exec(queryScope));
    }
 catch (    ScriptThrownException ste) {
      throw toSynchronizationException(ste,name,"String_Node_Str");
    }
catch (    ScriptException se) {
      LOGGER.debug("String_Node_Str",name,se);
      throw new SynchronizationException(se);
    }
  }
  return result;
}

Fixed version (ground truth):
private JsonValue applyDefaultMappings(JsonValue source,JsonValue oldSource,JsonValue target,JsonValue existingTarget,String linkQualifier) throws SynchronizationException {
  JsonValue result=null;
  if (defaultMapping != null) {
    Map<String,Object> queryScope=new HashMap<String,Object>();
    queryScope.put("String_Node_Str",source.asMap());
    if (oldSource != null) {
      queryScope.put("String_Node_Str",oldSource.asMap());
    }
    queryScope.put("String_Node_Str",target.asMap());
    queryScope.put("String_Node_Str",config.asMap());
    queryScope.put("String_Node_Str",existingTarget.copy().asMap());
    queryScope.put("String_Node_Str",linkQualifier);
    try {
      result=json(defaultMapping.exec(queryScope));
    }
 catch (    ScriptThrownException ste) {
      throw toSynchronizationException(ste,name,"String_Node_Str");
    }
catch (    ScriptException se) {
      LOGGER.debug("String_Node_Str",name,se);
      throw new SynchronizationException(se);
    }
  }
  return result;
}
Program: 13205
Project: 13205
Buggy source:
public boolean setAttributesToGet(final OperationOptionsBuilder builder,final List<JsonPointer> fieldFilters){
  boolean returnResource=false;
  if (null != fieldFilters) {
    for (    JsonPointer field : fieldFilters) {
      if (field.isEmpty() || returnResource || !Resource.FIELD_CONTENT_ID.equals(field.leaf())|| !Resource.FIELD_CONTENT_REVISION.equals(field.leaf())) {
        returnResource=true;
      }
      if (field.isEmpty()) {
        builder.setAttributesToGet(attributesReturnedByDefault);
        continue;
      }
      for (      AttributeInfoHelper attribute : attributes) {
        if (attribute.getName().equals(field.leaf()) && attribute.getAttributeInfo().isReadable()) {
          builder.setAttributesToGet(attribute.getAttributeInfo().getName());
          break;
        }
      }
    }
  }
  return returnResource;
}

Fixed version (ground truth):
public boolean setAttributesToGet(final OperationOptionsBuilder builder,final List<JsonPointer> fieldFilters){
  boolean returnResource=false;
  if (null != fieldFilters) {
    Set<String> attrsToGet=new HashSet();
    for (    JsonPointer field : fieldFilters) {
      if (field.isEmpty() || returnResource || !Resource.FIELD_CONTENT_ID.equals(field.leaf())|| !Resource.FIELD_CONTENT_REVISION.equals(field.leaf())) {
        returnResource=true;
      }
      if (field.isEmpty()) {
        attrsToGet.addAll(attributesReturnedByDefault);
        continue;
      }
      for (      AttributeInfoHelper attribute : attributes) {
        if (attribute.getName().equals(field.leaf()) && attribute.getAttributeInfo().isReadable()) {
          attrsToGet.add(attribute.getAttributeInfo().getName());
          break;
        }
      }
    }
    builder.setAttributesToGet(attrsToGet);
  }
  return returnResource;
}
Program: 13206
Project: 13206
Buggy source:
/** 
 * Stores a KeyPair (associated with a CSR request on the specified alias) in the repository.
 * @param alias the alias from the CSR
 * @param keyPair the KeyPair object
 * @throws JsonResourceException
 */
protected void storeKeyPair(String alias,KeyPair keyPair) throws ResourceException {
  try {
    JsonValue keyPairValue=new JsonValue(new HashMap<String,Object>());
    keyPairValue.put("String_Node_Str",toPem(keyPair));
    JsonValue encrypted=getCryptoService().encrypt(keyPairValue,cryptoCipher,cryptoAlias);
    JsonValue keyMap=new JsonValue(new HashMap<String,Object>());
    keyMap.put("String_Node_Str",encrypted);
    storeInRepo(KEYS_CONTAINER,alias,keyMap);
  }
 catch (  Exception e) {
    throw ResourceException.getException(ResourceException.INTERNAL_ERROR,e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Stores a KeyPair (associated with a CSR request on the specified alias) in the repository.
 * @param alias the alias from the CSR
 * @param keyPair the KeyPair object
 * @throws JsonResourceException
 */
protected void storeKeyPair(String alias,KeyPair keyPair) throws ResourceException {
  try {
    JsonValue keyPairValue=new JsonValue(new HashMap<String,Object>());
    keyPairValue.put("String_Node_Str",toPem(keyPair));
    JsonValue encrypted=getCryptoService().encrypt(keyPairValue,cryptoCipher,cryptoAlias);
    JsonValue keyMap=new JsonValue(new HashMap<String,Object>());
    keyMap.put("String_Node_Str",encrypted.getObject());
    storeInRepo(KEYS_CONTAINER,alias,keyMap);
  }
 catch (  Exception e) {
    throw ResourceException.getException(ResourceException.INTERNAL_ERROR,e.getMessage(),e);
  }
}
Program: 13207
Project: 13207
Buggy source:
public void unregisterConfigService(ScheduleConfigService service){
synchronized (CONFIG_SERVICE_LOCK) {
    if (!started) {
      configMap.remove(service.getJobName());
    }
 else {
    }
  }
}

Fixed version (ground truth):
/** 
 * Unregisters a   {@link ScheduleConfigService} and deletes the schedule if the scheduler has been started.
 * @param service the {@link ScheduleConfigService} to register.
 * @throws SchedulerException
 * @throws ParseException
 */
public void unregisterConfigService(ScheduleConfigService service){
synchronized (CONFIG_SERVICE_LOCK) {
    logger.debug("String_Node_Str");
    configMap.remove(service.getJobName());
    if (started) {
      try {
        logger.debug("String_Node_Str",service.getJobName());
        deleteSchedule(service.getJobName());
      }
 catch (      SchedulerException e) {
        logger.warn("String_Node_Str",service.getJobName(),e.getMessage());
      }
    }
  }
}
Program: 13208
Project: 13208
Buggy source:
public void registerConfigService(ScheduleConfigService service) throws SchedulerException, ParseException {
synchronized (CONFIG_SERVICE_LOCK) {
    logger.debug("String_Node_Str");
    configMap.put(service.getJobName(),service);
    if (!started) {
      logger.debug("String_Node_Str",service.getJobName());
    }
 else {
      logger.debug("String_Node_Str",service.getJobName());
      try {
        addSchedule(service.getScheduleConfig(),service.getJobName(),true);
      }
 catch (      ObjectAlreadyExistsException e) {
        logger.debug("String_Node_Str",service.getJobName());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Registers a   {@link ScheduleConfigService} and adds the scheduler if the scheduler has been started.
 * @param service the {@link ScheduleConfigService} to register.
 * @throws SchedulerException
 * @throws ParseException
 */
public void registerConfigService(ScheduleConfigService service) throws SchedulerException, ParseException {
synchronized (CONFIG_SERVICE_LOCK) {
    logger.debug("String_Node_Str");
    configMap.put(service.getJobName(),service);
    if (!started) {
      logger.debug("String_Node_Str",service.getJobName());
    }
 else {
      try {
        logger.debug("String_Node_Str",service.getJobName());
        addSchedule(service.getScheduleConfig(),service.getJobName(),true);
      }
 catch (      ObjectAlreadyExistsException e) {
        logger.debug("String_Node_Str",service.getJobName());
      }
    }
  }
}
Program: 13209
Project: 13209
Buggy source:
/** 
 * Deletes a schedule from the scheduler
 * @throws SchedulerException 
 */
public void deleteSchedule(String jobName) throws SchedulerException {
  if (inMemoryScheduler.getJobDetail(jobName,GROUP_NAME) != null) {
    inMemoryScheduler.deleteJob(jobName,GROUP_NAME);
  }
  if (persistentScheduler.getJobDetail(jobName,GROUP_NAME) != null) {
    persistentScheduler.deleteJob(jobName,GROUP_NAME);
  }
}

Fixed version (ground truth):
/** 
 * Deletes a schedule from the scheduler
 * @param jobName the job name associated with this schedule.
 * @throws SchedulerException 
 */
public void deleteSchedule(String jobName) throws SchedulerException {
  if (inMemoryScheduler.getJobDetail(jobName,GROUP_NAME) != null) {
    inMemoryScheduler.deleteJob(jobName,GROUP_NAME);
  }
  if (persistentScheduler.getJobDetail(jobName,GROUP_NAME) != null) {
    persistentScheduler.deleteJob(jobName,GROUP_NAME);
  }
}
Program: 13210
Project: 13210
Buggy source:
/** 
 * @see org.forgerock.openidm.repo.jdbc.TableHandler#read(java.lang.String,java.lang.String,java.lang.String,java.sql.Connection)
 */
@Override public Resource read(String fullId,String type,String localId,Connection connection) throws NotFoundException, SQLException, IOException, InternalServerErrorException {
  JsonValue resultValue=null;
  Resource result=null;
  PreparedStatement readStatement=null;
  ResultSet rs=null;
  try {
    readStatement=queries.getPreparedStatement(connection,readQueryStr);
    logger.debug("String_Node_Str",readStatement,fullId);
    readStatement.setString(1,localId);
    logger.debug("String_Node_Str",readStatement);
    rs=readStatement.executeQuery();
    if (rs.next()) {
      resultValue=explicitMapping.mapToJsonValue(rs,Mapping.getColumnNames(rs));
      JsonValue rev=resultValue.get("String_Node_Str");
      logger.debug("String_Node_Str",new Object[]{fullId,rev,resultValue});
      result=new Resource(fullId,rev.asString(),resultValue);
    }
 else {
      throw new NotFoundException("String_Node_Str" + fullId + "String_Node_Str"+ type);
    }
  }
  finally {
    CleanupHelper.loggedClose(rs);
    CleanupHelper.loggedClose(readStatement);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @see org.forgerock.openidm.repo.jdbc.TableHandler#read(java.lang.String,java.lang.String,java.lang.String,java.sql.Connection)
 */
@Override public Resource read(String fullId,String type,String localId,Connection connection) throws NotFoundException, SQLException, IOException, InternalServerErrorException {
  JsonValue resultValue=null;
  Resource result=null;
  PreparedStatement readStatement=null;
  ResultSet rs=null;
  try {
    readStatement=queries.getPreparedStatement(connection,readQueryStr);
    logger.debug("String_Node_Str",readStatement,fullId);
    readStatement.setString(1,localId);
    logger.debug("String_Node_Str",readStatement);
    rs=readStatement.executeQuery();
    if (rs.next()) {
      resultValue=explicitMapping.mapToJsonValue(rs,Mapping.getColumnNames(rs));
      JsonValue rev=resultValue.get("String_Node_Str");
      logger.debug("String_Node_Str",new Object[]{fullId,rev,resultValue});
      result=new Resource(localId,rev.asString(),resultValue);
    }
 else {
      throw new NotFoundException("String_Node_Str" + fullId + "String_Node_Str"+ type);
    }
  }
  finally {
    CleanupHelper.loggedClose(rs);
    CleanupHelper.loggedClose(readStatement);
  }
  return result;
}
Program: 13211
Project: 13211
Buggy source:
/** 
 * Returns a JsonValue map representing a certificate
 * @param alias  the certificate alias
 * @param cert  The certificate
 * @return a JsonValue map representing the certificate
 * @throws Exception
 */
protected JsonValue returnCertificate(String alias,Certificate cert) throws Exception {
  JsonValue content=new JsonValue(new LinkedHashMap<String,Object>());
  content.put(Resource.FIELD_CONTENT_ID,alias);
  content.put("String_Node_Str",cert.getType());
  content.put("String_Node_Str",getCertString(cert));
  content.put("String_Node_Str",getKeyMap(cert.getPublicKey()));
  if (cert instanceof X509Certificate) {
    Map<String,Object> issuer=new HashMap<String,Object>();
    X500Name name=X500Name.getInstance(PrincipalUtil.getIssuerX509Principal((X509Certificate)cert));
    issuer.put("String_Node_Str",name.getRDNs(BCStyle.C)[0].getFirst().getValue().toString());
    issuer.put("String_Node_Str",name.getRDNs(BCStyle.ST)[0].getFirst().getValue().toString());
    issuer.put("String_Node_Str",name.getRDNs(BCStyle.L)[0].getFirst().getValue().toString());
    issuer.put("String_Node_Str",name.getRDNs(BCStyle.OU)[0].getFirst().getValue().toString());
    issuer.put("String_Node_Str",name.getRDNs(BCStyle.O)[0].getFirst().getValue().toString());
    issuer.put("String_Node_Str",name.getRDNs(BCStyle.CN)[0].getFirst().getValue().toString());
    content.put("String_Node_Str",issuer);
    content.put("String_Node_Str",((X509Certificate)cert).getNotBefore());
    content.put("String_Node_Str",((X509Certificate)cert).getNotAfter());
  }
  return content;
}

Fixed version (ground truth):
/** 
 * Returns a JsonValue map representing a certificate
 * @param alias  the certificate alias
 * @param cert  The certificate
 * @return a JsonValue map representing the certificate
 * @throws Exception
 */
protected JsonValue returnCertificate(String alias,Certificate cert) throws Exception {
  JsonValue content=new JsonValue(new LinkedHashMap<String,Object>());
  content.put(Resource.FIELD_CONTENT_ID,alias);
  content.put("String_Node_Str",cert.getType());
  content.put("String_Node_Str",getCertString(cert));
  content.put("String_Node_Str",getKeyMap(cert.getPublicKey()));
  if (cert instanceof X509Certificate) {
    Map<String,Object> issuer=new HashMap<String,Object>();
    X500Name name=X500Name.getInstance(PrincipalUtil.getIssuerX509Principal((X509Certificate)cert));
    addAttributeToIssuer(issuer,name,"String_Node_Str",BCStyle.C);
    addAttributeToIssuer(issuer,name,"String_Node_Str",BCStyle.ST);
    addAttributeToIssuer(issuer,name,"String_Node_Str",BCStyle.L);
    addAttributeToIssuer(issuer,name,"String_Node_Str",BCStyle.OU);
    addAttributeToIssuer(issuer,name,"String_Node_Str",BCStyle.O);
    addAttributeToIssuer(issuer,name,"String_Node_Str",BCStyle.CN);
    content.put("String_Node_Str",issuer);
    content.put("String_Node_Str",((X509Certificate)cert).getNotBefore());
    content.put("String_Node_Str",((X509Certificate)cert).getNotAfter());
  }
  return content;
}
Program: 13212
Project: 13212
Buggy source:
public boolean evaluateOnResponse(final ServerContext context,final ScriptState state,final Resource resource) throws ResourceException {
  if (onResponse != null) {
    ScriptEntry scriptEntry=onResponse.getRight();
    if (!scriptEntry.isActive()) {
      throw new ServiceUnavailableException("String_Node_Str" + onResponse.getRight().getName());
    }
    Script script=populateScript(scriptEntry,context,state.request);
    script.put("String_Node_Str",resource);
    try {
      state.state=script.eval();
    }
 catch (    Throwable t) {
      logger.debug("String_Node_Str",onResponse.getRight().getName(),onResponse.getLeft(),t);
      throw Utils.adapt(t);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean evaluateOnResponse(final ServerContext context,final ScriptState state,final Resource resource) throws ResourceException {
  if (onResponse != null) {
    ScriptEntry scriptEntry=onResponse.getRight();
    if (!scriptEntry.isActive()) {
      throw new ServiceUnavailableException("String_Node_Str" + onResponse.getRight().getName());
    }
    Script script=populateScript(scriptEntry,context,state.request);
    script.put("String_Node_Str",resource.getContent());
    try {
      state.state=script.eval();
    }
 catch (    Throwable t) {
      logger.debug("String_Node_Str",onResponse.getRight().getName(),onResponse.getLeft(),t);
      throw Utils.adapt(t);
    }
  }
  return true;
}
Program: 13213
Project: 13213
Buggy source:
public Attribute filterAttribute(JsonPointer field,Object valueAssertion){
  if (field.size() != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String attributeName=field.leaf();
  for (  AttributeInfoHelper ai : attributes) {
    if (ai.getName().equals(attributeName)) {
      return ai.build(valueAssertion);
    }
  }
  return null;
}

Fixed version (ground truth):
public Attribute filterAttribute(JsonPointer field,Object valueAssertion){
  if (field.size() != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String attributeName=field.leaf();
  for (  AttributeInfoHelper ai : attributes) {
    if (ai.getName().equals(attributeName)) {
      return ai.build(valueAssertion);
    }
  }
  throw new IllegalArgumentException("String_Node_Str" + attributeName + "String_Node_Str"+ objectClass);
}
Program: 13214
Project: 13214
Buggy source:
@Override public void handleCreate(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  try {
    String id=request.getNewResourceId() == null ? UUID.randomUUID().toString() : trimTrailingSlash(request.getNewResourceId());
    Map<String,Object> object=request.getContent().asMap();
    object.put("String_Node_Str",id);
    if (jobExists(id)) {
      throw new ConflictException("String_Node_Str");
    }
    ScheduleConfig scheduleConfig=new ScheduleConfig(new JsonValue(object));
    if (scheduleConfig.isEnabled() == null) {
      scheduleConfig.setEnabled(true);
    }
    if (scheduleConfig.isPersisted() == null) {
      scheduleConfig.setPersisted(true);
    }
    addSchedule(scheduleConfig,id,false);
    handler.handleResult(new Resource(id,null,getSchedule(request.getResourceName())));
  }
 catch (  ParseException e) {
    handler.handleError(new BadRequestException(e.getMessage(),e));
  }
catch (  ObjectAlreadyExistsException e) {
    handler.handleError(new ConflictException(e.getMessage(),e));
  }
catch (  SchedulerException e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
catch (  JsonException e) {
    handler.handleError(new BadRequestException("String_Node_Str",e));
  }
catch (  Throwable t) {
    handler.handleError(ResourceUtil.adapt(t));
  }
}

Fixed version (ground truth):
@Override public void handleCreate(ServerContext context,CreateRequest request,ResultHandler<Resource> handler){
  try {
    String id=request.getNewResourceId() == null ? UUID.randomUUID().toString() : request.getNewResourceId();
    Map<String,Object> object=request.getContent().asMap();
    object.put("String_Node_Str",id);
    if (jobExists(id)) {
      throw new ConflictException("String_Node_Str");
    }
    ScheduleConfig scheduleConfig=new ScheduleConfig(new JsonValue(object));
    if (scheduleConfig.isEnabled() == null) {
      scheduleConfig.setEnabled(true);
    }
    if (scheduleConfig.isPersisted() == null) {
      scheduleConfig.setPersisted(true);
    }
    addSchedule(scheduleConfig,id,false);
    handler.handleResult(new Resource(id,null,getSchedule(id)));
  }
 catch (  ParseException e) {
    handler.handleError(new BadRequestException(e.getMessage(),e));
  }
catch (  ObjectAlreadyExistsException e) {
    handler.handleError(new ConflictException(e.getMessage(),e));
  }
catch (  SchedulerException e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
catch (  JsonException e) {
    handler.handleError(new BadRequestException("String_Node_Str",e));
  }
catch (  Throwable t) {
    handler.handleError(ResourceUtil.adapt(t));
  }
}
Program: 13216
Project: 13216
Buggy source:
@Override public void handleDelete(ServerContext context,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    if (request.getResourceNameObject().isEmpty()) {
      throw new BadRequestException("String_Node_Str");
    }
    if (jobExists(request.getResourceName(),true)) {
      persistentScheduler.deleteJob(request.getResourceName(),GROUP_NAME);
    }
 else     if (jobExists(request.getResourceName(),false)) {
      inMemoryScheduler.deleteJob(request.getResourceName(),GROUP_NAME);
    }
 else {
      throw new NotFoundException("String_Node_Str");
    }
    handler.handleResult(new Resource(request.getResourceName(),null,new JsonValue(null)));
  }
 catch (  JsonException e) {
    handler.handleError(new BadRequestException("String_Node_Str",e));
  }
catch (  SchedulerException e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
catch (  Throwable t) {
    handler.handleError(ResourceUtil.adapt(t));
  }
}

Fixed version (ground truth):
@Override public void handleDelete(ServerContext context,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    if (request.getResourceNameObject().isEmpty()) {
      throw new BadRequestException("String_Node_Str");
    }
    Scheduler scheduler=getScheduler(request.getResourceName());
    JsonValue schedule=getSchedule(scheduler,request.getResourceName());
    scheduler.deleteJob(request.getResourceName(),GROUP_NAME);
    handler.handleResult(new Resource(request.getResourceName(),null,schedule));
  }
 catch (  JsonException e) {
    handler.handleError(new BadRequestException("String_Node_Str",e));
  }
catch (  SchedulerException e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
catch (  Throwable t) {
    handler.handleError(ResourceUtil.adapt(t));
  }
}
Program: 13217
Project: 13217
Buggy source:
/** 
 * Returns the Scheduler corresponding to whether the supplied schedule configuration is persistent.
 * @param scheduleConfig    The schedule configuration
 * @return                  The Scheduler
 * @throws SchedulerException
 */
private Scheduler getScheduler(ScheduleConfig scheduleConfig) throws SchedulerException {
  if (scheduleConfig.getPersisted()) {
    return persistentScheduler;
  }
  return inMemoryScheduler;
}

Fixed version (ground truth):
/** 
 * Returns the scheduler containing the schedule with the supplied name.
 * @param scheduleName the name of the schedule
 * @return the Scheduler
 * @throws SchedulerException
 * @throws NotFoundException
 */
private Scheduler getScheduler(String scheduleName) throws SchedulerException, NotFoundException {
  if (jobExists(scheduleName,true)) {
    return persistentScheduler;
  }
 else   if (jobExists(scheduleName,false)) {
    return inMemoryScheduler;
  }
 else {
    throw new NotFoundException("String_Node_Str");
  }
}
Program: 13218
Project: 13218
Buggy source:
@Override public void handleRead(ServerContext context,ReadRequest request,ResultHandler<Resource> handler){
  try {
    if (request.getResourceNameObject().isEmpty()) {
      throw new BadRequestException("String_Node_Str");
    }
    Scheduler scheduler=null;
    if (jobExists(request.getResourceName(),true)) {
      scheduler=persistentScheduler;
    }
 else     if (jobExists(request.getResourceName(),false)) {
      scheduler=inMemoryScheduler;
    }
 else {
      throw new NotFoundException("String_Node_Str");
    }
    JobDetail job=scheduler.getJobDetail(request.getResourceName(),GROUP_NAME);
    JobDataMap dataMap=job.getJobDataMap();
    ScheduleConfig config=new ScheduleConfig(parseStringified((String)dataMap.get(CONFIG)));
    Map<String,Object> resultMap=(Map<String,Object>)config.getConfig().getObject();
    resultMap.put("String_Node_Str",request.getResourceName());
    handler.handleResult(new Resource(request.getResourceName(),null,new JsonValue(resultMap)));
  }
 catch (  SchedulerException e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
catch (  Throwable t) {
    handler.handleError(ResourceUtil.adapt(t));
  }
}

Fixed version (ground truth):
@Override public void handleRead(ServerContext context,ReadRequest request,ResultHandler<Resource> handler){
  try {
    if (request.getResourceNameObject().isEmpty()) {
      throw new BadRequestException("String_Node_Str");
    }
    Scheduler scheduler=getScheduler(request.getResourceName());
    JsonValue schedule=getSchedule(scheduler,request.getResourceName());
    handler.handleResult(new Resource(request.getResourceName(),null,schedule));
  }
 catch (  SchedulerException e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
catch (  Throwable t) {
    handler.handleError(ResourceUtil.adapt(t));
  }
}
Program: 13222
Project: 13222
Buggy source:
@Override public void handleDelete(ServerContext context,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    String rev=request.getRevision();
    delete(request.getResourceNameObject(),rev);
    Resource resource=new Resource(request.getResourceName(),null,new JsonValue(null));
    handler.handleResult(resource);
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}

Fixed version (ground truth):
@Override public void handleDelete(ServerContext context,DeleteRequest request,ResultHandler<Resource> handler){
  try {
    String rev=request.getRevision();
    Resource resource=new Resource(request.getResourceName(),null,delete(request.getResourceNameObject(),rev));
    handler.handleResult(resource);
  }
 catch (  ResourceException e) {
    handler.handleError(e);
  }
catch (  Exception e) {
    handler.handleError(new InternalServerErrorException(e.getMessage(),e));
  }
}
Program: 13225
Project: 13225
Buggy source:
protected Map<QueryDefinition,String> initializeQueryMap(){
  Map<QueryDefinition,String> result=super.initializeQueryMap();
  String typeTable=dbSchemaName == null ? "String_Node_Str" : dbSchemaName + "String_Node_Str";
  String mainTable=dbSchemaName == null ? mainTableName : dbSchemaName + "String_Node_Str" + mainTableName;
  String propertyTable=dbSchemaName == null ? propTableName : dbSchemaName + "String_Node_Str" + propTableName;
  result.put(QueryDefinition.UPDATEQUERYSTR,"String_Node_Str" + mainTable + "String_Node_Str");
  result.put(QueryDefinition.CREATEQUERYSTR,"String_Node_Str" + mainTable + "String_Node_Str");
  result.put(QueryDefinition.PROPDELETEQUERYSTR,"String_Node_Str" + propertyTable + "String_Node_Str"+ mainTableName+ "String_Node_Str"+ mainTable+ "String_Node_Str"+ typeTable+ "String_Node_Str");
  return result;
}

Fixed version (ground truth):
protected Map<QueryDefinition,String> initializeQueryMap(){
  Map<QueryDefinition,String> result=super.initializeQueryMap();
  String typeTable=dbSchemaName == null ? "String_Node_Str" : dbSchemaName + "String_Node_Str";
  String mainTable=dbSchemaName == null ? mainTableName : dbSchemaName + "String_Node_Str" + mainTableName;
  String propertyTable=dbSchemaName == null ? propTableName : dbSchemaName + "String_Node_Str" + propTableName;
  result.put(QueryDefinition.UPDATEQUERYSTR,"String_Node_Str" + mainTable + "String_Node_Str");
  result.put(QueryDefinition.CREATEQUERYSTR,"String_Node_Str" + mainTable + "String_Node_Str");
  result.put(QueryDefinition.DELETEQUERYSTR,"String_Node_Str" + mainTable + "String_Node_Str"+ typeTable+ "String_Node_Str");
  result.put(QueryDefinition.PROPDELETEQUERYSTR,"String_Node_Str" + propertyTable + "String_Node_Str"+ mainTableName+ "String_Node_Str"+ mainTable+ "String_Node_Str"+ typeTable+ "String_Node_Str");
  return result;
}