nus-yam/ex-repair huggingface dataset:
Program: 91062
Project: 91062
Buggy source:
@Override @Transactional(rollbackFor=Exception.class) public void deleteCollector(String username,Collector collector) throws CodekvastException {
  long organisationId=userDAO.getOrganisationIdForUsername(username);
  Collection<AppId> appIds=agentDAO.getApplicationIds(organisationId,collector.getAppName(),collector.getAppVersion(),collector.getHostname());
  int rowsDeleted=agentDAO.deleteCollectors(organisationId,collector.getAppName(),collector.getAppVersion(),collector.getHostname());
  int numCollectors=agentDAO.getNumCollectors(organisationId,collector.getAppName());
  if (numCollectors == 0) {
    log.debug("String_Node_Str",collector.getAppName());
    rowsDeleted+=agentDAO.deleteApplication(organisationId,collector.getAppName());
  }
 else {
    statisticsService.recalculateApplicationStatistics(organisationId,Collections.singletonList(collector.getAppName()));
  }
  log.info("String_Node_Str",collector,rowsDeleted);
  eventBus.post(agentDAO.createWebSocketMessage(organisationId));
}

Fixed version (ground truth):
@Override @Transactional(rollbackFor=Exception.class) public void deleteCollector(String username,Collector collector) throws CodekvastException {
  long organisationId=userDAO.getOrganisationIdForUsername(username);
  Collection<AppId> appIds=agentDAO.getApplicationIds(organisationId,collector.getAppName(),collector.getAppVersion(),collector.getHostname());
  int rowsDeleted=agentDAO.deleteCollectors(organisationId,collector.getAppName(),collector.getAppVersion(),collector.getHostname());
  int numCollectorsByName=agentDAO.getNumCollectors(organisationId,collector.getAppName());
  int numCollectorsByNameAndVersion=agentDAO.getNumCollectors(organisationId,collector.getAppName(),collector.getAppVersion());
  if (numCollectorsByName == 0) {
    log.debug("String_Node_Str",collector.getAppName());
    rowsDeleted+=agentDAO.deleteApplication(organisationId,collector.getAppName());
  }
 else   if (numCollectorsByNameAndVersion > 0) {
    statisticsService.recalculateApplicationStatistics(organisationId,Collections.singletonList(collector.getAppName()));
  }
 else   if (numCollectorsByNameAndVersion == 0) {
    rowsDeleted+=agentDAO.deleteApplicationStatistics(organisationId,collector.getAppName(),collector.getAppVersion());
  }
  log.info("String_Node_Str",collector,rowsDeleted);
  eventBus.post(agentDAO.createWebSocketMessage(organisationId));
}
Program: 91063
Project: 91063
Buggy source:
@Override @Transactional(readOnly=true,rollbackFor=Exception.class) public GetMethodUsageResponse getMethodUsage(String username,GetMethodUsageRequest request) throws CodekvastException {
  long startedAt=System.currentTimeMillis();
  ReportParameters params=ReportParameters.builder().organisationId(userDAO.getOrganisationIdForUsername(username)).applicationIds(agentDAO.getApplicationIds(userDAO.getOrganisationIdForUsername(username),request.getApplications()).stream().map(AppId::getAppId).collect(Collectors.toList())).jvmIds(reportDAO.getJvmIdsByAppVersions(userDAO.getOrganisationIdForUsername(username),request.getVersions())).bootstrapSeconds(request.getBootstrapSeconds()).usageCycleSeconds(request.getUsageCycleSeconds()).build();
  List<MethodUsageEntry> methods=new ArrayList<>();
  Map<MethodUsageScope,Integer> numMethodsByScope=new HashMap<>();
  for (  MethodUsageScope scope : request.getMethodUsageScopes()) {
    Collection<MethodUsageEntry> methodsForScope=reportDAO.getMethodsForScope(scope,params);
    numMethodsByScope.put(scope,methodsForScope.size());
    methods.addAll(methodsForScope);
  }
  GetMethodUsageResponse response=GetMethodUsageResponse.builder().request(request).numMethods(reportDAO.countMethods(userDAO.getOrganisationIdForUsername(username))).methods(methods.subList(0,Math.min(methods.size(),request.getMaxPreviewRows()))).numMethodsByScope(numMethodsByScope).build();
  log.debug("String_Node_Str",username,request,System.currentTimeMillis() - startedAt);
  return response;
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true,rollbackFor=Exception.class) public GetMethodUsageResponse getMethodUsage(String username,GetMethodUsageRequest request) throws CodekvastException {
  log.debug("String_Node_Str",request,username);
  long startedAt=System.currentTimeMillis();
  ReportParameters params=ReportParameters.builder().organisationId(userDAO.getOrganisationIdForUsername(username)).applicationIds(agentDAO.getApplicationIds(userDAO.getOrganisationIdForUsername(username),request.getApplications()).stream().map(AppId::getAppId).collect(Collectors.toList())).jvmIds(reportDAO.getJvmIdsByAppVersions(userDAO.getOrganisationIdForUsername(username),request.getVersions())).bootstrapSeconds(request.getBootstrapSeconds()).usageCycleSeconds(request.getUsageCycleSeconds()).build();
  List<MethodUsageEntry> methods=new ArrayList<>();
  Map<MethodUsageScope,Integer> numMethodsByScope=new HashMap<>();
  for (  MethodUsageScope scope : request.getMethodUsageScopes()) {
    Collection<MethodUsageEntry> methodsForScope=reportDAO.getMethodsForScope(scope,params);
    numMethodsByScope.put(scope,methodsForScope.size());
    methods.addAll(methodsForScope);
  }
  GetMethodUsageResponse response=GetMethodUsageResponse.builder().request(request).numMethods(reportDAO.countMethods(userDAO.getOrganisationIdForUsername(username))).methods(methods.subList(0,Math.min(methods.size(),request.getMaxPreviewRows()))).numMethodsByScope(numMethodsByScope).build();
  log.debug("String_Node_Str",username,request,System.currentTimeMillis() - startedAt);
  return response;
}
Program: 91064
Project: 91064
Buggy source:
/** 
 * Send the message to the currently logged in users that are affected by the message.
 */
@Subscribe public void onWebSocketMessage(WebSocketMessage message){
  message.getUsernames().stream().filter(webSocketUserPresenceHandler::isPresent).forEach(username -> {
    log.debug("String_Node_Str",message,username);
    messagingTemplate.convertAndSendToUser(username,"String_Node_Str",message);
  }
);
}

Fixed version (ground truth):
/** 
 * Send the message to the currently logged in users that are affected by the message.
 */
@Subscribe public void onWebSocketMessage(WebSocketMessage message){
  message.getUsernames().stream().filter(username -> webSocketUserPresenceHandler.isPresent(username)).forEach(username -> {
    log.debug("String_Node_Str",message,username);
    messagingTemplate.convertAndSendToUser(username,"String_Node_Str",message);
  }
);
}
Program: 91065
Project: 91065
Buggy source:
private Collection<CollectorDisplay> queryCollectors(long organisationId){
  return jdbcTemplate.query("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",new CollectorDisplayRowMapper(),organisationId);
}

Fixed version (ground truth):
private Collection<CollectorDisplay> queryCollectors(long organisationId){
  return jdbcTemplate.query("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",new CollectorDisplayRowMapper(),organisationId);
}
Program: 91066
Project: 91066
Buggy source:
@Override public CollectorDisplay mapRow(ResultSet rs,int rowNum) throws SQLException {
  return CollectorDisplay.builder().appName(rs.getString(1)).appVersion(rs.getString(2)).agentHostname(rs.getString(3)).agentVersion(String.format("String_Node_Str",rs.getString(4),rs.getString(5))).agentUploadIntervalSeconds(rs.getInt(6)).agentClockSkewMillis(rs.getLong(7)).collectorHostname(rs.getString(8)).collectorVersion(String.format("String_Node_Str",rs.getString(9),rs.getString(10))).collectorStartedAtMillis(rs.getLong(11)).dataReceivedAtMillis(rs.getLong(12)).collectorResolutionSeconds(rs.getInt(13)).methodVisibility(rs.getString(14)).build();
}

Fixed version (ground truth):
@Override public CollectorDisplay mapRow(ResultSet rs,int rowNum) throws SQLException {
  return CollectorDisplay.builder().appName(rs.getString(1)).appVersion(rs.getString(2)).agentHostname(rs.getString(3)).agentVersion(String.format("String_Node_Str",rs.getString(4),rs.getString(5))).agentUploadIntervalSeconds(rs.getInt(6)).agentClockSkewMillis(rs.getLong(7)).collectorHostname(rs.getString(8)).collectorVersion(String.format("String_Node_Str",rs.getString(9),rs.getString(10))).collectorResolutionSeconds(rs.getInt(11)).methodVisibility(rs.getString(12)).collectorStartedAtMillis(rs.getLong(13)).dataReceivedAtMillis(rs.getLong(14)).build();
}
Program: 91067
Project: 91067
Buggy source:
@Before public void before() throws Exception {
  eventBus.register(this);
}

Fixed version (ground truth):
@Before public void before() throws Exception {
  eventBus.register(this);
  events.clear();
}
Program: 91068
Project: 91068
Buggy source:
@Test public void testStoreInvocationData() throws Exception {
  agentService.storeJvmData("String_Node_Str",createJvmData(now));
  assertEventsWithinMillis(1,2000L);
  List<SignatureEntry> signatures=new ArrayList<>();
  signatures.add(new SignatureEntry("String_Node_Str",0L,0L,null));
  signatures.add(new SignatureEntry("String_Node_Str",100L,100L,SignatureConfidence.EXACT_MATCH));
  signatures.add(new SignatureEntry("String_Node_Str",200L,200L,SignatureConfidence.EXACT_MATCH));
  SignatureData data=SignatureData.builder().jvmUuid(JVM_UUID).signatures(signatures).build();
  events.clear();
  agentService.storeSignatureData(data);
  assertEventsWithinMillis(2,2000L);
  assertThat(events,hasSize(2));
  assertThat(events.get(0),is(instanceOf(InvocationDataReceivedEvent.class)));
  assertThat(events.get(1),is(instanceOf(ApplicationStatisticsMessage.class)));
}

Fixed version (ground truth):
@Test public void testStoreInvocationData() throws Exception {
  agentService.storeJvmData("String_Node_Str",createJvmData(now));
  assertEventsWithinMillis(2,2000L);
  List<SignatureEntry> signatures=new ArrayList<>();
  signatures.add(new SignatureEntry("String_Node_Str",0L,0L,null));
  signatures.add(new SignatureEntry("String_Node_Str",100L,100L,SignatureConfidence.EXACT_MATCH));
  signatures.add(new SignatureEntry("String_Node_Str",200L,200L,SignatureConfidence.EXACT_MATCH));
  SignatureData data=SignatureData.builder().jvmUuid(JVM_UUID).signatures(signatures).build();
  events.clear();
  agentService.storeSignatureData(data);
  assertEventsWithinMillis(2,2000L);
  assertThat(events,hasSize(2));
  assertThat(events.get(0),is(instanceOf(InvocationDataReceivedEvent.class)));
  assertThat(events.get(1),is(instanceOf(ApplicationStatisticsMessage.class)));
}
Program: 91069
Project: 91069
Buggy source:
@Override public SignatureData storeInvocationData(AppId appId,SignatureData signatureData){
  List<Object[]> args=new ArrayList<>();
  for (  SignatureEntry entry : signatureData.getSignatures()) {
    args.add(new Object[]{appId.getOrganisationId(),appId.getAppId(),appId.getJvmId(),entry.getSignature(),entry.getInvokedAtMillis(),entry.getMillisSinceJvmStart(),entry.getConfidence() == null ? null : entry.getConfidence().ordinal()});
  }
  int[] inserted=jdbcTemplate.batchUpdate("String_Node_Str" + "String_Node_Str" + "String_Node_Str",args);
  List<SignatureEntry> result=new ArrayList<>();
  int i=0;
  for (  SignatureEntry entry : signatureData.getSignatures()) {
    if (inserted[i] > 0) {
      result.add(entry);
    }
    i+=1;
  }
  return SignatureData.builder().jvmUuid(signatureData.getJvmUuid()).signatures(result).build();
}

Fixed version (ground truth):
@Override public SignatureData storeInvocationData(AppId appId,SignatureData signatureData){
  List<Object[]> args=new ArrayList<>();
  for (  SignatureEntry entry : signatureData.getSignatures()) {
    args.add(new Object[]{appId.getOrganisationId(),appId.getAppId(),appId.getJvmId(),entry.getSignature(),entry.getInvokedAtMillis(),entry.getMillisSinceJvmStart(),entry.getConfidence() == null ? null : entry.getConfidence().ordinal()});
  }
  int[] updated=jdbcTemplate.batchUpdate("String_Node_Str" + "String_Node_Str" + "String_Node_Str",args);
  List<SignatureEntry> result=new ArrayList<>();
  int i=0;
  for (  SignatureEntry entry : signatureData.getSignatures()) {
    if (updated[i] > 0) {
      result.add(entry);
    }
    i+=1;
  }
  return SignatureData.builder().jvmUuid(signatureData.getJvmUuid()).signatures(result).build();
}
Program: 91071
Project: 91071
Buggy source:
void put(String jvmUuid,String signature,long invokedAtMillis,long millisSinceJvmStart,SignatureConfidence confidence);

Fixed version (ground truth):
void put(String jvmUuid,long jvmStartedAtMillis,String signature,long invokedAtMillis,SignatureConfidence confidence);
Program: 91072
Project: 91072
Buggy source:
@Override @Transactional public void put(String jvmUuid,String signature,long invokedAtMillis,long millisSinceJvmStart,SignatureConfidence confidence){
  if (signature == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (invokedAtMillis < 0L) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int count=jdbcTemplate.queryForObject("String_Node_Str" + "String_Node_Str",Integer.class,jvmUuid,signature,invokedAtMillis);
  if (count == 0) {
    jdbcTemplate.update("String_Node_Str" + "String_Node_Str",jvmUuid,signature,invokedAtMillis,millisSinceJvmStart,confidence == null ? -1 : confidence.ordinal());
  }
}

Fixed version (ground truth):
@Override @Transactional public void put(String jvmUuid,long jvmStartedAtMillis,String signature,long invokedAtMillis,SignatureConfidence confidence){
  if (jvmUuid == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (jvmStartedAtMillis <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (signature == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (invokedAtMillis < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (invokedAtMillis > 0 && invokedAtMillis < jvmStartedAtMillis) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int count=jdbcTemplate.queryForObject("String_Node_Str" + "String_Node_Str",Integer.class,jvmUuid,signature,invokedAtMillis);
  if (count == 0) {
    long millisSinceJvmStart=invokedAtMillis == 0L ? 0L : invokedAtMillis - jvmStartedAtMillis;
    jdbcTemplate.update("String_Node_Str" + "String_Node_Str",jvmUuid,signature,invokedAtMillis,millisSinceJvmStart,confidence == null ? -1 : confidence.ordinal());
  }
}
Program: 91073
Project: 91073
Buggy source:
@Test public void testPutZeroSignature() throws Exception {
  invocationsCollector.put(jvmUuid1,"String_Node_Str",0L,100L,null);
  List<SignatureEntry> notUploadedInvocations=invocationsCollector.getNotUploadedInvocations(jvmUuid1);
  assertThat(notUploadedInvocations,hasSize(1));
  assertThat(notUploadedInvocations.get(0).getConfidence(),is(nullValue()));
}

Fixed version (ground truth):
@Test public void testPutZeroSignature() throws Exception {
  invocationsCollector.put(jvmUuid1,now,"String_Node_Str",0L,null);
  List<SignatureEntry> notUploadedInvocations=invocationsCollector.getNotUploadedInvocations(jvmUuid1);
  assertThat(notUploadedInvocations,hasSize(1));
  assertThat(notUploadedInvocations.get(0).getConfidence(),is(nullValue()));
}
Program: 91074
Project: 91074
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testPutNegativeSignature() throws Exception {
  invocationsCollector.put(jvmUuid1,"String_Node_Str",-1L,100L,null);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testPutNegativeSignature() throws Exception {
  invocationsCollector.put(jvmUuid1,now,"String_Node_Str",-1L,null);
}
Program: 91075
Project: 91075
Buggy source:
@Test public void testPutSignatureTwiceWithDifferentConfidence(){
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,FOUND_IN_PARENT_CLASS);
  List<SignatureEntry> signatures=invocationsCollector.getNotUploadedInvocations(jvmUuid1);
  assertThat(signatures,hasSize(1));
  assertThat(signatures.get(0).getConfidence(),is(FOUND_IN_PARENT_CLASS));
}

Fixed version (ground truth):
@Test public void testPutSignatureTwiceWithDifferentConfidence(){
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,FOUND_IN_PARENT_CLASS);
  List<SignatureEntry> signatures=invocationsCollector.getNotUploadedInvocations(jvmUuid1);
  assertThat(signatures,hasSize(1));
  assertThat(signatures.get(0).getConfidence(),is(FOUND_IN_PARENT_CLASS));
}
Program: 91076
Project: 91076
Buggy source:
@Test public void testPutSignatureTwice(){
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(1));
}

Fixed version (ground truth):
@Test public void testPutSignatureTwice(){
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(1));
}
Program: 91077
Project: 91077
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testPutNullSignature() throws Exception {
  invocationsCollector.put(jvmUuid1,null,100L,100L,null);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testPutNullSignature() throws Exception {
  invocationsCollector.put(jvmUuid1,now - 100L,null,0,null);
}
Program: 91078
Project: 91078
Buggy source:
@Test public void testPutTwoSignaturesOnce(){
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(0));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(2));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
}

Fixed version (ground truth):
@Test public void testPutTwoSignaturesOnce(){
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(0));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(2));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
}
Program: 91079
Project: 91079
Buggy source:
@Test public void testClearNotUploadedSignatures(){
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  invocationsCollector.put(jvmUuid2,"String_Node_Str",now,100L,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(1));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(1));
  invocationsCollector.clearNotUploadedSignatures(jvmUuid1);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(0));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(1));
}

Fixed version (ground truth):
@Test public void testClearNotUploadedSignatures(){
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  invocationsCollector.put(jvmUuid2,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(1));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(1));
  invocationsCollector.clearNotUploadedSignatures(jvmUuid1);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(0));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(1));
}
Program: 91080
Project: 91080
Buggy source:
@Test public void testPutSignatureOnce(){
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(0));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(1));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
}

Fixed version (ground truth):
@Test public void testPutSignatureOnce(){
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(0));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid1),hasSize(1));
  assertThat(invocationsCollector.getNotUploadedInvocations(jvmUuid2),hasSize(0));
}
Program: 91081
Project: 91081
Buggy source:
@Test public void testPutSignatureTriceWithDifferentTimestamps(){
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now - 1,100L,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now,100L,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,"String_Node_Str",now - 2,100L,EXACT_MATCH);
  List<SignatureEntry> signatures=invocationsCollector.getNotUploadedInvocations(jvmUuid1);
  assertThat(signatures,hasSize(1));
  assertThat(signatures.get(0).getInvokedAtMillis(),is(now));
}

Fixed version (ground truth):
@Test public void testPutSignatureTriceWithDifferentTimestamps(){
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now - 1,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now,EXACT_MATCH);
  invocationsCollector.put(jvmUuid1,now - 100L,"String_Node_Str",now - 2,EXACT_MATCH);
  List<SignatureEntry> signatures=invocationsCollector.getNotUploadedInvocations(jvmUuid1);
  assertThat(signatures,hasSize(1));
  assertThat(signatures.get(0).getInvokedAtMillis(),is(now));
}
Program: 91082
Project: 91082
Buggy source:
@Override public SignatureEntry mapRow(ResultSet rs,int rowNum) throws SQLException {
  Integer confidence=rs.getInt(4);
  return new SignatureEntry(rs.getString(1),rs.getLong(2),rs.getLong(2),confidence == -1 ? null : SignatureConfidence.fromOrdinal(confidence));
}

Fixed version (ground truth):
@Override public SignatureEntry mapRow(ResultSet rs,int rowNum) throws SQLException {
  Integer confidence=rs.getInt(4);
  return new SignatureEntry(rs.getString(1),rs.getLong(2),rs.getLong(3),confidence == -1 ? null : SignatureConfidence.fromOrdinal(confidence));
}
Program: 91083
Project: 91083
Buggy source:
@Override public List<SignatureEntry> getNotUploadedInvocations(String jvmUuid){
  return jdbcTemplate.query("String_Node_Str" + "String_Node_Str" + "String_Node_Str",new RowMapper<SignatureEntry>(){
    @Override public SignatureEntry mapRow(    ResultSet rs,    int rowNum) throws SQLException {
      Integer confidence=rs.getInt(4);
      return new SignatureEntry(rs.getString(1),rs.getLong(2),rs.getLong(2),confidence == -1 ? null : SignatureConfidence.fromOrdinal(confidence));
    }
  }
,jvmUuid);
}

Fixed version (ground truth):
@Override public List<SignatureEntry> getNotUploadedInvocations(String jvmUuid){
  return jdbcTemplate.query("String_Node_Str" + "String_Node_Str" + "String_Node_Str",new RowMapper<SignatureEntry>(){
    @Override public SignatureEntry mapRow(    ResultSet rs,    int rowNum) throws SQLException {
      Integer confidence=rs.getInt(4);
      return new SignatureEntry(rs.getString(1),rs.getLong(2),rs.getLong(3),confidence == -1 ? null : SignatureConfidence.fromOrdinal(confidence));
    }
  }
,jvmUuid);
}
Program: 91084
Project: 91084
Buggy source:
@AssertTrue public boolean assertValid(){
  if (invokedAtMillis == 0L && millisSinceJvmStart == 0L) {
    return true;
  }
  if (invokedAtMillis > 0L && millisSinceJvmStart > 0L) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@AssertTrue public boolean assertValid(){
  return ((invokedAtMillis == 0L) && (millisSinceJvmStart == 0L)) || ((invokedAtMillis > 0L) && (millisSinceJvmStart > 0L));
}
Program: 91085
Project: 91085
Buggy source:
private void doAnalyzeCollectorData(){
  log.debug("String_Node_Str");
  now=System.currentTimeMillis();
  findJvmStates();
  for (  JvmState jvmState : jvmStates.values()) {
    if (jvmState.getInvocationDataUploadedAt() == 0L) {
      FileUtils.resetAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
    }
    uploadJvmData(jvmState);
    analyzeAndUploadCodeBaseIfNeeded(jvmState,new CodeBase(jvmState.getJvm().getCollectorConfig()));
    processInvocationsDataIfNeeded(jvmState);
  }
}

Fixed version (ground truth):
private void doAnalyzeCollectorData(){
  log.debug("String_Node_Str");
  now=System.currentTimeMillis();
  findJvmStates();
  for (  JvmState jvmState : jvmStates.values()) {
    if (jvmState.isFirstRun()) {
      FileUtils.resetAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
      jvmState.setFirstRun(false);
    }
    uploadJvmData(jvmState);
    analyzeAndUploadCodeBaseIfNeeded(jvmState,new CodeBase(jvmState.getJvm().getCollectorConfig()));
    processInvocationsDataIfNeeded(jvmState);
  }
}
Program: 91086
Project: 91086
Buggy source:
private void analyzeAndUploadCodeBaseIfNeeded(JvmState jvmState,CodeBase newCodeBase){
  if (jvmState.getCodebaseUploadedAt() == 0 || !newCodeBase.equals(jvmState.getCodeBase())) {
    if (jvmState.getCodebaseUploadedAt() == 0) {
      log.debug("String_Node_Str");
    }
 else {
      resolveAppVersion(jvmState);
      log.info("String_Node_Str");
    }
    codeBaseScanner.scanSignatures(newCodeBase);
    try {
      agentApi.uploadSignatureData(getJvmData(jvmState),newCodeBase.getSignatures());
      jvmState.setCodeBase(newCodeBase);
      jvmState.setCodebaseUploadedAt(now);
    }
 catch (    AgentApiException e) {
      logException("String_Node_Str" + agentApi.getServerUri(),e);
    }
  }
}

Fixed version (ground truth):
private void analyzeAndUploadCodeBaseIfNeeded(JvmState jvmState,CodeBase newCodeBase){
  if (jvmState.getCodebaseUploadedAt() == 0 || !newCodeBase.equals(jvmState.getCodeBase())) {
    if (jvmState.getCodebaseUploadedAt() == 0) {
      log.debug("String_Node_Str");
    }
 else {
      resolveAppVersion(jvmState);
      log.info("String_Node_Str");
    }
    codeBaseScanner.scanSignatures(newCodeBase);
    jvmState.setCodeBase(newCodeBase);
    try {
      agentApi.uploadSignatureData(getJvmData(jvmState),newCodeBase.getSignatures());
      jvmState.setCodebaseUploadedAt(now);
    }
 catch (    AgentApiException e) {
      logException("String_Node_Str" + agentApi.getServerUri(),e);
    }
  }
}
Program: 91087
Project: 91087
Buggy source:
private void addOrUpdateJvmState(File file){
  try {
    Jvm jvm=Jvm.readFrom(file);
    JvmState jvmState=jvmStates.get(jvm.getJvmFingerprint());
    if (jvmState == null) {
      jvmState=new JvmState(jvm);
      jvmState.setAppVersion(getAppVersion(jvm));
      jvmStates.put(jvm.getJvmFingerprint(),jvmState);
    }
    jvmState.setInvocationsFile(new File(file.getParentFile(),CollectorConfig.INVOCATIONS_BASENAME));
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + file,e);
  }
}

Fixed version (ground truth):
private void addOrUpdateJvmState(File file){
  try {
    Jvm jvm=Jvm.readFrom(file);
    JvmState jvmState=jvmStates.get(jvm.getJvmFingerprint());
    if (jvmState == null) {
      jvmState=new JvmState();
      jvmState.setAppVersion(getAppVersion(jvm));
      jvmStates.put(jvm.getJvmFingerprint(),jvmState);
    }
    jvmState.setJvm(jvm);
    jvmState.setInvocationsFile(new File(file.getParentFile(),CollectorConfig.INVOCATIONS_BASENAME));
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + file,e);
  }
}
Program: 91088
Project: 91088
Buggy source:
private void addJvmState(Collection<JvmState> result,File file){
  try {
    JvmState jvmState=JvmState.builder().invocationsFile(new File(file.getParentFile(),CollectorConfig.INVOCATIONS_BASENAME)).jvm(Jvm.readFrom(file)).build();
    jvmState.setCodeBase(codeBases.get(jvmState.getJvm().getJvmFingerprint()));
    result.add(jvmState);
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + file,e);
  }
}

Fixed version (ground truth):
private void addJvmState(File file){
  try {
    Jvm jvm=Jvm.readFrom(file);
    JvmState jvmState=jvmStates.get(jvm.getJvmFingerprint());
    if (jvmState == null) {
      jvmState=new JvmState(jvm);
      jvmState.setAppVersion(getAppVersion(jvm));
      jvmStates.put(jvm.getJvmFingerprint(),jvmState);
    }
    jvmState.setInvocationsFile(new File(file.getParentFile(),CollectorConfig.INVOCATIONS_BASENAME));
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + file,e);
  }
}
Program: 91089
Project: 91089
Buggy source:
private void uploadJvmData(Jvm jvm,String appVersion){
  try {
    agentApi.uploadJvmData(JvmData.builder().appName(jvm.getCollectorConfig().getAppName()).tags(jvm.getCollectorConfig().getTags()).appVersion(appVersion).hostName(jvm.getHostName()).startedAtMillis(jvm.getStartedAtMillis()).dumpedAtMillis(jvm.getDumpedAtMillis()).jvmFingerprint(jvm.getJvmFingerprint()).computerId(computerId.toString()).codekvastVersion(codekvastGradleVersion).codekvastVcsId(codekvastVcsId).build());
  }
 catch (  AgentApiException e) {
    logException("String_Node_Str" + agentApi.getServerUri(),e);
  }
}

Fixed version (ground truth):
private void uploadJvmData(JvmState jvmState){
  Jvm jvm=jvmState.getJvm();
  if (jvmState.getJvmDataUploadedAt() < jvm.getDumpedAtMillis()) {
    try {
      agentApi.uploadJvmData(JvmData.builder().appName(jvm.getCollectorConfig().getAppName()).tags(jvm.getCollectorConfig().getTags()).appVersion(jvmState.getAppVersion()).hostName(jvm.getHostName()).startedAtMillis(jvm.getStartedAtMillis()).dumpedAtMillis(jvm.getDumpedAtMillis()).jvmFingerprint(jvm.getJvmFingerprint()).computerId(computerId.toString()).codekvastVersion(codekvastGradleVersion).codekvastVcsId(codekvastVcsId).build());
      jvmState.setJvmDataUploadedAt(jvm.getDumpedAtMillis());
    }
 catch (    AgentApiException e) {
      logException("String_Node_Str" + agentApi.getServerUri(),e);
    }
  }
}
Program: 91090
Project: 91090
Buggy source:
private void findJvmState(Collection<JvmState> result,File dataPath){
  log.debug("String_Node_Str",dataPath);
  File[] files=dataPath.listFiles();
  if (files != null) {
    for (    File file : files) {
      if (file.isFile() && file.getName().equals(CollectorConfig.JVM_BASENAME)) {
        addJvmState(result,file);
      }
 else       if (file.isDirectory()) {
        findJvmState(result,file);
      }
    }
  }
}

Fixed version (ground truth):
private void findJvmState(File dataPath){
  log.debug("String_Node_Str",dataPath);
  File[] files=dataPath.listFiles();
  if (files != null) {
    for (    File file : files) {
      if (file.isFile() && file.getName().equals(CollectorConfig.JVM_BASENAME)) {
        addJvmState(file);
      }
 else       if (file.isDirectory()) {
        findJvmState(file);
      }
    }
  }
}
Program: 91091
Project: 91091
Buggy source:
@Scheduled(initialDelay=10L,fixedDelayString="String_Node_Str") public void analyseCollectorData(){
  log.debug("String_Node_Str");
  long now=System.currentTimeMillis();
  for (  JvmState jvmState : findJvmStates()) {
    Jvm jvm=jvmState.getJvm();
    String appVersion=getAppVersion(jvm);
    String fingerprint=jvm.getJvmFingerprint();
    Long oldProcessedAt=jvmProcessedAt.get(fingerprint);
    if (oldProcessedAt == null) {
      FileUtils.resetAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
      uploadJvmData(jvm,appVersion);
      analyzeAndUploadCodeBaseIfNeeded(jvmState,new CodeBase(jvm.getCollectorConfig()));
      processInvocationsDataIfNeeded(jvmState);
    }
 else     if (oldProcessedAt < jvm.getDumpedAtMillis()) {
      uploadJvmData(jvm,appVersion);
      processInvocationsDataIfNeeded(jvmState);
    }
    jvmProcessedAt.put(fingerprint,now);
  }
}

Fixed version (ground truth):
@Scheduled(initialDelay=10L,fixedDelayString="String_Node_Str") public void analyseCollectorData(){
  log.debug("String_Node_Str");
  now=System.currentTimeMillis();
  findJvmStates();
  for (  JvmState jvmState : jvmStates.values()) {
    if (jvmState.getInvocationDataUploadedAt() == 0L) {
      FileUtils.resetAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
    }
    uploadJvmData(jvmState);
    analyzeAndUploadCodeBaseIfNeeded(jvmState,new CodeBase(jvmState.getJvm().getCollectorConfig()));
    processInvocationsDataIfNeeded(jvmState);
  }
}
Program: 91092
Project: 91092
Buggy source:
private Collection<JvmState> findJvmStates(){
  Collection<JvmState> result=new ArrayList<>();
  findJvmState(result,config.getSharedConfig().getDataPath());
  return result;
}

Fixed version (ground truth):
private void findJvmStates(){
  findJvmState(config.getSharedConfig().getDataPath());
}
Program: 91093
Project: 91093
Buggy source:
private void analyzeAndUploadCodeBaseIfNeeded(JvmState jvmState,CodeBase newCodeBase){
  if (!newCodeBase.equals(jvmState.getCodeBase())) {
    codeBaseScanner.scanSignatures(newCodeBase);
    try {
      agentApi.uploadSignatureData(jvmState.getJvm().getJvmFingerprint(),newCodeBase.getSignatures());
      jvmState.setCodeBase(newCodeBase);
      codeBases.put(jvmState.getJvm().getJvmFingerprint(),newCodeBase);
    }
 catch (    AgentApiException e) {
      logException("String_Node_Str" + agentApi.getServerUri(),e);
    }
  }
}

Fixed version (ground truth):
private void analyzeAndUploadCodeBaseIfNeeded(JvmState jvmState,CodeBase newCodeBase){
  if (jvmState.getCodebaseUploadedAt() == 0 || !newCodeBase.equals(jvmState.getCodeBase())) {
    codeBaseScanner.scanSignatures(newCodeBase);
    try {
      agentApi.uploadSignatureData(jvmState.getJvm().getJvmFingerprint(),newCodeBase.getSignatures());
      jvmState.setCodeBase(newCodeBase);
      jvmState.setCodebaseUploadedAt(now);
    }
 catch (    AgentApiException e) {
      logException("String_Node_Str" + agentApi.getServerUri(),e);
    }
  }
}
Program: 91094
Project: 91094
Buggy source:
private String getAppVersion(Jvm jvm){
  String appVersion=appVersions.get(jvm.getJvmFingerprint());
  if (appVersion == null) {
    appVersion=resolveAppVersion(appVersionStrategies,jvm.getCollectorConfig().getCodeBaseFiles(),jvm.getCollectorConfig().getAppVersion());
    appVersions.put(jvm.getJvmFingerprint(),appVersion);
  }
  return appVersion;
}

Fixed version (ground truth):
private String getAppVersion(Jvm jvm){
  return resolveAppVersion(appVersionStrategies,jvm.getCollectorConfig().getCodeBaseFiles(),jvm.getCollectorConfig().getAppVersion());
}
Program: 91095
Project: 91095
Buggy source:
private void uploadUsedSignatures(JvmState jvmState){
  try {
    agentApi.uploadInvocationsData(jvmState.getJvm().getJvmFingerprint(),jvmState.getInvocationsCollector().getNotUploadedInvocations());
    jvmState.getInvocationsCollector().clearNotUploadedSignatures();
    FileUtils.deleteAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
  }
 catch (  AgentApiException e) {
    logException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void uploadUsedSignatures(JvmState jvmState){
  try {
    agentApi.uploadInvocationsData(jvmState.getJvm().getJvmFingerprint(),jvmState.getInvocationsCollector().getNotUploadedInvocations());
    jvmState.getInvocationsCollector().clearNotUploadedSignatures();
    FileUtils.deleteAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
  }
 catch (  AgentApiException e) {
    logException("String_Node_Str" + agentApi.getServerUri(),e);
    FileUtils.resetAllConsumedInvocationDataFiles(jvmState.getInvocationsFile());
  }
}
Program: 91096
Project: 91096
Buggy source:
@Override @Transactional(readOnly=true) public Collection<InvocationEntry> getSignatures(long organisationId){
  String queries[]={"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"};
  long startedAt=System.currentTimeMillis();
  List<InvocationEntry> result=jdbcTemplate.query(queries[0],new InvocationsEntryRowMapper(),organisationId);
  log.warn("String_Node_Str",organisationId,(System.currentTimeMillis() - startedAt) / 1000L);
  return result;
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public Collection<InvocationEntry> getSignatures(long organisationId){
  long startedAt=System.currentTimeMillis();
  Set<InvocationEntry> result=new HashSet<>(jdbcTemplate.query("String_Node_Str",new InvocationsEntryRowMapper(),organisationId));
  log.debug("String_Node_Str",organisationId,System.currentTimeMillis() - startedAt);
  return result;
}
Program: 91097
Project: 91097
Buggy source:
@Scheduled(initialDelay=10L,fixedDelayString="String_Node_Str") public void analyseSensorData(){
  log.debug("String_Node_Str");
  uploadJvmRunIfNeeded(config.getJvmRunFile());
  analyzeCodeBaseIfNeeded(new CodeBase(config));
  if (codeBase != null) {
    processUsageDataIfNeeded(config.getUsageFile());
  }
}

Fixed version (ground truth):
@Scheduled(initialDelay=10L,fixedDelayString="String_Node_Str") public void analyseSensorData(){
  log.debug("String_Node_Str");
  uploadJvmRunIfNeeded(config.getJvmRunFile());
  analyzeAndUploadCodeBaseIfNeeded(new CodeBase(config));
  if (codeBase != null) {
    processUsageDataIfNeeded(config.getUsageFile());
  }
}
Program: 91098
Project: 91098
Buggy source:
CodeBase(AgentConfig config){
  this.config=config;
  this.codeBaseFile=new File(config.getCodeBaseUri());
}

Fixed version (ground truth):
CodeBase(AgentConfig config){
  this.config=config;
  this.codeBaseFile=new File(config.getCodeBaseUri());
  this.fingerprint=initUrls();
}
Program: 91099
Project: 91099
Buggy source:
URL[] getUrls(){
  updateFingerprint();
  if (needsExploding) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  return urls.toArray(new URL[urls.size()]);
}

Fixed version (ground truth):
URL[] getUrls(){
  if (needsExploding) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  return urls.toArray(new URL[urls.size()]);
}
Program: 91100
Project: 91100
Buggy source:
CodeBaseFingerprint build(){
  return new CodeBaseFingerprint(count,size,lastModified,Long.valueOf(hashCode).hashCode());
}

Fixed version (ground truth):
CodeBaseFingerprint build(){
  return new CodeBaseFingerprint(count,size,lastModified,Long.valueOf(hashCodeSum).hashCode());
}
Program: 91101
Project: 91101
Buggy source:
public void record(File file){
  count+=1;
  size+=file.length();
  lastModified=max(lastModified,file.lastModified());
  hashCode+=file.hashCode();
  log.trace("String_Node_Str",file,this);
}

Fixed version (ground truth):
public Builder record(File file){
  count+=1;
  size+=file.length();
  lastModified=max(lastModified,file.lastModified());
  hashCodeSum+=file.hashCode();
  log.trace("String_Node_Str",file,this);
  return this;
}
Program: 91102
Project: 91102
Buggy source:
void put(String signature,long usedAtMillis,UsageConfidence confidence){
  if (signature != null) {
    UsageDataEntry newEntry=new UsageDataEntry(signature,usedAtMillis,confidence);
    UsageDataEntry oldEntry=entries.put(signature,newEntry);
    if (!newEntry.equals(oldEntry)) {
      notUploadedSignatures.add(newEntry);
    }
  }
}

Fixed version (ground truth):
void put(@NonNull String signature,long usedAtMillis,@NonNull UsageConfidence confidence){
  notUploadedSignatures.add(new UsageDataEntry(signature,usedAtMillis,confidence));
}
Program: 91103
Project: 91103
Buggy source:
private String getAppName(File usageFile){
  return usageFile.getName();
}

Fixed version (ground truth):
private String getAppName(File usageFile){
  String name=usageFile.getName();
  return name.substring(0,name.length() - Configuration.USAGE_FILE_SUFFIX.length());
}
Program: 91104
Project: 91104
Buggy source:
private void processUsageDataIfNew(File usageFile){
  long modifiedAt=usageFile.lastModified();
  Long oldModifiedAt=dataFileModifiedAtMillis.get(usageFile);
  if (oldModifiedAt == null || oldModifiedAt != modifiedAt) {
    String appName=getAppName(usageFile);
    applyRecordedUsage(codeBase,getAppUsage(appName),SensorUtils.readUsageFrom(usageFile));
    dataFileModifiedAtMillis.put(usageFile,modifiedAt);
  }
}

Fixed version (ground truth):
private void processUsageDataIfNew(File usageFile){
  long modifiedAt=usageFile.lastModified();
  Long oldModifiedAt=dataFileModifiedAtMillis.get(usageFile.getPath());
  if (oldModifiedAt == null || oldModifiedAt != modifiedAt) {
    String appName=getAppName(usageFile);
    applyRecordedUsage(codeBase,getAppUsage(appName),SensorUtils.readUsageFrom(usageFile));
    dataFileModifiedAtMillis.put(usageFile.getPath(),modifiedAt);
  }
}
Program: 91105
Project: 91105
Buggy source:
public CodeBase(Configuration config){
  this.config=config;
  this.codeBaseFile=new File(config.getCodeBaseUri());
  checkArgument(codeBaseFile.exists(),"String_Node_Str" + codeBaseFile + "String_Node_Str");
}

Fixed version (ground truth):
public CodeBase(Configuration config){
  this.config=config;
  this.codeBaseFile=new File(config.getCodeBaseUri());
}
Program: 91106
Project: 91106
Buggy source:
protected void initialize(Object... arg){
  CoreSession session=null;
  DocumentModelList rootSections=null;
  DocumentModelList higherSections=null;
  DocumentModelList testme=null;
  HashMap latestPublicationsMap=new HashMap<DocumentModel,DocumentModelList>();
  session=ctx.getCoreSession();
  if (session != null) {
    String query="String_Node_Str";
    try {
      rootSections=session.query(query);
      if (!rootSections.isEmpty()) {
        Iterator<DocumentModel> rootSectionIterator=rootSections.iterator();
        query="String_Node_Str";
        query=query.concat(rootSectionIterator.next().getId());
        while (rootSectionIterator.hasNext()) {
          query=query.concat("String_Node_Str");
          query=query.concat(rootSectionIterator.next().getId());
        }
        query=query.concat("String_Node_Str");
        higherSections=session.query(query);
      }
      ctx.setProperty("String_Node_Str",higherSections);
      latestPublicationsMap=getLatestPublicationMap(session,higherSections);
      ctx.setProperty("String_Node_Str",latestPublicationsMap);
      log.warn(higherSections.size());
    }
 catch (    ClientException e) {
      log.error(e);
    }
  }
}

Fixed version (ground truth):
@Override protected void initialize(Object... arg){
  CoreSession session=null;
  DocumentModelList rootSections=null;
  DocumentModelList higherSections=null;
  DocumentModelList testme=null;
  HashMap latestPublicationsMap=new HashMap<DocumentModel,DocumentModelList>();
  session=ctx.getCoreSession();
  if (session != null) {
    String query="String_Node_Str";
    try {
      rootSections=session.query(query);
      if (!rootSections.isEmpty()) {
        Iterator<DocumentModel> rootSectionIterator=rootSections.iterator();
        query="String_Node_Str";
        query=query.concat(rootSectionIterator.next().getId());
        while (rootSectionIterator.hasNext()) {
          query=query.concat("String_Node_Str");
          query=query.concat(rootSectionIterator.next().getId());
        }
        query=query.concat("String_Node_Str");
        higherSections=session.query(query);
      }
      ctx.setProperty("String_Node_Str",higherSections);
      latestPublicationsMap=getLatestPublicationMap(session,higherSections);
      ctx.setProperty("String_Node_Str",latestPublicationsMap);
      log.warn(higherSections.size());
    }
 catch (    ClientException e) {
      log.error(e);
    }
  }
}
Program: 91107
Project: 91107
Buggy source:
protected void initialize(Object... arg){
  String id=(String)arg[0];
  CoreSession session=null;
  DocumentModel currentSection;
  DocumentModelList childSections=null;
  DocumentModelList childrenContent;
  session=ctx.getCoreSession();
  HashMap latestPublicationsMap=new HashMap<DocumentModel,DocumentModelList>();
  if (session != null) {
    try {
      currentSection=session.query("String_Node_Str" + id + "String_Node_Str").get(0);
      childSections=session.query("String_Node_Str" + currentSection.getId() + "String_Node_Str");
      childrenContent=session.query("String_Node_Str" + currentSection.getId() + "String_Node_Str");
      ctx.setProperty("String_Node_Str",childSections);
      ctx.setProperty("String_Node_Str",currentSection);
      ctx.setProperty("String_Node_Str",childrenContent);
      latestPublicationsMap=getLatestPublicationMap(session,childSections);
      ctx.setProperty("String_Node_Str",latestPublicationsMap);
      log.warn(childSections.size());
    }
 catch (    ClientException e) {
      log.error(e);
    }
  }
}

Fixed version (ground truth):
@Override protected void initialize(Object... arg){
  String id=(String)arg[0];
  CoreSession session=null;
  DocumentModel currentSection;
  DocumentModelList childSections=null;
  DocumentModelList childrenContent;
  session=ctx.getCoreSession();
  HashMap latestPublicationsMap=new HashMap<DocumentModel,DocumentModelList>();
  if (session != null) {
    try {
      currentSection=session.query("String_Node_Str" + id + "String_Node_Str").get(0);
      childSections=session.query("String_Node_Str" + currentSection.getId() + "String_Node_Str");
      childrenContent=session.query("String_Node_Str" + currentSection.getId() + "String_Node_Str");
      ctx.setProperty("String_Node_Str",childSections);
      ctx.setProperty("String_Node_Str",currentSection);
      ctx.setProperty("String_Node_Str",childrenContent);
      latestPublicationsMap=getLatestPublicationMap(session,childSections);
      ctx.setProperty("String_Node_Str",latestPublicationsMap);
      log.warn(childSections.size());
    }
 catch (    ClientException e) {
      log.error(e);
    }
  }
}
Program: 91108
Project: 91108
Buggy source:
@Path("String_Node_Str") public Resource getsectionContent(@PathParam("String_Node_Str") String id){
  return newObject("String_Node_Str",id);
}

Fixed version (ground truth):
@Override @Path("String_Node_Str") public Resource getsectionContent(@PathParam("String_Node_Str") String id){
  return newObject("String_Node_Str",id);
}
Program: 91109
Project: 91109
Buggy source:
@GET public Object doGet(){
  return getView("String_Node_Str");
}

Fixed version (ground truth):
@Override @GET public Object doGet(){
  return getView("String_Node_Str");
}