nus-yam/ex-repair huggingface dataset:
Program: 11249
Project: 11249
Buggy source:
public void crawlLocations() throws IOException {
  luceneIndexHandler.crawlingStarts();
  progressMonitor.resetStats();
  Thread theRunner=new Thread(){
    @Override public void run(){
      locations.values().stream().forEach(theWatcher -> {
        try {
          theWatcher.crawl();
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
);
      progressMonitor.crawlingFinished();
    }
  }
;
  theRunner.start();
}

Fixed version (ground truth):
public void crawlLocations() throws IOException {
  luceneIndexHandler.crawlingStarts();
  Thread theRunner=new Thread(){
    @Override public void run(){
      locations.values().stream().forEach(theWatcher -> {
        try {
          theWatcher.crawl();
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
);
      progressListener.crawlingFinished();
    }
  }
;
  theRunner.start();
}
Program: 11251
Project: 11251
Buggy source:
public void newFileFound(final String aFilename,final long aNumNewFiles,final long aNumIndexedFiles){
  wakeupThread();
  watcherThread.notifyProgress();
  Platform.runLater(() -> {
    double theProgress=(double)aNumIndexedFiles / aNumNewFiles;
    progessIndicator.setProgress(theProgress);
    statusText.setText(aFilename);
  }
);
}

Fixed version (ground truth):
public void newFileFound(final String aFilename){
  wakeupThread();
  watcherThread.notifyProgress();
  Platform.runLater(() -> {
    statusText.setText(aFilename);
  }
);
}
Program: 11252
Project: 11252
Buggy source:
@Override public void run(){
  Platform.runLater(() -> {
    statusBar.setVisible(true);
    statusBar.setManaged(true);
    menuItemRecrawl.setDisable(true);
  }
);
  while (!isInterrupted()) {
    if (lastActivity.get() < System.currentTimeMillis() - 5000) {
      interrupt();
    }
 else {
      try {
        sleep(5000);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Platform.runLater(() -> {
    statusBar.setVisible(false);
    statusBar.setManaged(false);
    menuItemRecrawl.setDisable(false);
  }
);
}

Fixed version (ground truth):
@Override public void run(){
  Platform.runLater(() -> {
    statusBar.setVisible(true);
    menuItemRecrawl.setDisable(true);
  }
);
  while (!isInterrupted()) {
    if (lastActivity.get() < System.currentTimeMillis() - 5000) {
      interrupt();
    }
 else {
      try {
        sleep(5000);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Platform.runLater(() -> {
    statusBar.setVisible(false);
    statusBar.setManaged(false);
    menuItemRecrawl.setDisable(false);
  }
);
}
Program: 11253
Project: 11253
Buggy source:
void recrawl(){
  statusBar.setVisible(true);
  statusBar.setManaged(true);
  progessIndicator.setProgress(0);
  menuItemRecrawl.setDisable(true);
  statusText.setText("String_Node_Str");
  try {
    backend.crawlLocations();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void recrawl(){
  statusBar.setVisible(true);
  statusBar.setManaged(true);
  menuItemRecrawl.setDisable(true);
  statusText.setText("String_Node_Str");
  try {
    backend.crawlLocations();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 11254
Project: 11254
Buggy source:
private void registerWatcher(Path aDirectory) throws IOException {
  directoryListener.newWatchablePathDetected(aDirectory);
  aDirectory.register(watchService,StandardWatchEventKinds.ENTRY_CREATE,StandardWatchEventKinds.ENTRY_DELETE,StandardWatchEventKinds.ENTRY_MODIFY);
}

Fixed version (ground truth):
private void registerWatcher(Path aDirectory) throws IOException {
  LOGGER.info("String_Node_Str" + aDirectory);
  aDirectory.register(watchService,StandardWatchEventKinds.ENTRY_CREATE,StandardWatchEventKinds.ENTRY_DELETE,StandardWatchEventKinds.ENTRY_MODIFY);
}
Program: 11255
Project: 11255
Buggy source:
public DirectoryWatcher startWatching(){
  Thread theRegisterWatchers=new Thread("String_Node_Str"){
    @Override public void run(){
      try {
        Files.walk(filesystemLocation.getDirectory().toPath()).forEach(path -> {
          if (Files.isDirectory(path)) {
            LOGGER.info("String_Node_Str" + path);
            try {
              registerWatcher(path);
            }
 catch (            IOException e) {
              throw new RuntimeException(e);
            }
          }
        }
);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
;
  theRegisterWatchers.start();
  watcherThread.start();
  actionTimer.scheduleAtFixedRate(new TimerTask(){
    @Override public void run(){
      actionCountDown();
    }
  }
,1000,1000);
  return this;
}

Fixed version (ground truth):
public DirectoryWatcher startWatching(){
  Thread theRegisterWatchers=new Thread("String_Node_Str"){
    @Override public void run(){
      try {
        Files.walk(filesystemLocation.getDirectory().toPath()).forEach(path -> {
          if (Files.isDirectory(path)) {
            LOGGER.info("String_Node_Str" + path);
            try {
              registerWatcher(path);
            }
 catch (            IOException e) {
              throw new RuntimeException(e);
            }
          }
        }
);
      }
 catch (      IOException e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
  }
;
  theRegisterWatchers.start();
  watcherThread.start();
  actionTimer.scheduleAtFixedRate(new TimerTask(){
    @Override public void run(){
      actionCountDown();
    }
  }
,1000,1000);
  return this;
}
Program: 11256
Project: 11256
Buggy source:
public void showInformation(String aMessage){
}

Fixed version (ground truth):
public void showInformation(String aMessage){
  LOGGER.info(aMessage);
  Platform.runLater(() -> notifier.notifyInfo("String_Node_Str",aMessage));
}
Program: 11257
Project: 11257
Buggy source:
public void showError(String aMessage,Exception aException){
}

Fixed version (ground truth):
public void showError(String aMessage,Exception aException){
  LOGGER.error(aMessage,aException);
  Platform.runLater(() -> notifier.notifyError("String_Node_Str",aMessage));
}
Program: 11258
Project: 11258
Buggy source:
void newFileFound(String aFilename,long aNumNewFiles,long aNumIndexedFiles);

Fixed version (ground truth):
void newFileFound(String aFilename);
Program: 11259
Project: 11259
Buggy source:
private void add(Configuration.CrawlLocation aLocation) throws IOException {
  locations.put(aLocation,new DirectoryWatcher(aLocation,DirectoryWatcher.DEFAULT_WAIT_FOR_ACTION,directoryListener,executorPool).startWatching());
}

Fixed version (ground truth):
private void add(Configuration.CrawlLocation aLocation) throws IOException {
  locations.put(aLocation,new DirectoryWatcher(watchServiceCache,aLocation,DirectoryWatcher.DEFAULT_WAIT_FOR_ACTION,directoryListener,executorPool).startWatching());
}
Program: 11261
Project: 11261
Buggy source:
void configure(){
  try {
    Stage stage=new Stage();
    stage.setResizable(false);
    stage.initStyle(StageStyle.UTILITY);
    FXMLLoader theLoader=new FXMLLoader(getClass().getResource("String_Node_Str"));
    AnchorPane theConfigurationRoot=theLoader.load();
    stage.setScene(new Scene(theConfigurationRoot));
    stage.setTitle("String_Node_Str");
    stage.initModality(Modality.APPLICATION_MODAL);
    ConfigurationController theConfigController=theLoader.getController();
    theConfigController.initialize(application.getConfigurationManager(),stage);
    stage.initOwner(window);
    stage.show();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void configure(){
  try {
    Stage stage=new Stage();
    stage.setResizable(false);
    stage.initStyle(StageStyle.UTILITY);
    FXMLLoader theLoader=new FXMLLoader(getClass().getResource("String_Node_Str"));
    AnchorPane theConfigurationRoot=theLoader.load();
    stage.setScene(new Scene(theConfigurationRoot));
    stage.setTitle("String_Node_Str");
    stage.initModality(Modality.APPLICATION_MODAL);
    ConfigurationController theConfigController=theLoader.getController();
    theConfigController.initialize(application.getConfigurationManager(),stage);
    stage.initOwner(window);
    stage.show();
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 11262
Project: 11262
Buggy source:
void recrawl(){
  statusBar.setVisible(true);
  statusBar.setManaged(true);
  menuItemRecrawl.setDisable(true);
  statusText.setText("String_Node_Str");
  try {
    backend.crawlLocations();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void recrawl(){
  statusBar.setVisible(true);
  statusBar.setManaged(true);
  menuItemRecrawl.setDisable(true);
  statusText.setText("String_Node_Str");
  try {
    backend.crawlLocations();
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 11263
Project: 11263
Buggy source:
public DirectoryWatcher(Configuration.CrawlLocation aFileSystemLocation,int aWaitForAction,DirectoryListener aDirectoryListener,ExecutorPool aExecutorPool) throws IOException {
  executorPool=aExecutorPool;
  fileTimers=new HashMap<>();
  waitForAction=aWaitForAction;
  directoryListener=aDirectoryListener;
  filesystemLocation=aFileSystemLocation;
  Path thePath=aFileSystemLocation.getDirectory().toPath();
  watchService=thePath.getFileSystem().newWatchService();
  watcherThread=new Thread("String_Node_Str" + thePath){
    @Override public void run(){
      while (!isInterrupted()) {
        try {
          WatchKey theKey=watchService.take();
          Path theParent=(Path)theKey.watchable();
          theKey.pollEvents().stream().forEach(theEvent -> {
            if (theEvent.kind() == StandardWatchEventKinds.OVERFLOW) {
              LOGGER.warn("String_Node_Str" + theEvent.context() + "String_Node_Str"+ theEvent.count());
            }
 else {
              Path thePath=theParent.resolve((Path)theEvent.context());
              LOGGER.debug(theEvent.kind() + "String_Node_Str" + theEvent.context()+ "String_Node_Str"+ theEvent.count());
              publishActionFor(thePath,theEvent.kind());
            }
          }
);
          theKey.reset();
          Thread.sleep(10000);
        }
 catch (        InterruptedException e) {
          LOGGER.debug("String_Node_Str");
        }
      }
    }
  }
;
  actionTimer=new Timer();
}

Fixed version (ground truth):
public DirectoryWatcher(WatchServiceCache aWatchServiceCache,Configuration.CrawlLocation aFileSystemLocation,int aWaitForAction,DirectoryListener aDirectoryListener,ExecutorPool aExecutorPool) throws IOException {
  executorPool=aExecutorPool;
  fileTimers=new HashMap<>();
  waitForAction=aWaitForAction;
  directoryListener=aDirectoryListener;
  filesystemLocation=aFileSystemLocation;
  Path thePath=aFileSystemLocation.getDirectory().toPath();
  watchService=aWatchServiceCache.getWatchServiceFor(thePath);
  watcherThread=new Thread("String_Node_Str" + thePath){
    @Override public void run(){
      while (!isInterrupted()) {
        try {
          WatchKey theKey=watchService.take();
          Path theParent=(Path)theKey.watchable();
          theKey.pollEvents().stream().forEach(theEvent -> {
            if (theEvent.kind() == StandardWatchEventKinds.OVERFLOW) {
              LOGGER.warn("String_Node_Str" + theEvent.context() + "String_Node_Str"+ theEvent.count());
            }
 else {
              Path thePath=theParent.resolve((Path)theEvent.context());
              LOGGER.debug(theEvent.kind() + "String_Node_Str" + theEvent.context()+ "String_Node_Str"+ theEvent.count());
              publishActionFor(thePath,theEvent.kind());
            }
          }
);
          theKey.reset();
          Thread.sleep(10000);
        }
 catch (        InterruptedException e) {
          LOGGER.debug("String_Node_Str");
        }
      }
    }
  }
;
  actionTimer=new Timer();
}
Program: 11265
Project: 11265
Buggy source:
@Override public void fileCreatedOrModified(FilesystemLocation aFileSystemLocation,Path aFile){
  String theFileName=aFile.toString();
  if (contentExtractor.supportsFile(theFileName)) {
    try {
      progressMonitor.addNewFileFound(theFileName);
      BasicFileAttributes theAttributes=Files.readAttributes(aFile,BasicFileAttributes.class);
      UpdateCheckResult theUpdateCheckResult=luceneIndexHandler.checkIfModified(theFileName,theAttributes.size());
      if (theUpdateCheckResult == UpdateCheckResult.UPDATED) {
        Content theContent=contentExtractor.extractContentFrom(aFile,theAttributes);
        if (theContent != null) {
          luceneIndexHandler.addToIndex(aFileSystemLocation.getId(),theContent);
          progressMonitor.addFilesIndexed();
        }
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void fileCreatedOrModified(FilesystemLocation aFileSystemLocation,Path aFile){
  String theFileName=aFile.toString();
  if (contentExtractor.supportsFile(theFileName)) {
    try {
      progressMonitor.addNewFileFound(theFileName);
      BasicFileAttributes theAttributes=Files.readAttributes(aFile,BasicFileAttributes.class);
      UpdateCheckResult theUpdateCheckResult=luceneIndexHandler.checkIfModified(theFileName,theAttributes.size());
      if (theUpdateCheckResult == UpdateCheckResult.UPDATED) {
        notifier.showInformation("String_Node_Str" + aFile);
        Content theContent=contentExtractor.extractContentFrom(aFile,theAttributes);
        if (theContent != null) {
          luceneIndexHandler.addToIndex(aFileSystemLocation.getId(),theContent);
          progressMonitor.addFilesIndexed();
        }
      }
    }
 catch (    Exception e) {
      aNotifier.showError("String_Node_Str" + aFile,e);
    }
  }
}
Program: 11266
Project: 11266
Buggy source:
@Override public void fileDeleted(FilesystemLocation aFileSystemLocation,Path aFile){
  try {
    luceneIndexHandler.removeFromIndex(aFile.toString());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void fileDeleted(FilesystemLocation aFileSystemLocation,Path aFile){
  try {
    luceneIndexHandler.removeFromIndex(aFile.toString());
    aNotifier.showInformation("String_Node_Str" + aFile);
  }
 catch (  Exception e) {
    aNotifier.showError("String_Node_Str" + aFile,e);
  }
}
Program: 11268
Project: 11268
Buggy source:
public void openFile(String aFile){
  try {
    Desktop.getDesktop().open(new File(aFile));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void openFile(String aFile){
  if (Desktop.isDesktopSupported()) {
    if (Platform.isFxApplicationThread()) {
      new Thread(() -> {
        open(aFile);
      }
).start();
    }
 else {
      open(aFile);
    }
  }
 else {
    LOGGER.error("String_Node_Str");
  }
}
Program: 11270
Project: 11270
Buggy source:
private void registerWatcher(Path aDirectory) throws IOException {
  aDirectory.register(watchService,StandardWatchEventKinds.ENTRY_CREATE,StandardWatchEventKinds.ENTRY_DELETE,StandardWatchEventKinds.ENTRY_MODIFY);
}

Fixed version (ground truth):
private void registerWatcher(Path aDirectory) throws IOException {
  directoryListener.newWatchablePathDetected(aDirectory);
  aDirectory.register(watchService,StandardWatchEventKinds.ENTRY_CREATE,StandardWatchEventKinds.ENTRY_DELETE,StandardWatchEventKinds.ENTRY_MODIFY);
}
Program: 11271
Project: 11271
Buggy source:
public DirectoryWatcher(FilesystemLocation aFileSystemLocation,int aWaitForAction,DirectoryListener aDirectoryListener,ExecutorPool aExecutorPool) throws IOException {
  executorPool=aExecutorPool;
  fileTimers=new HashMap<>();
  waitForAction=aWaitForAction;
  directoryListener=aDirectoryListener;
  filesystemLocation=aFileSystemLocation;
  Path thePath=aFileSystemLocation.getDirectory().toPath();
  watchService=thePath.getFileSystem().newWatchService();
  watcherThread=new Thread("String_Node_Str" + thePath){
    @Override public void run(){
      while (!isInterrupted()) {
        try {
          WatchKey theKey=watchService.take();
          Path theParent=(Path)theKey.watchable();
          theKey.pollEvents().stream().forEach(theEvent -> {
            if (theEvent.kind() == StandardWatchEventKinds.OVERFLOW) {
              LOGGER.warn("String_Node_Str" + theEvent.context() + "String_Node_Str"+ theEvent.count());
            }
 else {
              Path thePath=theParent.resolve((Path)theEvent.context());
              LOGGER.debug(theEvent.kind() + "String_Node_Str" + theEvent.context()+ "String_Node_Str"+ theEvent.count());
              publishActionFor(thePath,theEvent.kind());
            }
          }
);
          theKey.reset();
          Thread.sleep(1000);
        }
 catch (        InterruptedException e) {
          LOGGER.debug("String_Node_Str");
        }
      }
    }
  }
;
  actionTimer=new Timer();
}

Fixed version (ground truth):
public DirectoryWatcher(FilesystemLocation aFileSystemLocation,int aWaitForAction,DirectoryListener aDirectoryListener,ExecutorPool aExecutorPool) throws IOException {
  executorPool=aExecutorPool;
  fileTimers=new HashMap<>();
  waitForAction=aWaitForAction;
  directoryListener=aDirectoryListener;
  filesystemLocation=aFileSystemLocation;
  Path thePath=aFileSystemLocation.getDirectory().toPath();
  watchService=thePath.getFileSystem().newWatchService();
  watcherThread=new Thread("String_Node_Str" + thePath){
    @Override public void run(){
      while (!isInterrupted()) {
        try {
          WatchKey theKey=watchService.take();
          Path theParent=(Path)theKey.watchable();
          theKey.pollEvents().stream().forEach(theEvent -> {
            if (theEvent.kind() == StandardWatchEventKinds.OVERFLOW) {
              LOGGER.warn("String_Node_Str" + theEvent.context() + "String_Node_Str"+ theEvent.count());
            }
 else {
              Path thePath=theParent.resolve((Path)theEvent.context());
              LOGGER.debug(theEvent.kind() + "String_Node_Str" + theEvent.context()+ "String_Node_Str"+ theEvent.count());
              publishActionFor(thePath,theEvent.kind());
            }
          }
);
          theKey.reset();
          Thread.sleep(10000);
        }
 catch (        InterruptedException e) {
          LOGGER.debug("String_Node_Str");
        }
      }
    }
  }
;
  actionTimer=new Timer();
}
Program: 11274
Project: 11274
Buggy source:
public boolean supportsLanguage(String aLanguage){
  return analyzerByLanguage.containsKey(aLanguage);
}

Fixed version (ground truth):
public boolean supportsLanguage(SupportedLanguage aLanguage){
  return analyzerByLanguage.containsKey(aLanguage);
}
Program: 11275
Project: 11275
Buggy source:
public String getFieldNameFor(String aLanguage){
  return IndexFields.CONTENT + "String_Node_Str" + aLanguage;
}

Fixed version (ground truth):
public String getFieldNameFor(SupportedLanguage aLanguage){
  return FIELD_PREFIX + aLanguage.name();
}
Program: 11278
Project: 11278
Buggy source:
private void setIndexLocation(File aFile) throws IOException {
  if (luceneIndexHandler != null) {
    shutdown();
  }
  luceneIndexHandler=new LuceneIndexHandler(aFile);
}

Fixed version (ground truth):
private void setIndexLocation(Configuration aConfiguration) throws IOException {
  if (luceneIndexHandler != null) {
    shutdown();
  }
  AnalyzerCache theCache=new AnalyzerCache(aConfiguration);
  luceneIndexHandler=new LuceneIndexHandler(aConfiguration.getIndexDirectory(),theCache);
}
Program: 11279
Project: 11279
Buggy source:
@Override public void configurationUpdated(Configuration aConfiguration) throws IOException {
  setIndexLocation(aConfiguration.getIndexDirectory());
  configuration=aConfiguration;
  locations.values().stream().forEach(DirectoryWatcher::stopWatching);
  locations.clear();
  aConfiguration.getCrawlLocations().stream().forEach(e -> {
    File theDirectory=e.getDirectory();
    if (theDirectory.exists() && theDirectory.isDirectory()) {
      try {
        add(e);
      }
 catch (      IOException e1) {
        LOGGER.error("String_Node_Str" + theDirectory,e1);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void configurationUpdated(Configuration aConfiguration) throws IOException {
  setIndexLocation(aConfiguration);
  configuration=aConfiguration;
  locations.values().stream().forEach(DirectoryWatcher::stopWatching);
  locations.clear();
  aConfiguration.getCrawlLocations().stream().forEach(e -> {
    File theDirectory=e.getDirectory();
    if (theDirectory.exists() && theDirectory.isDirectory()) {
      try {
        add(e);
      }
 catch (      IOException e1) {
        LOGGER.error("String_Node_Str" + theDirectory,e1);
      }
    }
  }
);
}
Program: 11280
Project: 11280
Buggy source:
public Configuration(File aConfigDirectory){
  numberOfSearchResults=50;
  showSimilarDocuments=false;
  crawlLocations=new ArrayList<>();
  indexDirectory=new File(aConfigDirectory,"String_Node_Str");
}

Fixed version (ground truth):
public Configuration(File aConfigDirectory){
  this();
  indexDirectory=new File(aConfigDirectory,"String_Node_Str");
}
Program: 11281
Project: 11281
Buggy source:
private void initializeWithDefault(File aConfigDirectory){
  try (InputStream theDefaultConfiguration=getClass().getResourceAsStream("String_Node_Str")){
    loadConfigurationFrom(theDefaultConfiguration);
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
    configuration=new Configuration(aConfigDirectory);
  }
  writeConfiguration();
}

Fixed version (ground truth):
private void initializeWithDefault(File aConfigDirectory){
  try (InputStream theDefaultConfiguration=getClass().getResourceAsStream("String_Node_Str")){
    if (theDefaultConfiguration != null) {
      loadConfigurationFrom(theDefaultConfiguration);
    }
 else {
      LOGGER.error("String_Node_Str");
      configuration=new Configuration(aConfigDirectory);
    }
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    configuration=new Configuration(aConfigDirectory);
  }
  writeConfiguration();
}
Program: 11282
Project: 11282
Buggy source:
public String getLanguage(){
  return language;
}

Fixed version (ground truth):
public SupportedLanguage getLanguage(){
  return language;
}
Program: 11283
Project: 11283
Buggy source:
public Content(String aFileName,String aFileContent,long aFileSize,long aLastModified,String aLanguage){
  fileName=aFileName;
  fileSize=aFileSize;
  lastModified=aLastModified;
  metadata=new ArrayList<>();
  fileContent=aFileContent;
  language=aLanguage;
}

Fixed version (ground truth):
public Content(String aFileName,String aFileContent,long aFileSize,long aLastModified,SupportedLanguage aLanguage){
  fileName=aFileName;
  fileSize=aFileSize;
  lastModified=aLastModified;
  metadata=new ArrayList<>();
  fileContent=aFileContent;
  language=aLanguage;
}
Program: 11284
Project: 11284
Buggy source:
private List<String> getUserOrganisations(final User user){
  final CompanyCollection companyCollection=user.getCompanyCollection();
  final List<String> companies=new ArrayList<>();
  while (companyCollection.hasNext()) {
    companies.add(companyCollection.next().getId());
  }
  return companies;
}

Fixed version (ground truth):
private List<String> getUserOrganisations(final User user){
  final CompanyCollection companyCollection=user.getCompanyCollection();
  final List<String> companies=new ArrayList<>();
  while (companyCollection.hasNext()) {
    companies.add(companyCollection.next().getCompanyID());
  }
  return companies;
}
Program: 11285
Project: 11285
Buggy source:
@Test public void shouldReturnUser_withUserId(){
  final String userId=randomId();
  final Map<String,String> params=new HashMap<>();
  params.put("String_Node_Str",userId);
  final User mockUser=randomIntercomUser();
  when(User.find(params)).thenReturn(mockUser);
  final Map<String,Object> mockCustomAttributes=mock(Map.class);
  when(intercomToMetricMapper.apply(mockUser.getCustomAttributes())).thenReturn(mockCustomAttributes);
  final MetricUser result=intercomMetricCollector.getUser(userId);
  assertNotNull(result);
  assertThat(result.id(),is(mockUser.getUserId()));
  mockUser.getCompanyCollection().forEachRemaining(company -> {
    assertTrue(result.organisationIds().contains(company.getId()));
  }
);
  assertThat(result.name(),is(mockUser.getName()));
  assertThat(result.emailAddress(),is(mockUser.getEmail()));
  assertThat(result.customAttributes(),is(mockCustomAttributes));
}

Fixed version (ground truth):
@Test public void shouldReturnUser_withUserId(){
  final String userId=randomId();
  final Map<String,String> params=new HashMap<>();
  params.put("String_Node_Str",userId);
  final User user=randomIntercomUser();
  when(User.find(params)).thenReturn(user);
  final Map<String,CustomAttribute> mockCustomAttributes=mock(Map.class);
  user.setCustomAttributes(mockCustomAttributes);
  final MetricUser result=intercomMetricCollector.getUser(userId);
  assertNotNull(result);
  assertThat(result.id(),is(user.getUserId()));
  user.getCompanyCollection().getPage().forEach(company -> {
    assertTrue(result.organisationIds().contains(company.getCompanyID()));
  }
);
  assertThat(result.name(),is(user.getName()));
  assertThat(result.emailAddress(),is(user.getEmail()));
  assertThat(result.customAttributes(),is(mockCustomAttributes));
}
Program: 11286
Project: 11286
Buggy source:
public static CompanyCollection randomCompanyCollection(){
  final List<Company> companies=new ArrayList<>();
  final CompanyCollection companyCollection=mock(CompanyCollection.class);
  final int numberOfCompanies=randomIntInRange(1,10);
  for (int i=0; i < numberOfCompanies; i++) {
    final Company mockCompany=mock(Company.class);
    final String companyId=randomId();
    when(mockCompany.getCompanyID()).thenReturn(companyId);
    companies.add(mockCompany);
  }
  when(companyCollection.getPage()).thenReturn(companies);
  return companyCollection;
}

Fixed version (ground truth):
public static CompanyCollection randomCompanyCollection(){
  final List<Company> companies=new ArrayList<>();
  final int numberOfCompanies=randomIntInRange(1,10);
  for (int i=0; i < numberOfCompanies; i++) {
    final Company mockCompany=mock(Company.class);
    final String id=randomId();
    when(mockCompany.getId()).thenReturn(id);
    final String companyId=randomId();
    when(mockCompany.getCompanyID()).thenReturn(companyId);
    companies.add(mockCompany);
  }
  return new CompanyCollection(companies);
}
Program: 11289
Project: 11289
Buggy source:
@Test public void shouldFetchEmptyList_withAttributeQueryWithEmptyAttributeList() throws Exception {
  final AttributeQuery query=mock(AttributeQuery.class);
  final Condition mockCondition=mock(Condition.class);
  when(mockCondition.containsRequiredComparisonValues()).thenReturn(false);
  when(query.getCondition()).thenReturn(mockCondition);
  final ItemConfiguration itemConfiguration=new ItemConfiguration(StubItem.class,tableName);
  final Collection<ItemConfiguration> itemConfigurations=Arrays.asList(itemConfiguration);
  when(mockDatabaseSchemaHolder.itemConfigurations()).thenReturn(itemConfigurations);
  final DynamoDbTemplate dynamoDbTemplate=new DynamoDbTemplate(mockDatabaseSchemaHolder);
  dynamoDbTemplate.initialize(mockAmazonDynamoDbClient);
  final Collection<StubItem> returnedItems=dynamoDbTemplate.fetch(query,StubItem.class);
  verify(mockAmazonDynamoDbClient,never()).query(any(QueryRequest.class));
  assertTrue(returnedItems.isEmpty());
}

Fixed version (ground truth):
@Test public void shouldFetchEmptyList_withAttributeQueryWithEmptyAttributeList() throws Exception {
  final AttributeQuery query=mock(AttributeQuery.class);
  final Condition mockCondition=mock(Condition.class);
  when(mockCondition.hasMissingComparisonValues()).thenReturn(true);
  when(query.getCondition()).thenReturn(mockCondition);
  final ItemConfiguration itemConfiguration=new ItemConfiguration(StubItem.class,tableName);
  final Collection<ItemConfiguration> itemConfigurations=Arrays.asList(itemConfiguration);
  when(mockDatabaseSchemaHolder.itemConfigurations()).thenReturn(itemConfigurations);
  final DynamoDbTemplate dynamoDbTemplate=new DynamoDbTemplate(mockDatabaseSchemaHolder);
  dynamoDbTemplate.initialize(mockAmazonDynamoDbClient);
  final Collection<StubItem> returnedItems=dynamoDbTemplate.fetch(query,StubItem.class);
  verify(mockAmazonDynamoDbClient,never()).query(any(QueryRequest.class));
  assertTrue(returnedItems.isEmpty());
}
Program: 11298
Project: 11298
Buggy source:
@Test public void shouldFetchEmptyList_withAttributeQueryWithEmptyAttributeList() throws Exception {
  final AttributeQuery query=mock(AttributeQuery.class);
  final Condition mockCondition=mock(Condition.class);
  when(mockCondition.containsNonNullOrEmptyValues()).thenReturn(false);
  when(query.getCondition()).thenReturn(mockCondition);
  final ItemConfiguration itemConfiguration=new ItemConfiguration(StubItem.class,tableName);
  final Collection<ItemConfiguration> itemConfigurations=Arrays.asList(itemConfiguration);
  when(mockDatabaseSchemaHolder.itemConfigurations()).thenReturn(itemConfigurations);
  final DynamoDbTemplate dynamoDbTemplate=new DynamoDbTemplate(mockDatabaseSchemaHolder);
  dynamoDbTemplate.initialize(mockAmazonDynamoDbClient);
  final Collection<StubItem> returnedItems=dynamoDbTemplate.fetch(query,StubItem.class);
  verify(mockAmazonDynamoDbClient,never()).query(any(QueryRequest.class));
  assertTrue(returnedItems.isEmpty());
}

Fixed version (ground truth):
@Test public void shouldFetchEmptyList_withAttributeQueryWithEmptyAttributeList() throws Exception {
  final AttributeQuery query=mock(AttributeQuery.class);
  final Condition mockCondition=mock(Condition.class);
  when(mockCondition.containsRequiredComparisonValues()).thenReturn(false);
  when(query.getCondition()).thenReturn(mockCondition);
  final ItemConfiguration itemConfiguration=new ItemConfiguration(StubItem.class,tableName);
  final Collection<ItemConfiguration> itemConfigurations=Arrays.asList(itemConfiguration);
  when(mockDatabaseSchemaHolder.itemConfigurations()).thenReturn(itemConfigurations);
  final DynamoDbTemplate dynamoDbTemplate=new DynamoDbTemplate(mockDatabaseSchemaHolder);
  dynamoDbTemplate.initialize(mockAmazonDynamoDbClient);
  final Collection<StubItem> returnedItems=dynamoDbTemplate.fetch(query,StubItem.class);
  verify(mockAmazonDynamoDbClient,never()).query(any(QueryRequest.class));
  assertTrue(returnedItems.isEmpty());
}
Program: 11305
Project: 11305
Buggy source:
@Autowired public RestResourceConfig(final ApplicationContext applicationContext){
  property("String_Node_Str",applicationContext);
  scanner=new ClassPathScanningCandidateComponentProvider(true);
  scanner.resetFilters(false);
  scanner.addIncludeFilter(new AnnotationTypeFilter(Path.class));
  scanner.addIncludeFilter(new AnnotationTypeFilter(Provider.class));
  register(RequestContextFilter.class);
  register(MultiPartFeature.class);
  register(ObjectMapperProvider.class);
  register(JacksonFeature.class);
  registerResources("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  property(ServerProperties.LOCATION_HEADER_RELATIVE_URI_RESOLUTION_DISABLED,true);
}

Fixed version (ground truth):
@Autowired public RestResourceConfig(final ApplicationContext applicationContext){
  property("String_Node_Str",applicationContext);
  scanner=new ClassPathScanningCandidateComponentProvider(true);
  scanner.resetFilters(false);
  scanner.addIncludeFilter(new AnnotationTypeFilter(Path.class));
  scanner.addIncludeFilter(new AnnotationTypeFilter(Provider.class));
  register(RequestContextFilter.class);
  register(MultiPartFeature.class);
  register(ObjectMapperProvider.class);
  register(JacksonFeature.class);
  registerResources("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  property(ServerProperties.LOCATION_HEADER_RELATIVE_URI_RESOLUTION_DISABLED,true);
}
Program: 11309
Project: 11309
Buggy source:
@BeforeClass public static void createTables() throws Exception {
  amazonDynamoDbClient=new AmazonDynamoDBClient(new BasicAWSCredentials(AwsIntegration.getAccessKeyId(),AwsIntegration.getSecretKeyId()));
  amazonDynamoDbClient.setEndpoint(AwsIntegration.getDynamoDbEndpoint());
  dataGenerator=new DynamoDbDataGenerator(amazonDynamoDbClient);
  dataGenerator.createStubItemTable();
  dataGenerator.createStubItemWithRangeTable();
  dataGenerator.createStubItemWithGlobalSecondaryIndexTable();
}

Fixed version (ground truth):
@BeforeClass public static void createTables() throws Exception {
  amazonDynamoDbClient=new AmazonDynamoDBClient(new BasicAWSCredentials(AwsIntegration.getAccessKeyId(),AwsIntegration.getSecretKeyId()));
  amazonDynamoDbClient.setEndpoint(AwsIntegration.getDynamoDbEndpoint());
  dataGenerator=new DynamoDbDataGenerator(amazonDynamoDbClient);
  dataGenerator.createStubItemTable();
  dataGenerator.createStubItemWithRangeTable();
  dataGenerator.createStubItemWithGlobalSecondaryIndexTable();
  dataGenerator.createStubItemWithHashAndRangePrimaryKeyAndCompoundGlobalSecondaryIndexTable();
}
Program: 11310
Project: 11310
Buggy source:
protected void handlePersistenceException(final PersistenceException persistenceException) throws Throwable {
  if (persistenceExceptionHandlers.isEmpty()) {
    throw persistenceException;
  }
  for (  final PersistenceExceptionHandler<?> persistenceExceptionHandler : persistenceExceptionHandlers) {
    Method method;
    try {
      method=getPersistenceHandlerMethod(persistenceExceptionHandler,persistenceException);
    }
 catch (    final NoSuchMethodException e) {
      continue;
    }
    try {
      method.setAccessible(true);
      method.invoke(persistenceExceptionHandler,persistenceException);
    }
 catch (    IllegalAccessException|IllegalArgumentException e) {
      continue;
    }
catch (    final InvocationTargetException handlerException) {
      throw handlerException.getCause();
    }
  }
}

Fixed version (ground truth):
protected void handlePersistenceException(final PersistenceException persistenceException) throws Throwable {
  if (persistenceExceptionHandlers.isEmpty()) {
    throw persistenceException;
  }
  boolean foundPersistenceExceptionHandlerMethod=false;
  for (  final PersistenceExceptionHandler<?> persistenceExceptionHandler : persistenceExceptionHandlers) {
    Method method;
    try {
      method=getPersistenceHandlerMethod(persistenceExceptionHandler,persistenceException);
    }
 catch (    final NoSuchMethodException e) {
      continue;
    }
    try {
      foundPersistenceExceptionHandlerMethod=true;
      method.setAccessible(true);
      method.invoke(persistenceExceptionHandler,persistenceException);
    }
 catch (    IllegalAccessException|IllegalArgumentException e) {
      continue;
    }
catch (    final InvocationTargetException handlerException) {
      throw handlerException.getCause();
    }
  }
  if (!foundPersistenceExceptionHandlerMethod) {
    throw persistenceException;
  }
}
Program: 11311
Project: 11311
Buggy source:
public boolean isEnabled(final Feature feature){
  return enabledFeatures(FeaturesContextHolder.get().featureSetId()).contains(feature);
}

Fixed version (ground truth):
public boolean isEnabled(final Feature feature){
  final FeaturesContext featuresContext=FeaturesContextHolder.get();
  return featuresContext != null && enabledFeatures(featuresContext.featureSetId()).contains(feature);
}
Program: 11313
Project: 11313
Buggy source:
@Test public void shouldCreateDefaultSearchOptionsWithNewSortOrder(){
  final SortOrder order=new SortOrder();
  final SearchOptions options=new SearchOptions().withSortOrder(order);
  assertEquals(order,options.getSortOrder());
  assertNotEquals(SortOrder.DEFAULT,options.getSortOrder());
}

Fixed version (ground truth):
@Test public void shouldCreateDefaultSearchOptionsWithNewSortOrder(){
  final SortOrder order=new SortOrder();
  final SearchOptions options=new SearchOptions().withSortOrder(order);
  assertEquals(order,options.getSortOrder());
  assertTrue(SortOrder.DEFAULT != options.getSortOrder());
}
Program: 11314
Project: 11314
Buggy source:
@Test(expected=IllegalArgumentException.class) public void shouldFailSetDefaultSearchOptionsWithNullSortOrder(){
  final SearchOptions options=new SearchOptions();
  options.setExpressions(null);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void shouldFailSetDefaultSearchOptionsWithNullSortOrder(){
  final SearchOptions options=new SearchOptions();
  options.setSortOrder(null);
}
Program: 11315
Project: 11315
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public <T extends Item>T update(final T item,final PersistenceExceptionHandler<?>... persistenceExceptionHandlers){
  final ItemId itemId=getItemId(item);
  final Class<? extends Item> itemType=item.getClass();
  final String tableName=getItemTableName(itemType);
  final SerializedItem oldSerializedItem=getItemMap(tableName).get(itemId);
  if (oldSerializedItem == null) {
    return create(item);
  }
  final T oldItem=(T)oldSerializedItem.getEntity(item.getClass());
  if (!item.getVersion().equals(oldItem.getVersion())) {
    throw new IllegalAccessError("String_Node_Str" + item.getVersion() + "String_Node_Str"+ oldItem.getVersion()+ "String_Node_Str");
  }
  deleteUniqueConstraints(oldItem);
  createUniqueConstraints(item);
  item.setVersion(item.getVersion() + 1);
  getItemMap(tableName).put(itemId,getSerializedItem(itemId.value(),item));
  return item;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T extends Item>T update(final T item,final PersistenceExceptionHandler<?>... persistenceExceptionHandlers){
  final ItemId itemId=getItemId(item);
  final Class<? extends Item> itemType=item.getClass();
  final String tableName=getItemTableName(itemType);
  final SerializedItem oldSerializedItem=getItemMap(tableName).get(itemId);
  if (oldSerializedItem == null) {
    return create(item);
  }
  final T oldItem=(T)oldSerializedItem.getEntity(item.getClass());
  if (!item.getVersion().equals(oldItem.getVersion())) {
    throw new IllegalAccessError("String_Node_Str" + item.getVersion() + "String_Node_Str"+ oldItem.getVersion()+ "String_Node_Str");
  }
  deleteUniqueConstraints(oldItem);
  try {
    createUniqueConstraints(item);
  }
 catch (  final ItemConstraintViolationException e) {
    createUniqueConstraints(oldItem);
    throw e;
  }
  item.setVersion(item.getVersion() + 1);
  getItemMap(tableName).put(itemId,getSerializedItem(itemId.value(),item));
  return item;
}
Program: 11316
Project: 11316
Buggy source:
private void createUniqueConstraints(final Item item){
  final Class<? extends Item> itemClass=item.getClass();
  final String tableName=getItemTableName(itemClass);
  final Collection<PropertyDescriptor> uniqueConstraintProperties=getUniqueConstraintProperties(itemClass);
  for (  final PropertyDescriptor propertyDescriptor : uniqueConstraintProperties) {
    final String propertyName=propertyDescriptor.getName();
    final String uniqueConstraintKey=newUniqueConstraintKey(tableName,propertyName);
    final Map<String,ItemId> uniqueValues=uniqueConstraints.get(uniqueConstraintKey);
    Object propertyValue=null;
    try {
      propertyValue=propertyDescriptor.getReadMethod().invoke(item);
    }
 catch (    final Exception e) {
      throw new IllegalStateException("String_Node_Str",e);
    }
    if (propertyValue != null) {
      final String uniqueConstraintPropertyValue=uniqueConstraintPropertyValue(propertyValue);
      final ItemId existingItemId=uniqueValues.get(uniqueConstraintPropertyValue);
      if (existingItemId != null) {
        throw new ItemConstraintViolationException(propertyName,"String_Node_Str");
      }
      uniqueConstraints.get(uniqueConstraintKey).put(uniqueConstraintPropertyValue,getItemId(item));
    }
  }
}

Fixed version (ground truth):
private void createUniqueConstraints(final Item item){
  final Class<? extends Item> itemClass=item.getClass();
  final String tableName=getItemTableName(itemClass);
  final Collection<PropertyDescriptor> uniqueConstraintProperties=getUniqueConstraintProperties(itemClass);
  final Map<String,String> newConstraints=new HashMap<>();
  final ItemId itemId=getItemId(item);
  for (  final PropertyDescriptor propertyDescriptor : uniqueConstraintProperties) {
    final String propertyName=propertyDescriptor.getName();
    final String uniqueConstraintKey=newUniqueConstraintKey(tableName,propertyName);
    final Map<String,ItemId> uniqueValues=uniqueConstraints.get(uniqueConstraintKey);
    Object propertyValue=null;
    try {
      propertyValue=propertyDescriptor.getReadMethod().invoke(item);
    }
 catch (    final Exception e) {
      throw new IllegalStateException("String_Node_Str",e);
    }
    if (propertyValue != null) {
      final String uniqueConstraintPropertyValue=uniqueConstraintPropertyValue(propertyValue);
      final ItemId existingItemId=uniqueValues.get(uniqueConstraintPropertyValue);
      if (existingItemId != null) {
        throw new ItemConstraintViolationException(propertyName,"String_Node_Str");
      }
      newConstraints.put(uniqueConstraintKey,uniqueConstraintPropertyValue);
    }
  }
  for (  final Entry<String,String> entry : newConstraints.entrySet()) {
    final String uniqueConstraintKey=entry.getKey();
    final String uniqueConstraintPropertyValue=entry.getValue();
    uniqueConstraints.get(uniqueConstraintKey).put(uniqueConstraintPropertyValue,itemId);
  }
}
Program: 11317
Project: 11317
Buggy source:
@Test public void shouldNotUpdateItemAndUniqueConstraint_withItemExistingUpdatedUniqueConstraintValue(){
  final StubItem stubItem=dataGenerator.randomStubItem();
  final StubItem existingStubItem=dataGenerator.randomStubItem();
  final String alreadyExistingUniqueConstraint=existingStubItem.getStringProperty();
  final String uniqueConstraintAttributeName="String_Node_Str";
  final ItemConfiguration stubItemConfigurationWithUniqueConstraints=new ItemConfiguration(stubItem.getClass(),"String_Node_Str");
  stubItemConfigurationWithUniqueConstraints.registerUniqueConstraints(Arrays.asList(new UniqueConstraint(uniqueConstraintAttributeName)));
  final DatabaseSchemaHolder databaseSchemaHolderWithUniqueConstraints=databaseSchemaHolderWithItemConfiguration(stubItemConfigurationWithUniqueConstraints);
  final InMemoryDatabaseTemplate databaseTemplate=new InMemoryDatabaseTemplate(databaseSchemaHolderWithUniqueConstraints);
  databaseTemplate.create(existingStubItem);
  databaseTemplate.create(stubItem);
  stubItem.setStringProperty(alreadyExistingUniqueConstraint);
  ItemConstraintViolationException actualException=null;
  try {
    databaseTemplate.update(stubItem);
  }
 catch (  final ItemConstraintViolationException e) {
    actualException=e;
  }
  assertNotNull(actualException);
  assertTrue(databaseTemplate.hasUniqueConstraint(existingStubItem,uniqueConstraintAttributeName,alreadyExistingUniqueConstraint));
}

Fixed version (ground truth):
@Test public void shouldNotUpdateItemAndUniqueConstraint_withItemExistingUpdatedUniqueConstraintValue(){
  final StubItem stubItem=dataGenerator.randomStubItem();
  final String originalStubItemContstraintValue=stubItem.getStringProperty();
  final StubItem existingStubItem=dataGenerator.randomStubItem();
  final String alreadyExistingUniqueConstraint=existingStubItem.getStringProperty();
  final String uniqueConstraintAttributeName="String_Node_Str";
  final ItemConfiguration stubItemConfigurationWithUniqueConstraints=new ItemConfiguration(stubItem.getClass(),"String_Node_Str");
  stubItemConfigurationWithUniqueConstraints.registerUniqueConstraints(Arrays.asList(new UniqueConstraint(uniqueConstraintAttributeName)));
  final DatabaseSchemaHolder databaseSchemaHolderWithUniqueConstraints=databaseSchemaHolderWithItemConfiguration(stubItemConfigurationWithUniqueConstraints);
  final InMemoryDatabaseTemplate databaseTemplate=new InMemoryDatabaseTemplate(databaseSchemaHolderWithUniqueConstraints);
  databaseTemplate.create(existingStubItem);
  databaseTemplate.create(stubItem);
  stubItem.setStringProperty(alreadyExistingUniqueConstraint);
  ItemConstraintViolationException actualException=null;
  try {
    databaseTemplate.update(stubItem);
  }
 catch (  final ItemConstraintViolationException e) {
    actualException=e;
  }
  assertNotNull(actualException);
  assertTrue(databaseTemplate.hasUniqueConstraint(existingStubItem,uniqueConstraintAttributeName,alreadyExistingUniqueConstraint));
  assertTrue(databaseTemplate.hasUniqueConstraint(stubItem,uniqueConstraintAttributeName,originalStubItemContstraintValue));
}
Program: 11321
Project: 11321
Buggy source:
public <T extends Item>Collection<UniqueConstraint> getUpdatedUniqueConstraints(final T item,final T previousItem,final ItemConfiguration itemConfiguration){
  final Map<String,AttributeValue> previousItemAttributeMap=getAttributeMap(previousItem,itemConfiguration,item.getVersion());
  if (!previousItemAttributeMap.get(VERSION_ATTRIBUTE).getN().equals(String.valueOf(item.getVersion()))) {
    throw new ConditionalCheckFailedException("String_Node_Str");
  }
  final Collection<String> updatedProperties=getUpdateProperties(previousItemAttributeMap,getAttributeMap(item,itemConfiguration,item.getVersion()));
  final Collection<UniqueConstraint> updatedUniqueConstraints=new HashSet<>();
  for (  final UniqueConstraint uniqueConstraint : itemConfiguration.uniqueConstraints()) {
    if (updatedProperties.contains(uniqueConstraint.propertyDescriptor().getName())) {
      updatedUniqueConstraints.add(uniqueConstraint);
    }
  }
  return updatedUniqueConstraints;
}

Fixed version (ground truth):
public <T extends Item>Collection<UniqueConstraint> getUpdatedUniqueConstraints(final T item,final T previousItem,final ItemConfiguration itemConfiguration){
  final Map<String,AttributeValue> previousItemAttributeMap=getAttributeMap(previousItem,itemConfiguration,item.getVersion());
  if (!previousItemAttributeMap.get(VERSION_ATTRIBUTE).getN().equals(String.valueOf(item.getVersion()))) {
    throw new ConditionalCheckFailedException("String_Node_Str");
  }
  final Map<String,AttributeValue> updateItemAttributeMap=getAttributeMap(item,itemConfiguration,item.getVersion());
  final Collection<String> updatedProperties=getUpdateProperties(previousItemAttributeMap,updateItemAttributeMap);
  final Collection<UniqueConstraint> updatedUniqueConstraints=new HashSet<>();
  for (  final UniqueConstraint uniqueConstraint : itemConfiguration.uniqueConstraints()) {
    final String propertyName=uniqueConstraint.propertyDescriptor().getName();
    if (updatedProperties.contains(propertyName)) {
      final AttributeValue previousAttributeValue=previousItemAttributeMap.get(propertyName);
      final AttributeValue updatedAttributeValue=updateItemAttributeMap.get(propertyName);
      if (previousAttributeValue == null || updatedAttributeValue == null || !previousAttributeValue.getS().equalsIgnoreCase(updatedAttributeValue.getS())) {
        updatedUniqueConstraints.add(uniqueConstraint);
      }
    }
  }
  return updatedUniqueConstraints;
}
Program: 11322
Project: 11322
Buggy source:
private UploadDocumentsRequest uploadDocumentsRequest(final BatchDocumentUpdateRequest batchDocumentUpdateRequest){
  final UploadDocumentsRequest uploadDocumentsRequest=new UploadDocumentsRequest();
  final byte[] documentUpdatesJsonBytes;
  documentUpdatesJsonBytes=JsonDocumentUpdateMarshaller.marshall(batchDocumentUpdateRequest.getDocumentUpdates()).getBytes(Charset.forName("String_Node_Str"));
  final InputStream documents=new ByteArrayInputStream(documentUpdatesJsonBytes);
  uploadDocumentsRequest.setDocuments(documents);
  uploadDocumentsRequest.setContentLength((long)documentUpdatesJsonBytes.length);
  uploadDocumentsRequest.setContentType(MediaType.APPLICATION_JSON);
  return uploadDocumentsRequest;
}

Fixed version (ground truth):
private UploadDocumentsRequest uploadDocumentsRequest(final BatchDocumentUpdateRequest batchDocumentUpdateRequest){
  final UploadDocumentsRequest uploadDocumentsRequest=new UploadDocumentsRequest();
  final byte[] documentUpdatesJsonBytes;
  final String documentUpdatesJson=JsonDocumentUpdateMarshaller.marshall(batchDocumentUpdateRequest.getDocumentUpdates());
  documentUpdatesJsonBytes=documentUpdatesJson.getBytes(Charset.forName("String_Node_Str"));
  final InputStream documents=new ByteArrayInputStream(documentUpdatesJsonBytes);
  uploadDocumentsRequest.setDocuments(documents);
  uploadDocumentsRequest.setContentLength((long)documentUpdatesJsonBytes.length);
  uploadDocumentsRequest.setContentType(MediaType.APPLICATION_JSON);
  return uploadDocumentsRequest;
}