nus-yam/ex-repair huggingface dataset:
Program: 126633
Project: 126633
Buggy source:
@Test public void testIsSame(){
  ItemRecord itemRecord1=mock(ItemRecord.class);
  Property property1=mock(Property.class);
  when(itemRecord1.getProperty()).thenReturn(property1);
  when(property1.getId()).thenReturn("String_Node_Str");
  when(property1.getLabel()).thenReturn("String_Node_Str");
  ItemRecord itemRecord2=mock(ItemRecord.class);
  Property property2=mock(Property.class);
  when(itemRecord2.getProperty()).thenReturn(property2);
  when(property2.getId()).thenReturn("String_Node_Str");
  when(property2.getLabel()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertTrue(basicHandler.isSame(itemRecord1,itemRecord2));
}

Fixed version (ground truth):
@Test public void testIsSame(){
  ImportItem ImportItem1=mock(ImportItem.class);
  Property property1=mock(Property.class);
  when(ImportItem1.getProperty()).thenReturn(property1);
  when(property1.getId()).thenReturn("String_Node_Str");
  when(property1.getLabel()).thenReturn("String_Node_Str");
  ImportItem ImportItem2=mock(ImportItem.class);
  Property property2=mock(Property.class);
  when(ImportItem2.getProperty()).thenReturn(property2);
  when(property2.getId()).thenReturn("String_Node_Str");
  when(property2.getLabel()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertTrue(basicHandler.isSame(ImportItem1,ImportItem2));
}
Program: 126634
Project: 126634
Buggy source:
@Test public void testCheckItem() throws Exception {
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=new ItemRecord(processPropPath1);
  itemRecord.setItemName(processPropPath1.lastSegment());
  Property property=mock(Property.class);
  itemRecord.setProperty(property);
  ProcessItem item=PropertiesFactory.eINSTANCE.createProcessItem();
  when(property.getItem()).thenReturn(item);
  ResourcesManager resManager=mock(ResourcesManager.class);
  Set<IPath> pathes=new HashSet<IPath>();
  IPath projPath=new Path("String_Node_Str" + FileConstants.LOCAL_PROJECT_FILENAME);
  pathes.add(projPath);
  pathes.add(processPropPath1);
  pathes.add(processItemPath1);
  Assert.assertFalse(basicHandler.checkItem(resManager,itemRecord,false));
  Assert.assertFalse(itemRecord.getErrors().isEmpty());
  ItemState itemState=PropertiesFactory.eINSTANCE.createItemState();
  item.setState(itemState);
  Assert.assertTrue(basicHandler.checkItem(resManager,itemRecord,false));
  itemRecord.setState(State.NAME_AND_ID_EXISTED);
  Assert.assertTrue(basicHandler.checkItem(resManager,itemRecord,true));
  Assert.assertTrue(basicHandler.checkItem(resManager,itemRecord,true));
  Assert.assertTrue(itemRecord.getErrors().size() == 1);
}

Fixed version (ground truth):
@Test public void testCheckItem() throws Exception {
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ImportItem ImportItem=new ImportItem(processPropPath1);
  ImportItem.setItemName(processPropPath1.lastSegment());
  Property property=mock(Property.class);
  ImportItem.setProperty(property);
  ProcessItem item=PropertiesFactory.eINSTANCE.createProcessItem();
  when(property.getItem()).thenReturn(item);
  ResourcesManager resManager=mock(ResourcesManager.class);
  Set<IPath> pathes=new HashSet<IPath>();
  IPath projPath=new Path("String_Node_Str" + FileConstants.LOCAL_PROJECT_FILENAME);
  pathes.add(projPath);
  pathes.add(processPropPath1);
  pathes.add(processItemPath1);
  Assert.assertFalse(basicHandler.checkItem(resManager,ImportItem,false));
  Assert.assertFalse(ImportItem.getErrors().isEmpty());
  ItemState itemState=PropertiesFactory.eINSTANCE.createItemState();
  item.setState(itemState);
  Assert.assertTrue(basicHandler.checkItem(resManager,ImportItem,false));
  ImportItem.setState(State.NAME_AND_ID_EXISTED);
  Assert.assertTrue(basicHandler.checkItem(resManager,ImportItem,true));
  Assert.assertTrue(basicHandler.checkItem(resManager,ImportItem,true));
  Assert.assertTrue(ImportItem.getErrors().size() == 1);
}
Program: 126635
Project: 126635
Buggy source:
@Test public void testResolveItem4ValidItem() throws Exception {
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=new ItemRecord(processPropPath1);
  itemRecord.setItemName(processPropPath1.lastSegment());
  Property property=mock(Property.class);
  itemRecord.setProperty(property);
  ProcessItem processItem=createTempProcessItem();
  when(property.getItem()).thenReturn(processItem);
  ResourcesManager resManager=mock(ResourcesManager.class);
  Set<IPath> pathes=new HashSet<IPath>();
  IPath projPath=new Path("String_Node_Str" + FileConstants.LOCAL_PROJECT_FILENAME);
  pathes.add(projPath);
  pathes.add(processPropPath1);
  pathes.add(processItemPath1);
  when(resManager.getPaths()).thenReturn(pathes);
  when(resManager.getStream(processItemPath1)).thenReturn(new InputStream(){
    @Override public int read() throws IOException {
      return 1;
    }
  }
);
  basicHandler.resolveItem(resManager,itemRecord);
  Assert.assertTrue(itemRecord.getErrors().isEmpty());
  Assert.assertTrue(itemRecord.isValid());
  Assert.assertTrue(itemRecord.getErrors().size() == 0);
}

Fixed version (ground truth):
@Test public void testResolveItem4ValidItem() throws Exception {
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ImportItem ImportItem=new ImportItem(processPropPath1);
  ImportItem.setItemName(processPropPath1.lastSegment());
  Property property=mock(Property.class);
  ImportItem.setProperty(property);
  ProcessItem processItem=createTempProcessItem();
  when(property.getItem()).thenReturn(processItem);
  ResourcesManager resManager=mock(ResourcesManager.class);
  Set<IPath> pathes=new HashSet<IPath>();
  IPath projPath=new Path("String_Node_Str" + FileConstants.LOCAL_PROJECT_FILENAME);
  pathes.add(projPath);
  pathes.add(processPropPath1);
  pathes.add(processItemPath1);
  when(resManager.getPaths()).thenReturn(pathes);
  when(resManager.getStream(processItemPath1)).thenReturn(new InputStream(){
    @Override public int read() throws IOException {
      return 1;
    }
  }
);
  basicHandler.resolveItem(resManager,ImportItem);
  Assert.assertTrue(ImportItem.getErrors().isEmpty());
  Assert.assertTrue(ImportItem.isValid());
  Assert.assertTrue(ImportItem.getErrors().size() == 0);
}
Program: 126636
Project: 126636
Buggy source:
@Test public void testIsSameName4DiffLabel(){
  ItemRecord itemRecord1=mock(ItemRecord.class);
  Property property1=mock(Property.class);
  when(itemRecord1.getProperty()).thenReturn(property1);
  when(property1.getLabel()).thenReturn("String_Node_Str");
  IRepositoryViewObject repViewObj=mock(IRepositoryViewObject.class);
  when(repViewObj.getLabel()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertFalse(basicHandler.isSameName(itemRecord1,repViewObj));
}

Fixed version (ground truth):
@Test public void testIsSameName4DiffLabel(){
  ImportItem ImportItem1=mock(ImportItem.class);
  Property property1=mock(Property.class);
  when(ImportItem1.getProperty()).thenReturn(property1);
  when(property1.getLabel()).thenReturn("String_Node_Str");
  IRepositoryViewObject repViewObj=mock(IRepositoryViewObject.class);
  when(repViewObj.getLabel()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertFalse(basicHandler.isSameName(ImportItem1,repViewObj));
}
Program: 126637
Project: 126637
Buggy source:
@Test public void testResolveItem4MissItemFile() throws Exception {
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=new ItemRecord(processPropPath1);
  itemRecord.setItemName(processPropPath1.lastSegment());
  Property property=mock(Property.class);
  itemRecord.setProperty(property);
  ProcessItem item=PropertiesFactory.eINSTANCE.createProcessItem();
  when(property.getItem()).thenReturn(item);
  ResourcesManager resManager=mock(ResourcesManager.class);
  Set<IPath> pathes=new HashSet<IPath>();
  IPath projPath=new Path("String_Node_Str" + FileConstants.LOCAL_PROJECT_FILENAME);
  pathes.add(projPath);
  pathes.add(processPropPath1);
  when(resManager.getPaths()).thenReturn(pathes);
  basicHandler.resolveItem(resManager,itemRecord);
  Assert.assertFalse(itemRecord.getErrors().isEmpty());
  Assert.assertFalse(itemRecord.isValid());
  Assert.assertTrue(itemRecord.getErrors().size() == 1);
}

Fixed version (ground truth):
@Test public void testResolveItem4MissItemFile() throws Exception {
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ImportItem ImportItem=new ImportItem(processPropPath1);
  ImportItem.setItemName(processPropPath1.lastSegment());
  Property property=mock(Property.class);
  ImportItem.setProperty(property);
  ProcessItem item=PropertiesFactory.eINSTANCE.createProcessItem();
  when(property.getItem()).thenReturn(item);
  ResourcesManager resManager=mock(ResourcesManager.class);
  Set<IPath> pathes=new HashSet<IPath>();
  IPath projPath=new Path("String_Node_Str" + FileConstants.LOCAL_PROJECT_FILENAME);
  pathes.add(projPath);
  pathes.add(processPropPath1);
  when(resManager.getPaths()).thenReturn(pathes);
  basicHandler.resolveItem(resManager,ImportItem);
  Assert.assertFalse(ImportItem.getErrors().isEmpty());
  Assert.assertFalse(ImportItem.isValid());
  Assert.assertTrue(ImportItem.getErrors().size() == 1);
}
Program: 126638
Project: 126638
Buggy source:
/** 
 * DOC sgandon ImportButtonSelectionListener constructor comment.
 * @param item
 */
public ImportButtonSelectionListener(TableItem item){
  this.item=item;
}

Fixed version (ground truth):
/** 
 * DOC sgandon ImportButtonSelectionListener constructor comment.
 * @param item
 */
public ImportButtonSelectionListener(AtomicInteger enabledButtonCount,TableItem item){
  this.item=item;
  this.enabledButtonCount=enabledButtonCount;
}
Program: 126639
Project: 126639
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  showImportJarDialog(item);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  showImportJarDialog(enabledButtonCount,item);
}
Program: 126640
Project: 126640
Buggy source:
/** 
 * DOC sgandon Comment method "updateManualImportedJars".
 * @param importedJars
 */
private void updateManualImportedJars(String[] importedJars){
  for (  Entry<ModuleToInstall,Button> moduleAndButton : manualInstallButtonMap.entrySet()) {
    String jarName=moduleAndButton.getKey().getName();
    for (    String importedJar : importedJars) {
      if (importedJar.equals(jarName)) {
        moduleAndButton.getValue().setEnabled(false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC sgandon Comment method "updateManualImportedJars".
 * @param importedJars
 */
private void updateManualImportedJars(AtomicInteger enabledButtonCount,String[] importedJars){
  for (  Entry<ModuleToInstall,Button> moduleAndButton : manualInstallButtonMap.entrySet()) {
    String jarName=moduleAndButton.getKey().getName();
    for (    String importedJar : importedJars) {
      if (importedJar.equals(jarName)) {
        moduleAndButton.getValue().setEnabled(false);
        enabledButtonCount.decrementAndGet();
      }
    }
  }
  if (enabledButtonCount.get() == 0) {
    close();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
      IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
      if (service != null) {
        service.refreshComponentView();
      }
    }
  }
}
Program: 126642
Project: 126642
Buggy source:
/** 
 * DOC sgandon Comment method "showImportJarDialog".
 * @param item
 */
public void showImportJarDialog(TableItem item){
  String[] importedJars=new ImportExternalJarAction().handleImportJarDialog(getShell());
  updateManualImportedJars(importedJars);
}

Fixed version (ground truth):
/** 
 * DOC sgandon Comment method "showImportJarDialog".
 * @param item
 */
public void showImportJarDialog(AtomicInteger enabledButtonCount,TableItem item){
  String[] importedJars=new ImportExternalJarAction().handleImportJarDialog(getShell());
  updateManualImportedJars(enabledButtonCount,importedJars);
}
Program: 126643
Project: 126643
Buggy source:
@Override public void setParameters(IElement element,IMetadataTable metadataTable,String schema,String realTableName,boolean isJdbc){
  super.setParameters(element,metadataTable,schema,realTableName,isJdbc);
  standardSyntax=CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.AS400_SQL_SEG);
  if (getElement() != null) {
    IElementParameter parentParam=getElement().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    if (parentParam != null && parentParam.getChildParameters() != null) {
      IElementParameter param=parentParam.getChildParameters().get("String_Node_Str");
      if (param != null && "String_Node_Str".equals(param.getValue())) {
        param=parentParam.getChildParameters().get("String_Node_Str");
        if (param != null && param.getValue() != null) {
          try {
            IRepositoryViewObject lastVersion=CorePlugin.getDefault().getProxyRepositoryFactory().getLastVersion((String)param.getValue());
            if (lastVersion != null) {
              Item item=lastVersion.getProperty().getItem();
              if (item != null && item instanceof DatabaseConnectionItem) {
                standardSyntax=((DatabaseConnection)((DatabaseConnectionItem)item).getConnection()).isStandardSQL();
              }
            }
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void setParameters(IElement element,IMetadataTable metadataTable,String schema,String realTableName,boolean isJdbc){
  super.setParameters(element,metadataTable,schema,realTableName,isJdbc);
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
    ICoreUIService service=(ICoreUIService)GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
    standardSyntax=service.getPreferenceStore().getBoolean(ITalendCorePrefConstants.AS400_SQL_SEG);
  }
  if (getElement() != null) {
    IElementParameter parentParam=getElement().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    if (parentParam != null && parentParam.getChildParameters() != null) {
      IElementParameter param=parentParam.getChildParameters().get("String_Node_Str");
      if (param != null && "String_Node_Str".equals(param.getValue())) {
        param=parentParam.getChildParameters().get("String_Node_Str");
        if (param != null && param.getValue() != null) {
          try {
            IRepositoryViewObject lastVersion=CorePlugin.getDefault().getProxyRepositoryFactory().getLastVersion((String)param.getValue());
            if (lastVersion != null) {
              Item item=lastVersion.getProperty().getItem();
              if (item != null && item instanceof DatabaseConnectionItem) {
                standardSyntax=((DatabaseConnection)((DatabaseConnectionItem)item).getConnection()).isStandardSQL();
              }
            }
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
        }
      }
    }
  }
}
Program: 126644
Project: 126644
Buggy source:
public static String getEncryptedValue(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  try {
    String removeQuotes=TalendQuoteUtils.removeQuotes(value);
    removeQuotes=TalendQuoteUtils.checkSlashAndRemoveQuotation(removeQuotes);
    removeQuotes=TalendQuoteUtils.checkAndRemoveBackslashes(removeQuotes);
    value=PasswordEncryptUtil.encryptPassword(removeQuotes);
    value=TalendQuoteUtils.addQuotes(value,TalendQuoteUtils.QUOTATION_MARK);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return value;
}

Fixed version (ground truth):
public static String getEncryptedValue(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  try {
    String removeQuotes=TalendQuoteUtils.removeQuotes(value);
    removeQuotes=TalendQuoteUtils.checkSlashAndRemoveQuotation(removeQuotes);
    removeQuotes=TalendQuoteUtils.checkAndRemoveBackslashes(removeQuotes);
    value=PasswordEncryptUtil.encryptPasswordHex(removeQuotes);
    value=TalendQuoteUtils.addQuotes(value,TalendQuoteUtils.QUOTATION_MARK);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return value;
}
Program: 126645
Project: 126645
Buggy source:
/** 
 * Getter for linksManager.
 * @return the linksManager
 */
protected LinksManager<TableItem,D1,Table,D2> getLinksManager(){
  return this.linksManager;
}

Fixed version (ground truth):
/** 
 * Getter for linksManager.
 * @return the linksManager
 */
public LinksManager<TableItem,D1,Table,D2> getLinksManager(){
  return this.linksManager;
}
Program: 126646
Project: 126646
Buggy source:
private static boolean updateQueryObject(Object parameter,boolean show,boolean onlySimpleShow,RepositoryNode node){
  Item item=node.getObject().getProperty().getItem();
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  List<IRepositoryViewObject> updateList=new ArrayList<IRepositoryViewObject>();
  List<Relation> relations=null;
  if (parameter instanceof Query) {
    String id=item.getProperty().getId() + "String_Node_Str" + ((Query)parameter).getLabel();
    relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(id,RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.QUERY_RELATION);
  }
  RepositoryUpdateManager repositoryUpdateManager=new RepositoryUpdateManager(parameter,relations,true){
    @Override public Set<EUpdateItemType> getTypes(){
      Set<EUpdateItemType> types=new HashSet<EUpdateItemType>();
      types.add(EUpdateItemType.NODE_QUERY);
      return types;
    }
  }
;
  return repositoryUpdateManager.doWork(show,onlySimpleShow);
}

Fixed version (ground truth):
private static boolean updateQueryObject(Object parameter,boolean show,boolean onlySimpleShow,RepositoryNode node){
  Item item=node.getObject().getProperty().getItem();
  List<Relation> relations=null;
  if (parameter instanceof Query) {
    String id=item.getProperty().getId();
    relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(id,RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.QUERY_RELATION);
  }
  RepositoryUpdateManager repositoryUpdateManager=new RepositoryUpdateManager(parameter,relations){
    @Override public Set<EUpdateItemType> getTypes(){
      Set<EUpdateItemType> types=new HashSet<EUpdateItemType>();
      types.add(EUpdateItemType.NODE_QUERY);
      return types;
    }
  }
;
  return repositoryUpdateManager.doWork(show,onlySimpleShow);
}
Program: 126647
Project: 126647
Buggy source:
public RepositoryUpdateManager(Object parameter,List<Relation> relations,boolean isDetectAndUpdate){
  super();
  this.parameter=parameter;
  this.relations=relations;
  this.isDetectAndUpdate=isDetectAndUpdate;
}

Fixed version (ground truth):
public RepositoryUpdateManager(Object parameter,List<Relation> relations){
  this.parameter=parameter;
  this.relations=relations;
}
Program: 126648
Project: 126648
Buggy source:
public List<UpdateResult> checkJobItemsForUpdate(IProgressMonitor parentMonitor,final Set<IUpdateItemType> types){
  if (types == null || types.isEmpty()) {
    return null;
  }
  List<IProcess2> openedProcessList=CoreRuntimePlugin.getInstance().getDesignerCoreService().getOpenedProcess(RepositoryUpdateManager.getEditors());
  try {
    List<UpdateResult> resultList=new ArrayList<UpdateResult>();
    if (enableCheckItem()) {
      checkJobItems(parentMonitor,types,openedProcessList);
    }
    for (    IProcess2 process : openedProcessList) {
      checkMonitorCanceled(parentMonitor);
      parentMonitor.subTask(RepositoryUpdateManager.getUpdateJobInfor(process.getProperty()));
      List<UpdateResult> resultFromProcess=getResultFromProcess(process,types);
      if (resultFromProcess != null) {
        resultList.addAll(resultFromProcess);
      }
      parentMonitor.worked(1);
    }
    List<UpdateResult> otherUpdateResults=getOtherUpdateResults(parentMonitor,openedProcessList,types);
    if (otherUpdateResults != null) {
      resultList.addAll(otherUpdateResults);
    }
    parentMonitor.done();
    return resultList;
  }
 catch (  PersistenceException e) {
  }
  return null;
}

Fixed version (ground truth):
public List<UpdateResult> checkJobItemsForUpdate(IProgressMonitor parentMonitor,final Set<IUpdateItemType> types){
  if (types == null || types.isEmpty()) {
    return null;
  }
  List<IProcess2> openedProcessList=CoreRuntimePlugin.getInstance().getDesignerCoreService().getOpenedProcess(RepositoryUpdateManager.getEditors());
  try {
    List<UpdateResult> resultList=new ArrayList<UpdateResult>();
    if (enableCheckItem()) {
      resultList.addAll(checkJobItems(parentMonitor,types,openedProcessList));
    }
    for (    IProcess2 process : openedProcessList) {
      checkMonitorCanceled(parentMonitor);
      parentMonitor.subTask(RepositoryUpdateManager.getUpdateJobInfor(process.getProperty()));
      List<UpdateResult> resultFromProcess=getResultFromProcess(process,types);
      if (resultFromProcess != null) {
        resultList.addAll(resultFromProcess);
      }
      parentMonitor.worked(1);
    }
    List<UpdateResult> otherUpdateResults=getOtherUpdateResults(parentMonitor,openedProcessList,types);
    if (otherUpdateResults != null) {
      resultList.addAll(otherUpdateResults);
    }
    parentMonitor.done();
    return resultList;
  }
 catch (  PersistenceException e) {
  }
  return null;
}
Program: 126649
Project: 126649
Buggy source:
private static boolean updateQueryObject(Object parameter,boolean show,boolean onlySimpleShow,RepositoryNode node){
  Item item=node.getObject().getProperty().getItem();
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  List<IRepositoryViewObject> updateList=new ArrayList<IRepositoryViewObject>();
  List<Relation> relations=null;
  if (parameter instanceof Query) {
    String id=item.getProperty().getId() + "String_Node_Str" + ((Query)parameter).getLabel();
    relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(id,RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.QUERY_RELATION);
  }
  RepositoryUpdateManager repositoryUpdateManager=new RepositoryUpdateManager(parameter,relations,true){
    @Override public Set<EUpdateItemType> getTypes(){
      Set<EUpdateItemType> types=new HashSet<EUpdateItemType>();
      types.add(EUpdateItemType.NODE_QUERY);
      return types;
    }
  }
;
  return repositoryUpdateManager.doWork(show,onlySimpleShow);
}

Fixed version (ground truth):
private static boolean updateQueryObject(Object parameter,boolean show,boolean onlySimpleShow,RepositoryNode node){
  Item item=node.getObject().getProperty().getItem();
  List<Relation> relations=null;
  if (parameter instanceof Query) {
    String id=item.getProperty().getId();
    relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(id,RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.QUERY_RELATION);
  }
  RepositoryUpdateManager repositoryUpdateManager=new RepositoryUpdateManager(parameter,relations){
    @Override public Set<EUpdateItemType> getTypes(){
      Set<EUpdateItemType> types=new HashSet<EUpdateItemType>();
      types.add(EUpdateItemType.NODE_QUERY);
      return types;
    }
  }
;
  return repositoryUpdateManager.doWork(show,onlySimpleShow);
}
Program: 126650
Project: 126650
Buggy source:
public RepositoryUpdateManager(Object parameter,List<Relation> relations,boolean isDetectAndUpdate){
  super();
  this.parameter=parameter;
  this.relations=relations;
  this.isDetectAndUpdate=isDetectAndUpdate;
}

Fixed version (ground truth):
public RepositoryUpdateManager(Object parameter,List<Relation> relations){
  this.parameter=parameter;
  this.relations=relations;
}
Program: 126651
Project: 126651
Buggy source:
public List<UpdateResult> checkJobItemsForUpdate(IProgressMonitor parentMonitor,final Set<IUpdateItemType> types){
  if (types == null || types.isEmpty()) {
    return null;
  }
  List<IProcess2> openedProcessList=CoreRuntimePlugin.getInstance().getDesignerCoreService().getOpenedProcess(RepositoryUpdateManager.getEditors());
  try {
    List<UpdateResult> resultList=new ArrayList<UpdateResult>();
    if (enableCheckItem()) {
      checkJobItems(parentMonitor,types,openedProcessList);
    }
    for (    IProcess2 process : openedProcessList) {
      checkMonitorCanceled(parentMonitor);
      parentMonitor.subTask(RepositoryUpdateManager.getUpdateJobInfor(process.getProperty()));
      List<UpdateResult> resultFromProcess=getResultFromProcess(process,types);
      if (resultFromProcess != null) {
        resultList.addAll(resultFromProcess);
      }
      parentMonitor.worked(1);
    }
    List<UpdateResult> otherUpdateResults=getOtherUpdateResults(parentMonitor,openedProcessList,types);
    if (otherUpdateResults != null) {
      resultList.addAll(otherUpdateResults);
    }
    parentMonitor.done();
    return resultList;
  }
 catch (  PersistenceException e) {
  }
  return null;
}

Fixed version (ground truth):
public List<UpdateResult> checkJobItemsForUpdate(IProgressMonitor parentMonitor,final Set<IUpdateItemType> types){
  if (types == null || types.isEmpty()) {
    return null;
  }
  List<IProcess2> openedProcessList=CoreRuntimePlugin.getInstance().getDesignerCoreService().getOpenedProcess(RepositoryUpdateManager.getEditors());
  try {
    List<UpdateResult> resultList=new ArrayList<UpdateResult>();
    if (enableCheckItem()) {
      resultList.addAll(checkJobItems(parentMonitor,types,openedProcessList));
    }
    for (    IProcess2 process : openedProcessList) {
      checkMonitorCanceled(parentMonitor);
      parentMonitor.subTask(RepositoryUpdateManager.getUpdateJobInfor(process.getProperty()));
      List<UpdateResult> resultFromProcess=getResultFromProcess(process,types);
      if (resultFromProcess != null) {
        resultList.addAll(resultFromProcess);
      }
      parentMonitor.worked(1);
    }
    List<UpdateResult> otherUpdateResults=getOtherUpdateResults(parentMonitor,openedProcessList,types);
    if (otherUpdateResults != null) {
      resultList.addAll(otherUpdateResults);
    }
    parentMonitor.done();
    return resultList;
  }
 catch (  PersistenceException e) {
  }
  return null;
}
Program: 126652
Project: 126652
Buggy source:
public static String renameValues(final String value,final String oldName,final String newName,boolean flag){
  if (value == null || oldName == null || newName == null) {
    return value;
  }
  PatternCompiler compiler=new Perl5Compiler();
  Perl5Matcher matcher=new Perl5Matcher();
  matcher.setMultiline(true);
  Perl5Substitution substitution=new Perl5Substitution(newName + "String_Node_Str",Perl5Substitution.INTERPOLATE_ALL);
  Pattern pattern;
  try {
    pattern=compiler.compile(getQuotePattern(oldName));
  }
 catch (  MalformedPatternException e) {
    return value;
  }
  if (matcher.contains(value,pattern)) {
    String returnValue="String_Node_Str";
    if (value.contains(TalendQuoteUtils.getQuoteChar()) && !flag) {
      returnValue=splitQueryData(matcher,pattern,substitution,value,Util.SUBSTITUTE_ALL);
    }
 else {
      returnValue=Util.substitute(matcher,pattern,substitution,value,Util.SUBSTITUTE_ALL);
    }
    return returnValue;
  }
  return value;
}

Fixed version (ground truth):
public static String renameValues(final String value,final String oldName,final String newName,boolean flag){
  if (value == null || oldName == null || newName == null) {
    return value;
  }
  PatternCompiler compiler=new Perl5Compiler();
  Perl5Matcher matcher=new Perl5Matcher();
  matcher.setMultiline(true);
  Perl5Substitution substitution=new Perl5Substitution(newName + "String_Node_Str",Perl5Substitution.INTERPOLATE_ALL);
  Pattern pattern;
  try {
    pattern=compiler.compile(getQuotePattern(oldName));
  }
 catch (  MalformedPatternException e) {
    return value;
  }
  if (matcher.contains(value,pattern)) {
    String returnValue="String_Node_Str";
    if (value.contains(TalendQuoteUtils.getQuoteChar()) && !flag) {
      returnValue=splitQueryData(oldName,newName,value);
    }
 else {
      returnValue=Util.substitute(matcher,pattern,substitution,value,Util.SUBSTITUTE_ALL);
    }
    return returnValue;
  }
  return value;
}
Program: 126653
Project: 126653
Buggy source:
public static String splitQueryData(PatternMatcher matcher,Pattern pattern,Substitution sub,String value,int numSubs){
  String[] split=value.split("String_Node_Str");
  int i=0;
  String replace="String_Node_Str";
  for (  String s : split) {
    if (i % 2 == 0) {
      replace=s;
      if (i != 0) {
        if (matcher.contains(value,pattern)) {
          replace=split[i].toString();
          split[i]=Util.substitute(matcher,pattern,sub,replace,numSubs);
        }
      }
    }
    i++;
  }
  String returnValue="String_Node_Str";
  for (int t=1; t < split.length; t++) {
    if (t % 2 == 0) {
      returnValue+=split[t];
    }
 else {
      returnValue+="String_Node_Str" + split[t] + "String_Node_Str";
    }
  }
  return returnValue;
}

Fixed version (ground truth):
public static String splitQueryData(String oldName,String newName,String value){
  String regex="String_Node_Str";
  String[] split=value.split(regex);
  Map<String,String> replacedStrings=new HashMap<String,String>();
  String returnValue="String_Node_Str";
  for (  String s : split) {
    if (s.contains(oldName)) {
      replacedStrings.put(s,s.replaceAll("String_Node_Str" + oldName + "String_Node_Str",newName));
    }
  }
  java.util.regex.Pattern pattern=java.util.regex.Pattern.compile(regex);
  Matcher matcher=pattern.matcher(value);
  if (matcher.find()) {
    int x=matcher.start();
    int y=matcher.end();
    int curPos=0;
    int valueLength=value.length();
    String oldFill=null;
    String newFill=null;
    while (true) {
      if (curPos == valueLength) {
        break;
      }
      if (curPos < x) {
        oldFill=value.substring(curPos,x);
        if ((newFill=replacedStrings.get(oldFill)) != null) {
          returnValue+=newFill;
        }
 else {
          returnValue+=oldFill;
        }
        curPos=x;
        continue;
      }
      returnValue+=matcher.group();
      curPos=y;
      if (!matcher.find()) {
        x=valueLength;
      }
 else {
        x=matcher.start();
        y=matcher.end();
      }
    }
  }
  return returnValue;
}
Program: 126654
Project: 126654
Buggy source:
public static String getEncryptedValue(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  try {
    value=PasswordEncryptUtil.encryptPasswordHex(TalendQuoteUtils.removeQuotes(value));
    value=TalendQuoteUtils.addQuotes(value,TalendQuoteUtils.QUOTATION_MARK);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return value;
}

Fixed version (ground truth):
public static String getEncryptedValue(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  try {
    String removeQuotes=TalendQuoteUtils.removeQuotes(value);
    removeQuotes=TalendQuoteUtils.checkSlashAndRemoveQuotation(removeQuotes);
    removeQuotes=TalendQuoteUtils.checkAndRemoveBackslashes(removeQuotes);
    value=PasswordEncryptUtil.encryptPasswordHex(removeQuotes);
    value=TalendQuoteUtils.addQuotes(value,TalendQuoteUtils.QUOTATION_MARK);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return value;
}
Program: 126655
Project: 126655
Buggy source:
public static boolean canEncrypt(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  if (StringUtils.countMatches(value,"String_Node_Str") == 2 && value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str")) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public static boolean canEncrypt(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  if (value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str") && TalendQuoteUtils.filterQuote(value).length() == 0) {
    return true;
  }
 else {
    return false;
  }
}
Program: 126658
Project: 126658
Buggy source:
@Override public void setParameters(IElement element,IMetadataTable metadataTable,String schema,String realTableName,boolean isJdbc){
  super.setParameters(element,metadataTable,schema,realTableName,isJdbc);
  standardSyntax=CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.AS400_SQL_SEG);
  if (getElement() != null) {
    IElementParameter parentParam=getElement().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    if (parentParam != null && parentParam.getChildParameters() != null) {
      IElementParameter param=parentParam.getChildParameters().get("String_Node_Str");
      if (param != null && "String_Node_Str".equals(param.getValue())) {
        param=parentParam.getChildParameters().get("String_Node_Str");
        if (param != null && param.getValue() != null) {
          try {
            IRepositoryViewObject lastVersion=CorePlugin.getDefault().getProxyRepositoryFactory().getLastVersion((String)param.getValue());
            if (lastVersion != null) {
              Item item=lastVersion.getProperty().getItem();
              if (item != null && item instanceof DatabaseConnectionItem) {
                standardSyntax=((DatabaseConnection)((DatabaseConnectionItem)item).getConnection()).isStandardSQL();
              }
            }
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void setParameters(IElement element,IMetadataTable metadataTable,String schema,String realTableName,boolean isJdbc){
  super.setParameters(element,metadataTable,schema,realTableName,isJdbc);
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
    ICoreUIService service=(ICoreUIService)GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
    standardSyntax=service.getPreferenceStore().getBoolean(ITalendCorePrefConstants.AS400_SQL_SEG);
  }
  if (getElement() != null) {
    IElementParameter parentParam=getElement().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    if (parentParam != null && parentParam.getChildParameters() != null) {
      IElementParameter param=parentParam.getChildParameters().get("String_Node_Str");
      if (param != null && "String_Node_Str".equals(param.getValue())) {
        param=parentParam.getChildParameters().get("String_Node_Str");
        if (param != null && param.getValue() != null) {
          try {
            IRepositoryViewObject lastVersion=CorePlugin.getDefault().getProxyRepositoryFactory().getLastVersion((String)param.getValue());
            if (lastVersion != null) {
              Item item=lastVersion.getProperty().getItem();
              if (item != null && item instanceof DatabaseConnectionItem) {
                standardSyntax=((DatabaseConnection)((DatabaseConnectionItem)item).getConnection()).isStandardSQL();
              }
            }
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
        }
      }
    }
  }
}
Program: 126659
Project: 126659
Buggy source:
/** 
 * Get DatabaseConnection Instance
 * @param dbUrlType the type of you want to fill database
 * @return
 */
public static MetadataFillFactory getDBInstance(SupportDBUrlType dbUrlType){
  if (instance == null) {
    instance=new MetadataFillFactory();
  }
switch (dbUrlType) {
case SYBASEDEFAULTURL:
    metadataFiller=new SybaseConnectionFillerImpl();
  break;
default :
metadataFiller=DBmetadataFiller;
}
return instance;
}

Fixed version (ground truth):
/** 
 * Get DatabaseConnection Instance
 * @param eDatabaseType the type of you want to fill database
 * @return
 */
public static MetadataFillFactory getDBInstance(EDatabaseTypeName eDatabaseType){
  if (instance == null) {
    instance=new MetadataFillFactory();
  }
switch (eDatabaseType) {
case SYBASEASE:
case SYBASEIQ:
    metadataFiller=new SybaseConnectionFillerImpl();
  break;
default :
metadataFiller=DBmetadataFiller;
}
return instance;
}
Program: 126661
Project: 126661
Buggy source:
/** 
 * DOC sgandon ImportButtonSelectionListener constructor comment.
 * @param item
 */
public ImportButtonSelectionListener(TableItem item){
  this.item=item;
}

Fixed version (ground truth):
/** 
 * DOC sgandon ImportButtonSelectionListener constructor comment.
 * @param item
 */
public ImportButtonSelectionListener(AtomicInteger enabledButtonCount,TableItem item){
  this.item=item;
  this.enabledButtonCount=enabledButtonCount;
}
Program: 126662
Project: 126662
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  showImportJarDialog(item);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  showImportJarDialog(enabledButtonCount,item);
}
Program: 126663
Project: 126663
Buggy source:
/** 
 * DOC sgandon Comment method "updateManualImportedJars".
 * @param importedJars
 */
private void updateManualImportedJars(String[] importedJars){
  for (  Entry<ModuleToInstall,Button> moduleAndButton : manualInstallButtonMap.entrySet()) {
    String jarName=moduleAndButton.getKey().getName();
    for (    String importedJar : importedJars) {
      if (importedJar.equals(jarName)) {
        moduleAndButton.getValue().setEnabled(false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC sgandon Comment method "updateManualImportedJars".
 * @param importedJars
 */
private void updateManualImportedJars(AtomicInteger enabledButtonCount,String[] importedJars){
  for (  Entry<ModuleToInstall,Button> moduleAndButton : manualInstallButtonMap.entrySet()) {
    String jarName=moduleAndButton.getKey().getName();
    for (    String importedJar : importedJars) {
      if (importedJar.equals(jarName)) {
        moduleAndButton.getValue().setEnabled(false);
        enabledButtonCount.decrementAndGet();
      }
    }
  }
  if (enabledButtonCount.get() == 0) {
    close();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
      IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
      if (service != null) {
        service.refreshComponentView();
      }
    }
  }
}
Program: 126665
Project: 126665
Buggy source:
/** 
 * DOC sgandon Comment method "showImportJarDialog".
 * @param item
 */
public void showImportJarDialog(TableItem item){
  String[] importedJars=new ImportExternalJarAction().handleImportJarDialog(getShell());
  updateManualImportedJars(importedJars);
}

Fixed version (ground truth):
/** 
 * DOC sgandon Comment method "showImportJarDialog".
 * @param item
 */
public void showImportJarDialog(AtomicInteger enabledButtonCount,TableItem item){
  String[] importedJars=new ImportExternalJarAction().handleImportJarDialog(getShell());
  updateManualImportedJars(enabledButtonCount,importedJars);
}
Program: 126666
Project: 126666
Buggy source:
/** 
 * Test method for  {@link org.talend.core.model.metadata.MetadataFillFactory#getDBInstance(org.talend.core.database.EDatabaseTypeName)}.
 */
@Test public void testGetDBInstance(){
  MetadataFillFactory dbInstance=MetadataFillFactory.getDBInstance(EDatabaseTypeName.SYBASEASE);
  Assert.assertTrue("String_Node_Str",dbInstance.getMetadataFiller() instanceof SybaseConnectionFillerImpl);
  dbInstance=MetadataFillFactory.getDBInstance(EDatabaseTypeName.SYBASEIQ);
  Assert.assertTrue("String_Node_Str",dbInstance.getMetadataFiller() instanceof SybaseConnectionFillerImpl);
  for (  EDatabaseConnTemplate databaseType : EDatabaseConnTemplate.values()) {
    dbInstance=MetadataFillFactory.getDBInstance(EDatabaseTypeName.getTypeFromDbType(databaseType.getDBTypeName()));
    Assert.assertNotNull(dbInstance);
  }
  dbInstance=MetadataFillFactory.getDBInstance(null);
  Assert.assertNull(dbInstance);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.core.model.metadata.MetadataFillFactory#getDBInstance(org.talend.core.database.EDatabaseTypeName)}.
 */
@Test public void testGetDBInstance(){
  MetadataFillFactory dbInstance=MetadataFillFactory.getDBInstance(EDatabaseTypeName.SYBASEASE);
  Assert.assertTrue("String_Node_Str",dbInstance.getMetadataFiller() instanceof SybaseConnectionFillerImpl);
  dbInstance=MetadataFillFactory.getDBInstance(EDatabaseTypeName.SYBASEIQ);
  Assert.assertTrue("String_Node_Str",dbInstance.getMetadataFiller() instanceof SybaseConnectionFillerImpl);
  for (  EDatabaseConnTemplate databaseType : EDatabaseConnTemplate.values()) {
    dbInstance=MetadataFillFactory.getDBInstance(EDatabaseTypeName.getTypeFromDbType(databaseType.getDBTypeName()));
    Assert.assertNotNull(dbInstance);
  }
}
Program: 126667
Project: 126667
Buggy source:
public static String getEncryptedValue(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  try {
    value=PasswordEncryptUtil.encryptPassword(TalendQuoteUtils.removeQuotes(value));
    value=TalendQuoteUtils.addQuotes(value,TalendQuoteUtils.QUOTATION_MARK);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return value;
}

Fixed version (ground truth):
public static String getEncryptedValue(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  try {
    String removeQuotes=TalendQuoteUtils.removeQuotes(value);
    removeQuotes=TalendQuoteUtils.checkSlashAndRemoveQuotation(removeQuotes);
    removeQuotes=TalendQuoteUtils.checkAndRemoveBackslashes(removeQuotes);
    value=PasswordEncryptUtil.encryptPassword(removeQuotes);
    value=TalendQuoteUtils.addQuotes(value,TalendQuoteUtils.QUOTATION_MARK);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return value;
}
Program: 126668
Project: 126668
Buggy source:
public static boolean canEncrypt(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  if (StringUtils.countMatches(value,"String_Node_Str") == 2 && value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str")) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public static boolean canEncrypt(final IElement node,final String parameterName){
  String value=getValue(node,parameterName);
  if (value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str") && TalendQuoteUtils.filterQuote(value).length() == 0) {
    return true;
  }
 else {
    return false;
  }
}
Program: 126669
Project: 126669
Buggy source:
@SuppressWarnings("String_Node_Str") public static boolean isUseData(final ElementParameterType param,final String name){
  if (param == null || name == null) {
    return false;
  }
  if (param.getField().equals(EParameterFieldType.TABLE.getName())) {
    EList elementValue=param.getElementValue();
    if (elementValue != null) {
      for (      ElementValueType valueType : (List<ElementValueType>)elementValue) {
        if (valueType.getValue() != null) {
          if (ParameterValueUtil.valueContains((String)valueType.getValue(),name)) {
            return true;
          }
        }
      }
    }
  }
 else {
    String value=param.getValue();
    if (value != null && ParameterValueUtil.valueContains(value,name)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static boolean isUseData(final ElementParameterType param,final String name){
  if (param == null || name == null) {
    return false;
  }
  if (param.getField().equals(EParameterFieldType.TABLE.getName())) {
    EList elementValue=param.getElementValue();
    if (elementValue != null) {
      for (      ElementValueType valueType : (List<ElementValueType>)elementValue) {
        if (valueType.getValue() != null) {
          if (ParameterValueUtil.valueContains(valueType.getValue(),name)) {
            return true;
          }
        }
      }
    }
  }
 else {
    String value=param.getValue();
    if (value != null && ParameterValueUtil.valueContains(value,name)) {
      return true;
    }
  }
  return false;
}
Program: 126670
Project: 126670
Buggy source:
public static String renameValues(final String value,final String oldName,final String newName,boolean flag){
  if (value == null || oldName == null || newName == null) {
    return value;
  }
  PatternCompiler compiler=new Perl5Compiler();
  Perl5Matcher matcher=new Perl5Matcher();
  matcher.setMultiline(true);
  Perl5Substitution substitution=new Perl5Substitution(newName + "String_Node_Str",Perl5Substitution.INTERPOLATE_ALL);
  Pattern pattern;
  try {
    pattern=compiler.compile(getQuotePattern(oldName));
  }
 catch (  MalformedPatternException e) {
    return value;
  }
  if (matcher.contains(value,pattern)) {
    String returnValue="String_Node_Str";
    if (value.contains(TalendQuoteUtils.getQuoteChar()) && !flag) {
      returnValue=splitQueryData(matcher,pattern,substitution,value,Util.SUBSTITUTE_ALL);
    }
 else {
      returnValue=Util.substitute(matcher,pattern,substitution,value,Util.SUBSTITUTE_ALL);
    }
    return returnValue;
  }
  return value;
}

Fixed version (ground truth):
public static String renameValues(final String value,final String oldName,final String newName,boolean flag){
  if (value == null || oldName == null || newName == null) {
    return value;
  }
  PatternCompiler compiler=new Perl5Compiler();
  Perl5Matcher matcher=new Perl5Matcher();
  matcher.setMultiline(true);
  Perl5Substitution substitution=new Perl5Substitution(newName + "String_Node_Str",Perl5Substitution.INTERPOLATE_ALL);
  Pattern pattern;
  try {
    pattern=compiler.compile(getQuotePattern(oldName));
  }
 catch (  MalformedPatternException e) {
    return value;
  }
  if (matcher.contains(value,pattern)) {
    String returnValue="String_Node_Str";
    if (value.contains(TalendQuoteUtils.getQuoteChar()) && !flag) {
      returnValue=splitQueryData(oldName,newName,value);
    }
 else {
      returnValue=Util.substitute(matcher,pattern,substitution,value,Util.SUBSTITUTE_ALL);
    }
    return returnValue;
  }
  return value;
}
Program: 126671
Project: 126671
Buggy source:
public static String splitQueryData(PatternMatcher matcher,Pattern pattern,Substitution sub,String value,int numSubs){
  String[] split=value.split("String_Node_Str");
  int i=0;
  String replace="String_Node_Str";
  for (  String s : split) {
    if (i % 2 == 0) {
      replace=s;
      if (i != 0) {
        if (matcher.contains(value,pattern)) {
          replace=split[i].toString();
          split[i]=Util.substitute(matcher,pattern,sub,replace,numSubs);
        }
      }
    }
    i++;
  }
  String returnValue="String_Node_Str";
  for (int t=1; t < split.length; t++) {
    if (t % 2 == 0) {
      returnValue+=split[t];
    }
 else {
      returnValue+="String_Node_Str" + split[t] + "String_Node_Str";
    }
  }
  return returnValue;
}

Fixed version (ground truth):
public static String splitQueryData(String oldName,String newName,String value){
  String regex="String_Node_Str";
  String[] split=value.split(regex);
  Map<String,String> replacedStrings=new HashMap<String,String>();
  String returnValue="String_Node_Str";
  for (  String s : split) {
    if (s.contains(oldName)) {
      replacedStrings.put(s,s.replaceAll("String_Node_Str" + oldName + "String_Node_Str",newName));
    }
  }
  java.util.regex.Pattern pattern=java.util.regex.Pattern.compile(regex);
  Matcher matcher=pattern.matcher(value);
  if (matcher.find()) {
    int x=matcher.start();
    int y=matcher.end();
    int curPos=0;
    int valueLength=value.length();
    String oldFill=null;
    String newFill=null;
    while (true) {
      if (curPos == valueLength) {
        break;
      }
      if (curPos < x) {
        oldFill=value.substring(curPos,x);
        if ((newFill=replacedStrings.get(oldFill)) != null) {
          returnValue+=newFill;
        }
 else {
          returnValue+=oldFill;
        }
        curPos=x;
        continue;
      }
      returnValue+=matcher.group();
      curPos=y;
      if (!matcher.find()) {
        x=valueLength;
      }
 else {
        x=matcher.start();
        y=matcher.end();
      }
    }
  }
  return returnValue;
}