nus-yam/ex-repair huggingface dataset:
Program: 118350
Project: 118350
Buggy source:
@Test public void testFindMoreLibraries(){
  DummyComponent comp=Mockito.mock(DummyComponent.class);
  Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_CAMEL.getName());
  INode node=new DataNode(comp,"String_Node_Str");
  IElementParameter param=new ElementParameter(node);
  param.setName("String_Node_Str");
  List<Map<String,Object>> table=new ArrayList<Map<String,Object>>();
  Map<String,Object> line=new HashMap<String,Object>();
  line.put("String_Node_Str","String_Node_Str");
  table.add(line);
  param.setValue(table);
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  JavaProcessUtil.findMoreLibraries(null,modulesNeeded,param);
  assertTrue(modulesNeeded.isEmpty());
  table=new ArrayList<Map<String,Object>>();
  line=new HashMap<String,Object>();
  line.put("String_Node_Str","String_Node_Str");
  table.add(line);
  param.setValue(table);
  modulesNeeded=new ArrayList<ModuleNeeded>();
  JavaProcessUtil.findMoreLibraries(null,modulesNeeded,param);
  assertEquals(1,modulesNeeded.size());
  assertEquals("String_Node_Str",modulesNeeded.get(0).getModuleName());
}

Fixed version (ground truth):
@Test public void testFindMoreLibraries(){
  DummyComponent comp=mock(DummyComponent.class);
  when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_CAMEL.getName());
  INode node=new DataNode(comp,"String_Node_Str");
  IElementParameter param=new ElementParameter(node);
  param.setName("String_Node_Str");
  List<Map<String,Object>> table=new ArrayList<Map<String,Object>>();
  Map<String,Object> line=new HashMap<String,Object>();
  line.put("String_Node_Str","String_Node_Str");
  table.add(line);
  param.setValue(table);
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  JavaProcessUtil.findMoreLibraries(null,modulesNeeded,param);
  assertTrue(modulesNeeded.isEmpty());
  table=new ArrayList<Map<String,Object>>();
  line=new HashMap<String,Object>();
  line.put("String_Node_Str","String_Node_Str");
  table.add(line);
  param.setValue(table);
  modulesNeeded=new ArrayList<ModuleNeeded>();
  JavaProcessUtil.findMoreLibraries(null,modulesNeeded,param);
  assertEquals(1,modulesNeeded.size());
  assertEquals("String_Node_Str",modulesNeeded.get(0).getModuleName());
}
Program: 118351
Project: 118351
Buggy source:
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  File tmpJob=null;
  try {
    tmpJob=File.createTempFile("String_Node_Str","String_Node_Str",null);
    exportChoiceMap.put(ExportChoice.binaries,true);
    exportChoiceMap.put(ExportChoice.includeLibs,true);
    ProcessItem processItem=(ProcessItem)node.getObject().getProperty().getItem();
    BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(),processItem,processItem.getProperty().getVersion(),processItem.getProcess().getDefaultContext(),exportChoiceMap,exportType,true,monitor);
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    FeaturesModel featuresModel=getFeatureModel(tmpJob);
    process(processItem,featuresModel,monitor);
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
 finally {
    if (tmpJob != null && tmpJob.exists()) {
      tmpJob.delete();
    }
  }
}

Fixed version (ground truth):
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  File tmpJob=null;
  try {
    tmpJob=File.createTempFile("String_Node_Str","String_Node_Str",null);
    exportChoiceMap.put(ExportChoice.binaries,true);
    exportChoiceMap.put(ExportChoice.includeLibs,true);
    ProcessItem processItem=(ProcessItem)node.getObject().getProperty().getItem();
    BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(),processItem,processItem.getProperty().getVersion(),processItem.getProcess().getDefaultContext(),exportChoiceMap,exportType,monitor);
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
      IRunProcessService service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
      boolean hasError=service.checkExportProcess(new StructuredSelection(node),true);
      if (hasError) {
        return;
      }
    }
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    FeaturesModel featuresModel=getFeatureModel(tmpJob);
    process(processItem,featuresModel,monitor);
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
 finally {
    if (tmpJob != null && tmpJob.exists()) {
      tmpJob.delete();
    }
  }
}
Program: 118354
Project: 118354
Buggy source:
@Override public Map<String,EUpdateResult> getDeletedOrReselectTablesMap(){
  Map<String,EUpdateResult> drMap=new HashMap<>();
  List<IMetadataTable> newTables=getConversionMetadataTables(connectionItem.getConnection());
  for (  IMetadataTable oldTable : oldMetadataTable) {
    String prefix=connectionItem.getProperty().getId() + UpdatesConstants.SEGMENT_LINE;
    boolean isDeleted=true;
    String oldtableLabel=oldTable.getLabel();
    String oldtableId=oldTable.getId();
    for (    IMetadataTable newTable : newTables) {
      String tableLabel=newTable.getLabel();
      String tableId=newTable.getId();
      if (tableLabel.equals(oldtableLabel)) {
        isDeleted=false;
        if (!tableId.equals(oldtableId)) {
          drMap.put(prefix + tableLabel,EUpdateResult.RELOAD);
        }
      }
    }
    if (isDeleted) {
      drMap.put(prefix + oldtableLabel,EUpdateResult.DELETE);
    }
  }
  return drMap;
}

Fixed version (ground truth):
@Override public Map<String,EUpdateResult> getDeletedOrReselectTablesMap(){
  Map<String,EUpdateResult> drMap=new HashMap<>();
  List<IMetadataTable> newTables=getConversionMetadataTables(connectionItem.getConnection());
  for (  IMetadataTable oldTable : oldMetadataTable) {
    String prefix=connectionItem.getProperty().getId() + UpdatesConstants.SEGMENT_LINE;
    boolean isDeleted=true;
    String oldtableLabel=oldTable.getLabel();
    String oldtableId=oldTable.getId();
    for (    IMetadataTable newTable : newTables) {
      String tableLabel=newTable.getLabel();
      String tableId=newTable.getId();
      if (tableLabel.equals(oldtableLabel)) {
        isDeleted=false;
        if (!tableId.equals(oldtableId)) {
        }
      }
    }
    if (isDeleted) {
      drMap.put(prefix + oldtableLabel,EUpdateResult.DELETE);
    }
  }
  return drMap;
}
Program: 118355
Project: 118355
Buggy source:
public void rollback() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new DeleteMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void rollback() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new DeleteMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    method.setRequestHeader("String_Node_Str",getStickySession() + "String_Node_Str" + sessionId);
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode + "String_Node_Str");
  }
}
Program: 118356
Project: 118356
Buggy source:
public void commit() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new PostMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void commit() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new PostMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    method.setRequestHeader("String_Node_Str",getStickySession() + "String_Node_Str" + sessionId);
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode + "String_Node_Str");
  }
}
Program: 118357
Project: 118357
Buggy source:
public static MDMTransaction newTransaction(String url,String username,String password) throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  PutMethod put=new PutMethod(url);
  put.setDoAuthentication(true);
  String tid="String_Node_Str";
  try {
    client.executeMethod(put);
    tid=put.getResponseBodyAsString();
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    put.releaseConnection();
  }
  MDMTransaction result=new MDMTransaction();
  result.setUrl(url);
  result.setId(tid);
  result.setUsername(username);
  result.setPassword(password);
  return result;
}

Fixed version (ground truth):
public static MDMTransaction newTransaction(String url,String username,String password) throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  client.getParams().setAuthenticationPreemptive(true);
  PutMethod put=new PutMethod(url);
  put.setDoAuthentication(true);
  String tid;
  String sessionID;
  try {
    client.executeMethod(put);
    tid=put.getResponseBodyAsString();
    sessionID=parseSessionID(put);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    put.releaseConnection();
  }
  MDMTransaction result=new MDMTransaction();
  result.setUrl(url);
  result.setId(tid);
  result.setUsername(username);
  result.setPassword(password);
  result.setSessionId(sessionID);
  return result;
}
Program: 118358
Project: 118358
Buggy source:
public static void main(String[] args) throws IOException {
  MDMTransaction mt=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  mt.commit();
  MDMTransaction mt1=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  mt1.rollback();
  String url="String_Node_Str";
  String mdmurl=MDMTransactionClient.getMDMTransactionURL(url,true);
  System.out.println(mdmurl);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String sessionID=MDMTransactionClient.getSessionID("String_Node_Str","String_Node_Str","String_Node_Str");
  System.out.println(sessionID);
  MDMTransaction mt=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  mt.commit();
  MDMTransaction mt1=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  mt1.rollback();
  String url="String_Node_Str";
  String mdmurl=MDMTransactionClient.getMDMTransactionURL(url,true);
  System.out.println(mdmurl);
}
Program: 118359
Project: 118359
Buggy source:
@Override public List<NodeReturn> createReturns(){
  List<NodeReturn> listReturn=new ArrayList<>();
  ComponentProperties componentProperties=ComponentsUtils.getComponentProperties(getName());
  if (!(componentProperties instanceof ComponentPropertiesImpl)) {
    return listReturn;
  }
  ComponentPropertiesImpl props=(ComponentPropertiesImpl)componentProperties;
  Property returns=props.returns;
  if (returns != null) {
    NodeReturn nodeRet=null;
    for (    Object childObj : returns.getChildren()) {
      Property child=(Property)childObj;
      nodeRet=new NodeReturn();
      nodeRet.setType(ComponentsUtils.getTalendTypeFromProperty(child).getId());
      nodeRet.setDisplayName(child.getDisplayName());
      nodeRet.setName(child.getName());
      Object object=child.getTaggedValue(IGenericConstants.AVAILABILITY);
      if (object != null) {
        nodeRet.setAvailability(object.toString());
      }
 else {
        nodeRet.setAvailability("String_Node_Str");
      }
      listReturn.add(nodeRet);
    }
  }
  return listReturn;
}

Fixed version (ground truth):
@Override public List<NodeReturn> createReturns(){
  List<NodeReturn> listReturn=new ArrayList<>();
  ComponentProperties componentProperties=ComponentsUtils.getComponentProperties(getName());
  if (!(componentProperties instanceof ComponentPropertiesImpl)) {
    return listReturn;
  }
  NodeReturn nodeRet=null;
  for (  Property child : componentDefinition.getReturnProperties()) {
    nodeRet=new NodeReturn();
    nodeRet.setType(ComponentsUtils.getTalendTypeFromProperty(child).getId());
    nodeRet.setDisplayName(child.getDisplayName());
    nodeRet.setName(child.getName());
    Object object=child.getTaggedValue(IGenericConstants.AVAILABILITY);
    if (object != null) {
      nodeRet.setAvailability(object.toString());
    }
 else {
      nodeRet.setAvailability("String_Node_Str");
    }
    listReturn.add(nodeRet);
  }
  return listReturn;
}
Program: 118360
Project: 118360
Buggy source:
@Override public String genericToSerialized(IElementParameter param){
  if (param instanceof GenericElementParameter) {
    Node node=(Node)((GenericElementParameter)param).getElement();
    ComponentProperties properties=node.getComponentProperties();
    return properties.toSerialized();
  }
 else {
    ComponentProperties componentProperties=ComponentsUtils.getComponentProperties(getName());
    return componentProperties.toSerialized();
  }
}

Fixed version (ground truth):
@Override public String genericToSerialized(IElementParameter param){
  if (param instanceof GenericElementParameter) {
    Node node=(Node)((GenericElementParameter)param).getElement();
    ComponentProperties properties=node.getComponentProperties();
    String serialized=properties.toSerialized();
    ComponentProperties newProperties=Properties.Helper.fromSerializedPersistent(serialized,ComponentProperties.class).object;
    return properties.toSerialized();
  }
 else {
    ComponentProperties componentProperties=ComponentsUtils.getComponentProperties(getName());
    return componentProperties.toSerialized();
  }
}
Program: 118361
Project: 118361
Buggy source:
@Override public void setup(ComponentProperties properties){
  properties.setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
}

Fixed version (ground truth):
@Override public void setup(Object properties){
  ((Properties)properties).setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
}
Program: 118362
Project: 118362
Buggy source:
@Override public void initNodePropertiesFromSerialized(INode node,String serialized){
  if (node != null) {
    node.setComponentProperties(PropertiesImpl.fromSerialized(serialized,ComponentProperties.class,new Properties.PostSerializationSetup<ComponentProperties>(){
      @Override public void setup(      ComponentProperties properties){
        properties.setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
      }
    }
).properties);
  }
}

Fixed version (ground truth):
@Override public void initNodePropertiesFromSerialized(INode node,String serialized){
  if (node != null) {
    node.setComponentProperties(Properties.Helper.fromSerializedPersistent(serialized,ComponentProperties.class,new PostDeserializeSetup(){
      @Override public void setup(      Object properties){
        ((Properties)properties).setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
      }
    }
).object);
  }
}
Program: 118364
Project: 118364
Buggy source:
@Override public void setup(ComponentProperties properties){
  properties.setValueEvaluator(new PropertyValueEvaluator(){
    @Override public Object evaluate(    Property property,    Object storedValue){
      if (storedValue instanceof String) {
        if (GenericTypeUtils.isEnumType(property)) {
          ComponentProperties newProperties=ComponentsUtils.getComponentProperties(node.getComponentName());
          Property newProperty=(Property)newProperties.getProperty(property.getName());
          if (newProperty == null) {
            newProperty=(Property)newProperties.getProperty("String_Node_Str");
          }
          if (newProperty != null) {
            List<?> propertyPossibleValues=((Property<?>)newProperty).getPossibleValues();
            if (propertyPossibleValues != null) {
              for (              Object possibleValue : propertyPossibleValues) {
                if (possibleValue.toString().equals(storedValue)) {
                  property.setStoredValue(possibleValue);
                  return possibleValue;
                }
              }
            }
          }
        }
      }
      return storedValue;
    }
  }
);
}

Fixed version (ground truth):
@Override public void setup(Object properties){
  ((Properties)properties).setValueEvaluator(new PropertyValueEvaluator(){
    @Override public Object evaluate(    Property property,    Object storedValue){
      if (storedValue instanceof String) {
        if (GenericTypeUtils.isEnumType(property)) {
          ComponentProperties newProperties=ComponentsUtils.getComponentProperties(node.getComponentName());
          Property newProperty=(Property)newProperties.getProperty(property.getName());
          if (newProperty == null) {
            newProperty=(Property)newProperties.getProperty("String_Node_Str");
          }
          if (newProperty != null) {
            List<?> propertyPossibleValues=((Property<?>)newProperty).getPossibleValues();
            if (propertyPossibleValues != null) {
              for (              Object possibleValue : propertyPossibleValues) {
                if (possibleValue.toString().equals(storedValue)) {
                  property.setStoredValue(possibleValue);
                  return possibleValue;
                }
              }
            }
          }
        }
      }
      return storedValue;
    }
  }
);
}
Program: 118366
Project: 118366
Buggy source:
public static ComponentProperties getComponentPropertiesFromSerialized(String serialized,Connection connection){
  if (serialized != null) {
    Deserialized<ComponentProperties> fromSerialized=PropertiesImpl.fromSerialized(serialized,ComponentProperties.class,new Properties.PostSerializationSetup<ComponentProperties>(){
      @Override public void setup(      ComponentProperties properties){
        properties.setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
      }
    }
);
    if (fromSerialized != null) {
      return fromSerialized.properties;
    }
  }
  return null;
}

Fixed version (ground truth):
public static ComponentProperties getComponentPropertiesFromSerialized(String serialized,Connection connection){
  if (serialized != null) {
    SerializerDeserializer.Deserialized<ComponentProperties> fromSerialized=Properties.Helper.fromSerializedPersistent(serialized,ComponentProperties.class,new PostDeserializeSetup(){
      @Override public void setup(      Object properties){
        ((Properties)properties).setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
      }
    }
);
    if (fromSerialized != null) {
      return fromSerialized.object;
    }
  }
  return null;
}
Program: 118367
Project: 118367
Buggy source:
@Override public void setup(ComponentProperties properties){
  properties.setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
}

Fixed version (ground truth):
@Override public void setup(Object properties){
  ((Properties)properties).setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
}
Program: 118368
Project: 118368
Buggy source:
/** 
 * Save the outline picture for this editor.
 * @param viewer
 */
protected void saveOutlinePicture(ScrollingGraphicalViewer viewer){
  GlobalConstant.generatingScreenShoot=true;
  LayerManager layerManager=(LayerManager)viewer.getEditPartRegistry().get(LayerManager.ID);
  IFigure backgroundLayer=layerManager.getLayer(LayerConstants.GRID_LAYER);
  IFigure contentLayer=layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
  FreeformViewport viewport=(FreeformViewport)((TalendScalableFreeformRootEditPart)layerManager).getFigure();
  viewport.getUpdateManager().performUpdate();
  int width=contentLayer.getBounds().width;
  int height=contentLayer.getBounds().height;
  Image img=new Image(null,width,height);
  GC gc=new GC(img);
  Graphics graphics=new SWTGraphics(gc);
  graphics.translate(-1 * contentLayer.getBounds().x + viewport.getViewLocation().x,-1 * contentLayer.getBounds().y + viewport.getViewLocation().y);
  Point point=contentLayer.getBounds().getTopLeft();
  IProcess2 process=getProcess();
  process.setPropertyValue(IProcess.SCREEN_OFFSET_X,String.valueOf(-point.x));
  process.setPropertyValue(IProcess.SCREEN_OFFSET_Y,String.valueOf(-point.y));
  backgroundLayer.paint(graphics);
  contentLayer.paint(graphics);
  graphics.dispose();
  gc.dispose();
  process.getScreenshots().put("String_Node_Str",ImageUtils.saveImageToData(img));
  img.dispose();
  GlobalConstant.generatingScreenShoot=false;
}

Fixed version (ground truth):
/** 
 * Save the outline picture for this editor.
 * @param viewer
 */
protected void saveOutlinePicture(ScrollingGraphicalViewer viewer){
  GlobalConstant.generatingScreenShoot=true;
  LayerManager layerManager=(LayerManager)viewer.getEditPartRegistry().get(LayerManager.ID);
  IFigure backgroundLayer=layerManager.getLayer(LayerConstants.GRID_LAYER);
  IFigure contentLayer=layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
  FreeformViewport viewport=(FreeformViewport)((TalendScalableFreeformRootEditPart)layerManager).getFigure();
  viewport.getUpdateManager().performUpdate();
  int width=contentLayer.getBounds().width;
  int height=contentLayer.getBounds().height;
  Image img=new Image(null,width,height);
  GC gc=new GC(img);
  Graphics graphics=new SWTGraphics(gc);
  Point point=contentLayer.getBounds().getTopLeft();
  graphics.translate(-point.x,-point.y);
  IProcess2 process=getProcess();
  process.setPropertyValue(IProcess.SCREEN_OFFSET_X,String.valueOf(-point.x));
  process.setPropertyValue(IProcess.SCREEN_OFFSET_Y,String.valueOf(-point.y));
  backgroundLayer.paint(graphics);
  contentLayer.paint(graphics);
  graphics.dispose();
  gc.dispose();
  process.getScreenshots().put("String_Node_Str",ImageUtils.saveImageToData(img));
  img.dispose();
  GlobalConstant.generatingScreenShoot=false;
}
Program: 118369
Project: 118369
Buggy source:
@Override protected void okPressed(){
  for (  Text text : allParamText) {
    EConnectionParameterName name=(EConnectionParameterName)text.getData();
    String value=((Text)text.getData(TEXT_CONTROL)).getText().substring(CONTEXT_WITH.length());
switch (name) {
case SID:
      parameters.setDbName(value);
    break;
case DATASOURCE:
  parameters.setDatasource(value);
break;
case PASSWORD:
parameters.setPassword(value);
break;
case PORT:
parameters.setPort(value);
break;
case SCHEMA:
parameters.setSchema(value);
break;
case SERVER_NAME:
parameters.setHost(value);
break;
case USERNAME:
parameters.setUserName(value);
break;
case DIRECTORY:
parameters.setDirectory(value);
break;
case FILE:
parameters.setFilename(value);
break;
case PROPERTIES_STRING:
parameters.setJdbcProperties(value);
break;
default :
}
}
super.okPressed();
}

Fixed version (ground truth):
@Override protected void okPressed(){
  for (  Text text : allParamText) {
    EConnectionParameterName name=(EConnectionParameterName)text.getData();
    String value=((Text)text.getData(TEXT_CONTROL)).getText();
switch (name) {
case SID:
      parameters.setDbName(value);
    break;
case DATASOURCE:
  parameters.setDatasource(value);
break;
case PASSWORD:
parameters.setPassword(value);
break;
case PORT:
parameters.setPort(value);
break;
case SCHEMA:
parameters.setSchema(value);
break;
case SERVER_NAME:
parameters.setHost(value);
break;
case USERNAME:
parameters.setUserName(value);
break;
case DIRECTORY:
parameters.setDirectory(value);
break;
case FILE:
parameters.setFilename(value);
break;
case PROPERTIES_STRING:
parameters.setJdbcProperties(value);
break;
default :
}
}
super.okPressed();
}
Program: 118370
Project: 118370
Buggy source:
@Override public Object[] getChildren(Object element){
  if (!(element instanceof RepositoryNode)) {
    return super.getChildren(element);
  }
  RepositoryNode repoNode=(RepositoryNode)element;
  ProjectRepositoryNode projectRepositoryNode=(ProjectRepositoryNode)repoNode.getRoot();
  if (metadataNodeTester.isMetadataTopNode(repoNode)) {
    getTopLevelNodes().clear();
    getTopLevelNodes().addAll(projectRepositoryNode.getGenericTopNodesMap().values());
    return getTopLevelNodes().toArray();
  }
  if (getTopLevelNodes().contains(repoNode)) {
    projectRepositoryNode.initializeChildren(repoNode);
  }
  return repoNode.getChildren().toArray();
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object element){
  if (!(element instanceof RepositoryNode)) {
    return super.getChildren(element);
  }
  RepositoryNode repoNode=(RepositoryNode)element;
  ProjectRepositoryNode projectRepositoryNode=(ProjectRepositoryNode)repoNode.getRoot();
  if (metadataNodeTester.isMetadataTopNode(repoNode)) {
    getTopLevelNodes().clear();
    getTopLevelNodes().addAll(projectRepositoryNode.getGenericTopNodesMap().values());
    return getTopLevelNodes().toArray();
  }
  if (!repoNode.isInitialized() && getTopLevelNodes().contains(repoNode)) {
    projectRepositoryNode.initializeChildren(repoNode);
    repoNode.setInitialized(true);
  }
  return repoNode.getChildren().toArray();
}
Program: 118374
Project: 118374
Buggy source:
@Override public List<ComponentProperties> getAllComponentProperties(Connection connection){
  List<ComponentProperties> componentProperties=new ArrayList<>();
  if (isGenericConnection(connection)) {
    GenericConnection genericConnection=(GenericConnection)connection;
    String compProperties=genericConnection.getCompProperties();
    ComponentProperties cp=ComponentsUtils.getComponentPropertiesFromSerialized(compProperties,connection);
    if (cp != null) {
      componentProperties.add(cp);
    }
    List<MetadataTable> metadataTables=SchemaUtils.getMetadataTables(genericConnection,SubContainer.class);
    for (    MetadataTable metadataTable : metadataTables) {
      for (      TaggedValue taggedValue : metadataTable.getTaggedValue()) {
        if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(taggedValue.getTag())) {
          ComponentProperties compPros=ComponentsUtils.getComponentPropertiesFromSerialized(taggedValue.getValue(),connection);
          compPros.updateNestedProperties(cp);
          if (compPros != null && !componentProperties.contains(compPros)) {
            componentProperties.add(compPros);
          }
        }
      }
    }
  }
  return componentProperties;
}

Fixed version (ground truth):
@Override public List<ComponentProperties> getAllComponentProperties(Connection connection,String tableLabel){
  List<ComponentProperties> componentProperties=new ArrayList<>();
  if (isGenericConnection(connection)) {
    GenericConnection genericConnection=(GenericConnection)connection;
    String compProperties=genericConnection.getCompProperties();
    ComponentProperties cp=ComponentsUtils.getComponentPropertiesFromSerialized(compProperties,connection);
    if (cp != null) {
      componentProperties.add(cp);
    }
    List<MetadataTable> metadataTables;
    if (tableLabel == null) {
      metadataTables=SchemaUtils.getMetadataTables(genericConnection,SubContainer.class);
    }
 else {
      metadataTables=Arrays.asList(SchemaUtils.getMetadataTable(genericConnection,tableLabel,SubContainer.class));
    }
    for (    MetadataTable metadataTable : metadataTables) {
      for (      TaggedValue taggedValue : metadataTable.getTaggedValue()) {
        if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(taggedValue.getTag())) {
          ComponentProperties compPros=ComponentsUtils.getComponentPropertiesFromSerialized(taggedValue.getValue(),connection);
          if (compPros != null && !componentProperties.contains(compPros)) {
            compPros.updateNestedProperties(cp);
            componentProperties.add(compPros);
          }
        }
      }
    }
  }
  return componentProperties;
}
Program: 118375
Project: 118375
Buggy source:
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    String seletetedMetadataTableName=getSeletetedMetadataTableName(table);
    for (    ComponentProperties compPro : componentProperties) {
      if (seletetedMetadataTableName != null) {
        if (!compPro.getName().equals(seletetedMetadataTableName)) {
          continue;
        }
      }
      Property property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,paramValue.toString());
        }
        if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return paramValue.toString();
        }
        return paramValue;
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(connection,componentProperties,value.substring(value.indexOf(IGenericConstants.EXP_SEPARATOR) + 1),table);
    }
  }
  return null;
}

Fixed version (ground truth):
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,paramValue.toString());
        }
 else         if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return paramValue.toString();
        }
        return paramValue;
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(connection,componentProperties,value.substring(value.indexOf(IGenericConstants.EXP_SEPARATOR) + 1),table);
    }
  }
  return null;
}
Program: 118376
Project: 118376
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      IGenericWizardService wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
      if (wizardService != null && wizardService.isGenericConnection(connection)) {
        return getGenericRepositoryValue((GenericConnection)connection,wizardService.getAllComponentProperties(connection),value,table);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      IGenericWizardService wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
      if (wizardService != null && wizardService.isGenericConnection(connection)) {
        return getGenericRepositoryValue((GenericConnection)connection,wizardService.getAllComponentProperties(connection,getSeletetedMetadataTableName(table)),value,table);
      }
    }
  }
  return null;
}
Program: 118381
Project: 118381
Buggy source:
public Command createCommand(Button button){
  Object paramObj=button.getData(PARAM_OBJ);
  if (paramObj instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)paramObj;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam));
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=TalendQuoteUtils.addQuotes(StringUtils.trimToEmpty(nameAndLabelsDialog.getResult()));
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Command createCommand(Button button){
  Object paramObj=button.getData(PARAM_OBJ);
  if (paramObj instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)paramObj;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam));
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=TalendQuoteUtils.addQuotes(StringUtils.trimToEmpty(nameAndLabelsDialog.getResult()));
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        gParam.setValue(result);
      }
    }
  }
  return null;
}
Program: 118383
Project: 118383
Buggy source:
public Command createCommand(Button button){
  if (curParameter instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)curParameter;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam));
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=TalendQuoteUtils.addQuotes(StringUtils.trimToEmpty(nameAndLabelsDialog.getResult()));
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Command createCommand(Button button){
  Object paramObj=button.getData(PARAM_OBJ);
  if (paramObj instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)paramObj;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam));
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=TalendQuoteUtils.addQuotes(StringUtils.trimToEmpty(nameAndLabelsDialog.getResult()));
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}
Program: 118386
Project: 118386
Buggy source:
public GenericSchemaWizard(IWorkbench workbench,boolean creation,IRepositoryViewObject object,ConnectionItem connectionItem,MetadataTable metadataTable,boolean forceReadOnly){
  super(workbench,creation,forceReadOnly);
  this.connectionItem=connectionItem;
  this.metadataTable=metadataTable;
  if (connectionItem != null) {
    oldTableMap=GenericUpdateManager.getOldTableIdAndNameMap(connectionItem,metadataTable,creation);
    oldMetadataTable=ConvertionHelper.convert(metadataTable);
  }
  setNeedsProgressMonitor(true);
  setRepositoryObject(object);
  isRepositoryObjectEditable();
  initLockStrategy();
}

Fixed version (ground truth):
public GenericSchemaWizard(IWorkbench workbench,boolean creation,IRepositoryViewObject object,ConnectionItem connectionItem,MetadataTable metadataTable,boolean forceReadOnly){
  super(workbench,creation,forceReadOnly);
  this.connectionItem=connectionItem;
  this.metadataTable=metadataTable;
  if (connectionItem != null) {
    oldTableMap=GenericUpdateManager.getOldTableIdAndNameMap(connectionItem,metadataTable,creation);
    oldMetadataTable=ConvertionHelper.convert(metadataTable);
  }
  setNeedsProgressMonitor(true);
  setRepositoryObject(object);
  initLockStrategy();
}
Program: 118387
Project: 118387
Buggy source:
@Override public void paint(Graphics graphics){
  graphics.setAlpha(255);
  if (errorFigure.isVisible()) {
    errorFigure.setLocation(jobletContainer.getErrorLocation());
  }
  if (warningFigure.isVisible()) {
    warningFigure.setLocation(jobletContainer.getWarningLocation());
  }
  if (infoFigure.isVisible()) {
    infoFigure.setLocation(jobletContainer.getInfoLocation());
  }
  if (rectFig.isVisible()) {
    rectFig.setLocation(jobletContainer.getMarkLocation());
  }
  if (markFigure.isVisible()) {
    markFigure.setLocation(jobletContainer.getErrorMarkLocation());
  }
  Iterator it=getChildren().iterator();
  if (!jobletContainer.getNode().isJoblet()) {
    while (it.hasNext()) {
      Figure fig=(Figure)it.next();
      if (mrFigures.isEmpty() && (fig instanceof GreenRectangle || fig instanceof RoundedRectangle)) {
        it.remove();
        continue;
      }
    }
  }
  if (this.jobletContainer.getNode().isJoblet()) {
    refreshForJoblet();
  }
  initializejobletContainer(getBounds());
  super.paint(graphics);
}

Fixed version (ground truth):
@Override public void paint(Graphics graphics){
  graphics.setAlpha(255);
  if (errorFigure.isVisible()) {
    errorFigure.setLocation(jobletContainer.getErrorLocation());
  }
  if (warningFigure.isVisible()) {
    warningFigure.setLocation(jobletContainer.getWarningLocation());
  }
  if (infoFigure.isVisible()) {
    infoFigure.setLocation(jobletContainer.getInfoLocation());
  }
  if (markFigure.isVisible()) {
    markFigure.setLocation(jobletContainer.getErrorMarkLocation());
  }
  Iterator it=getChildren().iterator();
  if (!jobletContainer.getNode().isJoblet()) {
    while (it.hasNext()) {
      Figure fig=(Figure)it.next();
      if (mrFigures.isEmpty() && (fig instanceof GreenRectangle || fig instanceof RoundedRectangle)) {
        it.remove();
        continue;
      }
    }
  }
  if (this.jobletContainer.getNode().isJoblet()) {
    refreshForJoblet();
  }
  initializejobletContainer(getBounds());
  super.paint(graphics);
}
Program: 118389
Project: 118389
Buggy source:
/** 
 * looks for all Property type properties of the given componenetProperties and all is nested CompoenetProperties.
 */
public static List<Property> getAllValuedProperties(ComponentProperties componentProperties){
  List<Property> allValuedProperties=new ArrayList<>();
  if (componentProperties == null) {
    return null;
  }
  List<NamedThing> namedThings=componentProperties.getProperties();
  for (  NamedThing namedThing : namedThings) {
    if (namedThing instanceof ComponentProperties) {
      ComponentProperties childComponentProperties=(ComponentProperties)namedThing;
      allValuedProperties.addAll(getAllValuedProperties(childComponentProperties));
    }
 else     if (namedThing instanceof Property) {
      allValuedProperties.add((Property)namedThing);
    }
  }
  return allValuedProperties;
}

Fixed version (ground truth):
/** 
 * looks for all Property type properties of the given properties and all is nested Properties.
 */
public static List<Property> getAllValuedProperties(Properties properties){
  List<Property> allValuedProperties=new ArrayList<>();
  if (properties == null) {
    return Collections.EMPTY_LIST;
  }
  List<NamedThing> namedThings=properties.getProperties();
  for (  NamedThing namedThing : namedThings) {
    if (namedThing instanceof Properties) {
      Properties childComponentProperties=(Properties)namedThing;
      allValuedProperties.addAll(getAllValuedProperties(childComponentProperties));
    }
 else     if (namedThing instanceof Property) {
      allValuedProperties.add((Property)namedThing);
    }
  }
  return allValuedProperties;
}
Program: 118390
Project: 118390
Buggy source:
@Override public void setupLayout(){
  super.setupLayout();
  Form form=Form.create(this,Form.MAIN);
  form.addRow(userId);
  form.addRow(nestedProps.getForm(Form.MAIN));
}

Fixed version (ground truth):
@Override public void setupLayout(){
  super.setupLayout();
  Form form=Form.create(this,Form.MAIN);
  form.addRow(userId);
  form.addRow(nestedProps.getForm(Form.MAIN));
  form.addRow(contactProps.getForm(Form.MAIN));
}
Program: 118391
Project: 118391
Buggy source:
/** 
 * looks for all Property type properties of the given componenetProperties and all is nested CompoenetProperties.
 */
public static List<Property> getAllValuedProperties(ComponentProperties componentProperties){
  List<Property> allValuedProperties=new ArrayList<>();
  if (componentProperties == null) {
    return null;
  }
  List<NamedThing> namedThings=componentProperties.getProperties();
  for (  NamedThing namedThing : namedThings) {
    if (namedThing instanceof ComponentProperties) {
      ComponentProperties childComponentProperties=(ComponentProperties)namedThing;
      allValuedProperties.addAll(getAllValuedProperties(childComponentProperties));
    }
 else     if (namedThing instanceof Property) {
      allValuedProperties.add((Property)namedThing);
    }
  }
  return allValuedProperties;
}

Fixed version (ground truth):
/** 
 * looks for all Property type properties of the given properties and all is nested Properties.
 */
public static List<Property> getAllValuedProperties(Properties properties){
  List<Property> allValuedProperties=new ArrayList<>();
  if (properties == null) {
    return Collections.EMPTY_LIST;
  }
  List<NamedThing> namedThings=properties.getProperties();
  for (  NamedThing namedThing : namedThings) {
    if (namedThing instanceof Properties) {
      Properties childComponentProperties=(Properties)namedThing;
      allValuedProperties.addAll(getAllValuedProperties(childComponentProperties));
    }
 else     if (namedThing instanceof Property) {
      allValuedProperties.add((Property)namedThing);
    }
  }
  return allValuedProperties;
}
Program: 118392
Project: 118392
Buggy source:
@Override public void setupLayout(){
  super.setupLayout();
  Form form=Form.create(this,Form.MAIN);
  form.addRow(userId);
  form.addRow(nestedProps.getForm(Form.MAIN));
}

Fixed version (ground truth):
@Override public void setupLayout(){
  super.setupLayout();
  Form form=Form.create(this,Form.MAIN);
  form.addRow(userId);
  form.addRow(nestedProps.getForm(Form.MAIN));
  form.addRow(contactProps.getForm(Form.MAIN));
}
Program: 118396
Project: 118396
Buggy source:
@Override public List<ComponentProperties> getAllComponentProperties(Connection connection){
  List<ComponentProperties> componentProperties=new ArrayList<>();
  if (isGenericConnection(connection)) {
    GenericConnection genericConnection=(GenericConnection)connection;
    String compProperties=genericConnection.getCompProperties();
    ComponentProperties cp=ComponentsUtils.getComponentPropertiesFromSerialized(compProperties,connection);
    if (cp != null) {
      componentProperties.add(cp);
    }
    List<MetadataTable> metadataTables=SchemaUtils.getMetadataTables(genericConnection,SubContainer.class);
    for (    MetadataTable metadataTable : metadataTables) {
      for (      TaggedValue taggedValue : metadataTable.getTaggedValue()) {
        if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(taggedValue.getTag())) {
          ComponentProperties compPros=ComponentsUtils.getComponentPropertiesFromSerialized(taggedValue.getValue(),connection);
          compPros.updateNestedProperties(cp);
          if (compPros != null && !componentProperties.contains(compPros)) {
            componentProperties.add(compPros);
          }
        }
      }
    }
  }
  return componentProperties;
}

Fixed version (ground truth):
@Override public List<ComponentProperties> getAllComponentProperties(Connection connection,String tableLabel){
  List<ComponentProperties> componentProperties=new ArrayList<>();
  if (isGenericConnection(connection)) {
    GenericConnection genericConnection=(GenericConnection)connection;
    String compProperties=genericConnection.getCompProperties();
    ComponentProperties cp=ComponentsUtils.getComponentPropertiesFromSerialized(compProperties,connection);
    if (cp != null) {
      componentProperties.add(cp);
    }
    List<MetadataTable> metadataTables;
    if (tableLabel == null) {
      metadataTables=SchemaUtils.getMetadataTables(genericConnection,SubContainer.class);
    }
 else {
      metadataTables=Arrays.asList(SchemaUtils.getMetadataTable(genericConnection,tableLabel,SubContainer.class));
    }
    for (    MetadataTable metadataTable : metadataTables) {
      for (      TaggedValue taggedValue : metadataTable.getTaggedValue()) {
        if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(taggedValue.getTag())) {
          ComponentProperties compPros=ComponentsUtils.getComponentPropertiesFromSerialized(taggedValue.getValue(),connection);
          if (compPros != null && !componentProperties.contains(compPros)) {
            compPros.updateNestedProperties(cp);
            componentProperties.add(compPros);
          }
        }
      }
    }
  }
  return componentProperties;
}