nus-yam/ex-repair huggingface dataset:
Program: 126478
Project: 126478
Buggy source:
@Override protected Set<Relation> collect(Map<String,ElementParameterType> parametersMap,Map<?,?> options){
  Set<Relation> relationSet=new HashSet<Relation>();
  ElementParameterType repositoryTypeParam=getParameterTypeByNames(parametersMap,getRepositoryTypeName(),getRepositoryTypeNameN());
  if (repositoryTypeParam != null && IN_REPOSITORY.equals(repositoryTypeParam.getValue())) {
    ElementParameterType repositoryTypeValueParam=getParameterTypeByNames(parametersMap,getRepositoryTypeValueName(),getRepositoryTypeValueNameN());
    if (repositoryTypeValueParam != null) {
      String repositoryIdOrValue=repositoryTypeValueParam.getValue();
      if (StringUtils.isNotEmpty(repositoryIdOrValue)) {
        Relation addedRelation=new Relation();
        addedRelation.setId(repositoryIdOrValue);
        addedRelation.setType(getRepositoryRelationType());
        addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
        relationSet.add(addedRelation);
      }
    }
  }
  return relationSet;
}

Fixed version (ground truth):
@Override protected Set<Relation> collect(Map<String,ElementParameterType> parametersMap,Map<?,?> options){
  Set<Relation> relationSet=new HashSet<Relation>();
  for (  ElementParameterType paramType : parametersMap.values()) {
    if (paramType.getName().endsWith("String_Node_Str" + getRepositoryTypeName())) {
      String name=paramType.getName().split("String_Node_Str")[0];
      ElementParameterType repositoryTypeParam=parametersMap.get(name + "String_Node_Str" + getRepositoryTypeName());
      if (repositoryTypeParam != null && IN_REPOSITORY.equals(repositoryTypeParam.getValue())) {
        ElementParameterType repositoryTypeValueParam=parametersMap.get(name + "String_Node_Str" + getRepositoryTypeValueName());
        if (repositoryTypeValueParam != null) {
          String repositoryIdOrValue=repositoryTypeValueParam.getValue();
          if (StringUtils.isNotEmpty(repositoryIdOrValue)) {
            Relation addedRelation=new Relation();
            addedRelation.setId(repositoryIdOrValue);
            addedRelation.setType(getRepositoryRelationType());
            addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
            relationSet.add(addedRelation);
          }
        }
      }
    }
  }
  return relationSet;
}
Program: 126479
Project: 126479
Buggy source:
/** 
 * Something like PROPERTY:PROPERTY_TYPE
 */
protected abstract String getRepositoryTypeName();

Fixed version (ground truth):
/** 
 * Something like PROPERTY_TYPE
 */
protected abstract String getRepositoryTypeName();
Program: 126480
Project: 126480
Buggy source:
public static routines.system.Document parseTo_Document(String s,boolean ignoreDTD,String encoding) throws org.dom4j.DocumentException {
  if (s == null) {
    return null;
  }
  routines.system.Document theDoc=new routines.system.Document();
  org.dom4j.io.SAXReader reader=new org.dom4j.io.SAXReader();
  if (ignoreDTD) {
    reader.setEntityResolver(new EntityResolver(){
      @Override public InputSource resolveEntity(      String publicId,      String systemId) throws SAXException, IOException {
        return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
      }
    }
);
  }
  org.dom4j.Document document=reader.read(new java.io.StringReader(s));
  if (encoding != null && !("String_Node_Str".equals(encoding))) {
    document.setXMLEncoding(encoding);
  }
  theDoc.setDocument(document);
  return theDoc;
}

Fixed version (ground truth):
public static routines.system.Document parseTo_Document(String s,boolean ignoreDTD,String encoding) throws org.dom4j.DocumentException {
  if (s == null) {
    return null;
  }
  routines.system.Document theDoc=new routines.system.Document();
  org.dom4j.io.SAXReader reader=new org.dom4j.io.SAXReader();
  if (ignoreDTD) {
    reader.setEntityResolver(new EntityResolver(){
      public InputSource resolveEntity(      String publicId,      String systemId) throws SAXException, IOException {
        return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
      }
    }
);
  }
  org.dom4j.Document document=reader.read(new java.io.StringReader(s));
  if (encoding != null && !("String_Node_Str".equals(encoding))) {
    document.setXMLEncoding(encoding);
  }
  theDoc.setDocument(document);
  return theDoc;
}
Program: 126481
Project: 126481
Buggy source:
@Override public InputSource resolveEntity(String publicId,String systemId) throws SAXException, IOException {
  return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
}

Fixed version (ground truth):
public InputSource resolveEntity(String publicId,String systemId) throws SAXException, IOException {
  return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
}
Program: 126482
Project: 126482
Buggy source:
/** 
 * Method "createConnection" returns the connection with   {@link ReturnCode#getObject()} if {@link ReturnCode#isOk()}is true. This is the behaviour when everything goes ok. <p> When something goes wrong,   {@link ReturnCode#isOk()} is false and {@link ReturnCode#getMessage()} gives the errormessage. <p> The created connection must be closed by the caller. (use  {@link ConnectionUtils#closeConnection(Connection)})
 * @param connection the connection (DatabaseConnection MDMConnection or others)
 * @return a ReturnCode (never null)
 */
public static TypedReturnCode<java.sql.Connection> createConnection(Connection connection){
  TypedReturnCode<java.sql.Connection> rc=new TypedReturnCode<java.sql.Connection>(false);
  String url=getURL(connection);
  if (url == null) {
    rc.setMessage(Messages.getString("String_Node_Str"));
    rc.setOk(false);
    return rc;
  }
  java.sql.Connection sqlConnection=null;
  if (connection instanceof DatabaseConnection) {
    sqlConnection=MetadataConnectionUtils.createConnection((DatabaseConnection)connection).getObject();
  }
  rc.setObject(sqlConnection);
  rc.setOk(sqlConnection != null);
  return rc;
}

Fixed version (ground truth):
/** 
 * Method "createConnection" returns the connection with   {@link ReturnCode#getObject()} if {@link ReturnCode#isOk()}is true. This is the behaviour when everything goes ok. <p> When something goes wrong,   {@link ReturnCode#isOk()} is false and {@link ReturnCode#getMessage()} gives the errormessage. <p> The created connection must be closed by the caller. (use  {@link ConnectionUtils#closeConnection(Connection)})
 * @param connection the connection (DatabaseConnection MDMConnection or others)
 * @return a ReturnCode (never null)
 */
public static TypedReturnCode<java.sql.Connection> createConnection(Connection connection){
  TypedReturnCode<java.sql.Connection> rc=new TypedReturnCode<java.sql.Connection>(false);
  String url=getURL(connection);
  if (url == null || !(connection instanceof DatabaseConnection)) {
    rc.setMessage(Messages.getString("String_Node_Str"));
    rc.setOk(false);
    return rc;
  }
  return MetadataConnectionUtils.createConnection((DatabaseConnection)connection);
}
Program: 126483
Project: 126483
Buggy source:
public static Byte parseTo_Byte(String s){
  if (s == null) {
    return null;
  }
  return Byte.decode(s).byteValue();
}

Fixed version (ground truth):
public static Byte parseTo_Byte(String s,boolean isDecode){
  if (s == null) {
    return null;
  }
  if (isDecode) {
    return Byte.decode(s).byteValue();
  }
 else {
    return Byte.parseByte(s);
  }
}
Program: 126484
Project: 126484
Buggy source:
public static routines.system.Document parseTo_Document(String s,boolean ignoreDTD,String encoding) throws org.dom4j.DocumentException {
  if (s == null) {
    return null;
  }
  routines.system.Document theDoc=new routines.system.Document();
  org.dom4j.io.SAXReader reader=new org.dom4j.io.SAXReader();
  if (ignoreDTD) {
    reader.setEntityResolver(new EntityResolver(){
      public InputSource resolveEntity(      String publicId,      String systemId) throws SAXException, IOException {
        return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
      }
    }
);
  }
  org.dom4j.Document document=reader.read(new java.io.StringReader(s));
  if (encoding != null && !("String_Node_Str".equals(encoding))) {
    document.setXMLEncoding(encoding);
  }
  theDoc.setDocument(document);
  return theDoc;
}

Fixed version (ground truth):
public static routines.system.Document parseTo_Document(String s,boolean ignoreDTD,String encoding) throws org.dom4j.DocumentException {
  if (s == null) {
    return null;
  }
  routines.system.Document theDoc=new routines.system.Document();
  org.dom4j.io.SAXReader reader=new org.dom4j.io.SAXReader();
  if (ignoreDTD) {
    reader.setEntityResolver(new EntityResolver(){
      @Override public InputSource resolveEntity(      String publicId,      String systemId) throws SAXException, IOException {
        return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
      }
    }
);
  }
  org.dom4j.Document document=reader.read(new java.io.StringReader(s));
  if (encoding != null && !("String_Node_Str".equals(encoding))) {
    document.setXMLEncoding(encoding);
  }
  theDoc.setDocument(document);
  return theDoc;
}
Program: 126485
Project: 126485
Buggy source:
public static int parseTo_int(String s){
  return Integer.parseInt(s);
}

Fixed version (ground truth):
public static int parseTo_int(String s,boolean isDecode){
  if (isDecode) {
    return Integer.decode(s).intValue();
  }
 else {
    return Integer.parseInt(s);
  }
}
Program: 126486
Project: 126486
Buggy source:
public static Integer parseTo_Integer(String s){
  if (s == null) {
    return null;
  }
  return parseTo_int(s);
}

Fixed version (ground truth):
public static Integer parseTo_Integer(String s,boolean isDecode){
  if (s == null) {
    return null;
  }
  return parseTo_int(s,isDecode);
}
Program: 126487
Project: 126487
Buggy source:
public static Short parseTo_Short(String s){
  if (s == null) {
    return null;
  }
  return parseTo_short(s);
}

Fixed version (ground truth):
public static Short parseTo_Short(String s,boolean isDecode){
  if (s == null) {
    return null;
  }
  return parseTo_short(s,isDecode);
}
Program: 126488
Project: 126488
Buggy source:
public static long parseTo_long(String s){
  return Long.parseLong(s);
}

Fixed version (ground truth):
public static long parseTo_long(String s,boolean isDecode){
  if (isDecode) {
    return Long.decode(s).longValue();
  }
 else {
    return Long.parseLong(s);
  }
}
Program: 126489
Project: 126489
Buggy source:
public InputSource resolveEntity(String publicId,String systemId) throws SAXException, IOException {
  return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
}

Fixed version (ground truth):
@Override public InputSource resolveEntity(String publicId,String systemId) throws SAXException, IOException {
  return new org.xml.sax.InputSource(new java.io.ByteArrayInputStream("String_Node_Str".getBytes()));
}
Program: 126490
Project: 126490
Buggy source:
public static Long parseTo_Long(String s){
  if (s == null) {
    return null;
  }
  return parseTo_long(s);
}

Fixed version (ground truth):
public static Long parseTo_Long(String s,boolean isDecode){
  if (s == null) {
    return null;
  }
  return parseTo_long(s,isDecode);
}
Program: 126491
Project: 126491
Buggy source:
public static short parseTo_short(String s){
  return Short.parseShort(s);
}

Fixed version (ground truth):
public static short parseTo_short(String s,boolean isDecode){
  if (isDecode) {
    return Short.decode(s).shortValue();
  }
 else {
    return Short.parseShort(s);
  }
}
Program: 126492
Project: 126492
Buggy source:
public static byte parseTo_byte(String s){
  return parseTo_Byte(s);
}

Fixed version (ground truth):
public static byte parseTo_byte(String s,boolean isDecode){
  return parseTo_Byte(s,isDecode);
}
Program: 126495
Project: 126495
Buggy source:
@Override public FolderItem getFolderItem(Project project,ERepositoryObjectType itemType,IPath path){
  FolderHelper folderHelper=getFolderHelper(project.getEmfProject());
  FolderItem folderItem=folderHelper.getFolder(ERepositoryObjectType.getFolderName(itemType) + IPath.SEPARATOR + path);
  if (folderItem == null && itemType != null) {
    folderItem=folderHelper.createFolder(ERepositoryObjectType.getFolderName(itemType) + IPath.SEPARATOR + path);
  }
  return folderItem;
}

Fixed version (ground truth):
@Override public FolderItem getFolderItem(Project project,ERepositoryObjectType itemType,IPath path){
  if (project == null) {
    return null;
  }
  FolderHelper folderHelper=getFolderHelper(project.getEmfProject());
  FolderItem folderItem=folderHelper.getFolder(ERepositoryObjectType.getFolderName(itemType) + IPath.SEPARATOR + path);
  if (folderItem == null && itemType != null) {
    folderItem=folderHelper.createFolder(ERepositoryObjectType.getFolderName(itemType) + IPath.SEPARATOR + path);
  }
  return folderItem;
}
Program: 126496
Project: 126496
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: 126498
Project: 126498
Buggy source:
private List<RepositoryNode> getRepositoryNodesByTypes(IProjectRepositoryNode projectRepoNode){
  List<RepositoryNode> rootNodes=new ArrayList<RepositoryNode>();
  List<ERepositoryObjectType> prcessTypes=getTypes();
  if (prcessTypes != null) {
    for (    ERepositoryObjectType type : prcessTypes) {
      RepositoryNode rootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(type,true);
      if (rootNode != null) {
        if (ERepositoryObjectType.PROCESS.equals(type) && type.hasChildrenType()) {
          RepositoryNode childRootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(type.getChildrenTypesArray()[0],true);
          if (childRootNode != null && childRootNode.hasChildren() && !rootNode.getChildren().contains(childRootNode)) {
            rootNode.getChildren().add(childRootNode);
          }
        }
        rootNodes.add(rootNode);
      }
    }
  }
  return rootNodes;
}

Fixed version (ground truth):
private List<RepositoryNode> getRepositoryNodesByTypes(IProjectRepositoryNode projectRepoNode){
  List<RepositoryNode> rootNodes=new ArrayList<RepositoryNode>();
  List<ERepositoryObjectType> prcessTypes=getTypes();
  if (prcessTypes != null) {
    for (    ERepositoryObjectType type : prcessTypes) {
      RepositoryNode rootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(type,true);
      if (rootNode != null) {
        if (type != null && type.hasChildrenType()) {
          for (          ERepositoryObjectType childType : type.getChildrenTypesArray()) {
            RepositoryNode childRootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(childType,true);
            if (childRootNode != null && childRootNode.hasChildren() && !rootNode.getChildren().contains(childRootNode)) {
              rootNode.getChildren().add(childRootNode);
            }
          }
        }
        rootNodes.add(rootNode);
      }
    }
  }
  return rootNodes;
}
Program: 126500
Project: 126500
Buggy source:
private void helpPressed(){
  Program.launch(Messages.getString("String_Node_Str"));
}

Fixed version (ground truth):
private void helpPressed(){
  openURL(Messages.getString("String_Node_Str"));
}
Program: 126502
Project: 126502
Buggy source:
/** 
 * DOC YeXiaowei Comment method "getJavaLibPath".
 * @return
 */
public String getJavaLibPath(){
  Project project=ProjectManager.getInstance().getCurrentProject();
  IProject physProject;
  String tmpFolder=System.getProperty("String_Node_Str");
  try {
    physProject=ResourceModelUtils.getProject(project);
    tmpFolder=physProject.getFolder("String_Node_Str").getLocation().toPortableString();
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  tmpFolder=tmpFolder + "String_Node_Str";
  File file=new File(tmpFolder);
  if (!file.exists()) {
    file.mkdirs();
  }
  return tmpFolder + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * DOC YeXiaowei Comment method "getJavaLibPath".
 * @return
 */
public String getJavaLibPath(){
  Project project=ProjectManager.getInstance().getCurrentProject();
  IProject physProject;
  String tmpFolder=System.getProperty("String_Node_Str");
  try {
    physProject=ResourceModelUtils.getProject(project);
    if (physProject != null) {
      tmpFolder=physProject.getFolder("String_Node_Str").getLocation().toPortableString();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  tmpFolder=tmpFolder + "String_Node_Str";
  File file=new File(tmpFolder);
  if (!file.exists()) {
    file.mkdirs();
  }
  return tmpFolder + "String_Node_Str";
}
Program: 126505
Project: 126505
Buggy source:
private List<RepositoryNode> getRepositoryNodesByTypes(IProjectRepositoryNode projectRepoNode){
  List<RepositoryNode> rootNodes=new ArrayList<RepositoryNode>();
  List<ERepositoryObjectType> prcessTypes=getTypes();
  if (prcessTypes != null) {
    for (    ERepositoryObjectType type : prcessTypes) {
      RepositoryNode rootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(type,true);
      if (rootNode != null) {
        rootNodes.add(rootNode);
      }
    }
  }
  return rootNodes;
}

Fixed version (ground truth):
private List<RepositoryNode> getRepositoryNodesByTypes(IProjectRepositoryNode projectRepoNode){
  List<RepositoryNode> rootNodes=new ArrayList<RepositoryNode>();
  List<ERepositoryObjectType> prcessTypes=getTypes();
  if (prcessTypes != null) {
    for (    ERepositoryObjectType type : prcessTypes) {
      RepositoryNode rootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(type,true);
      if (rootNode != null) {
        if (ERepositoryObjectType.PROCESS.equals(type) && type.hasChildrenType()) {
          RepositoryNode childRootNode=((ProjectRepositoryNode)projectRepoNode).getRootRepositoryNode(type.getChildrenTypesArray()[0],true);
          if (childRootNode != null && childRootNode.hasChildren() && !rootNode.getChildren().contains(childRootNode)) {
            rootNode.getChildren().add(childRootNode);
          }
        }
        rootNodes.add(rootNode);
      }
    }
  }
  return rootNodes;
}
Program: 126508
Project: 126508
Buggy source:
@Override public IRepositoryViewObject getLastVersion(Project project,String id,String relativeFolder,ERepositoryObjectType type) throws PersistenceException {
  List<IRepositoryViewObject> serializableAllVersion=null;
  Object fullFolder=getFullFolder(project,type,relativeFolder);
  serializableAllVersion=getSerializableFromFolder(project,fullFolder,id,type,false,false,false,true);
  if (serializableAllVersion.isEmpty()) {
    serializableAllVersion=getSerializable(project,id,true,false);
  }
  int size=serializableAllVersion.size();
  if (size > 1) {
    String message=getItemsMessages(serializableAllVersion,size);
    throw new PersistenceException(Messages.getString("String_Node_Str",message));
  }
 else   if (size == 1) {
    return serializableAllVersion.get(0);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public IRepositoryViewObject getLastVersion(Project project,String id,String relativeFolder,ERepositoryObjectType type) throws PersistenceException {
  List<IRepositoryViewObject> serializableAllVersion=null;
  Object fullFolder=getFullFolder(project,type,relativeFolder);
  serializableAllVersion=getSerializableFromFolder(project,fullFolder,id,type,false,false,true,true);
  if (serializableAllVersion.isEmpty()) {
    serializableAllVersion=getSerializable(project,id,false,false);
  }
  int size=serializableAllVersion.size();
  if (size > 1) {
    String message=getItemsMessages(serializableAllVersion,size);
    throw new PersistenceException(Messages.getString("String_Node_Str",message));
  }
 else   if (size == 1) {
    return serializableAllVersion.get(0);
  }
 else {
    return null;
  }
}
Program: 126511
Project: 126511
Buggy source:
public IDesignerXMLMapperService getHMapperService(){
  return (IDesignerHMapperService)GlobalServiceRegister.getDefault().getService(IDesignerHMapperService.class);
}

Fixed version (ground truth):
public IDesignerHMapperService getHMapperService(){
  return (IDesignerHMapperService)GlobalServiceRegister.getDefault().getService(IDesignerHMapperService.class);
}
Program: 126513
Project: 126513
Buggy source:
public synchronized void addRepositoryChangedListener(IRepositoryChangedListener listener){
  if (listeners.contains(listener)) {
    return;
  }
  listeners.add(listener);
}

Fixed version (ground truth):
public synchronized void addRepositoryChangedListener(IRepositoryChangedListener listener){
  if (listener == null || listeners.contains(listener)) {
    return;
  }
  listeners.add(listener);
}
Program: 126514
Project: 126514
Buggy source:
/** 
 * qzhang Comment method "registerRepositoryChangedListenerAsFirst".
 * @param listener
 */
public void registerRepositoryChangedListenerAsFirst(IRepositoryChangedListener listener){
  if (listeners.contains(listener)) {
    return;
  }
  listeners.add(0,listener);
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "registerRepositoryChangedListenerAsFirst".
 * @param listener
 */
public void registerRepositoryChangedListenerAsFirst(IRepositoryChangedListener listener){
  if (listener == null || listeners.contains(listener)) {
    return;
  }
  listeners.add(0,listener);
}
Program: 126515
Project: 126515
Buggy source:
public static IRepositoryView getRepositoryView(){
  if (CommonsPlugin.isHeadless()) {
    return null;
  }
  IViewPart part=null;
  IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (activeWorkbenchWindow != null) {
    IWorkbenchPage page=activeWorkbenchWindow.getActivePage();
    if (page != null) {
      part=findRepositoryView();
      if (part == null) {
        try {
          if (IBrandingConfiguration.PERSPECTIVE_DQ_ID.equals(page.getPerspective().getId())) {
            part=((WorkbenchPage)page).getViewFactory().createView(IRepositoryView.VIEW_ID).getView(true);
          }
 else           if (IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(page.getPerspective().getId())) {
            part=page.showView(IRepositoryView.VIEW_ID);
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
      return (IRepositoryView)part;
    }
  }
  return (IRepositoryView)part;
}

Fixed version (ground truth):
public static IRepositoryView getRepositoryView(){
  if (CommonsPlugin.isHeadless()) {
    return null;
  }
  IViewPart part=null;
  IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (activeWorkbenchWindow != null) {
    IWorkbenchPage page=activeWorkbenchWindow.getActivePage();
    if (page != null) {
      part=findRepositoryView();
      if (part == null) {
        try {
          if (IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(page.getPerspective().getId())) {
            part=page.showView(IRepositoryView.VIEW_ID);
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
      return (IRepositoryView)part;
    }
  }
  return (IRepositoryView)part;
}
Program: 126516
Project: 126516
Buggy source:
public static IRepositoryView getRepositoryView(){
  if (CommonsPlugin.isHeadless()) {
    return null;
  }
  IViewPart part=null;
  IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (activeWorkbenchWindow != null) {
    IWorkbenchPage page=activeWorkbenchWindow.getActivePage();
    if (page != null) {
      part=findRepositoryView();
      if (part == null) {
        try {
          String perId=page.getPerspective().getId();
          if ((!"String_Node_Str".equals(perId) || null != perId) && perId.equalsIgnoreCase(PERSPECTIVE_DI_ID)) {
            part=page.showView(IRepositoryView.VIEW_ID);
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
      return (IRepositoryView)part;
    }
  }
  return (IRepositoryView)part;
}

Fixed version (ground truth):
public static IRepositoryView getRepositoryView(){
  if (CommonsPlugin.isHeadless()) {
    return null;
  }
  IViewPart part=null;
  IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (activeWorkbenchWindow != null) {
    IWorkbenchPage page=activeWorkbenchWindow.getActivePage();
    if (page != null) {
      part=findRepositoryView();
      if (part == null) {
        try {
          if (IBrandingConfiguration.PERSPECTIVE_DQ_ID.equals(page.getPerspective().getId())) {
            part=((WorkbenchPage)page).getViewFactory().createView(IRepositoryView.VIEW_ID).getView(true);
          }
 else           if (IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(page.getPerspective().getId())) {
            part=page.showView(IRepositoryView.VIEW_ID);
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
      return (IRepositoryView)part;
    }
  }
  return (IRepositoryView)part;
}
Program: 126518
Project: 126518
Buggy source:
@Override public void run(IProgressMonitor monitor){
  monitorWrap=SubMonitor.convert(monitor);
  List<ConceptTarget> addedObjects=new ArrayList<ConceptTarget>(event.addedObjects);
  MDMLinker.this.createFieldsLinkWithProgressMonitor(monitorWrap,addedObjects.size(),addedObjects,event.index,addedObjects.size());
  monitorWrap.done();
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor){
  monitorWrap=new EventLoopProgressMonitor(monitor);
  List<ConceptTarget> addedObjects=new ArrayList<ConceptTarget>(event.addedObjects);
  MDMLinker.this.createFieldsLinkWithProgressMonitor(monitorWrap,addedObjects.size(),addedObjects,event.index,addedObjects.size());
  monitorWrap.done();
}
Program: 126520
Project: 126520
Buggy source:
public void handleListenableListAfterTableViewerRefreshedEvent(final ListenableListEvent<ConceptTarget> event){
  if (event.type == ListenableListEvent.TYPE.ADDED) {
    ProgressDialog progressDialog=new ProgressDialog(getTree().getShell(),1000){
      private IProgressMonitor monitorWrap;
      @Override public void run(      IProgressMonitor monitor){
        monitorWrap=SubMonitor.convert(monitor);
        List<ConceptTarget> addedObjects=new ArrayList<ConceptTarget>(event.addedObjects);
        MDMLinker.this.createFieldsLinkWithProgressMonitor(monitorWrap,addedObjects.size(),addedObjects,event.index,addedObjects.size());
        monitorWrap.done();
      }
    }
;
    try {
      progressDialog.executeProcess();
    }
 catch (    InvocationTargetException e) {
      ExceptionHandler.process(e);
    }
catch (    InterruptedException e) {
    }
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == ListenableListEvent.TYPE.SWAPED) {
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == TYPE.REMOVED) {
    getBackgroundRefresher().refreshBackground();
  }
}

Fixed version (ground truth):
public void handleListenableListAfterTableViewerRefreshedEvent(final ListenableListEvent<ConceptTarget> event){
  if (event.type == ListenableListEvent.TYPE.ADDED) {
    ProgressDialog progressDialog=new ProgressDialog(getTree().getShell(),1000){
      private IProgressMonitor monitorWrap;
      @Override public void run(      IProgressMonitor monitor){
        monitorWrap=new EventLoopProgressMonitor(monitor);
        List<ConceptTarget> addedObjects=new ArrayList<ConceptTarget>(event.addedObjects);
        MDMLinker.this.createFieldsLinkWithProgressMonitor(monitorWrap,addedObjects.size(),addedObjects,event.index,addedObjects.size());
        monitorWrap.done();
      }
    }
;
    try {
      progressDialog.executeProcess();
    }
 catch (    InvocationTargetException e) {
      ExceptionHandler.process(e);
    }
catch (    InterruptedException e) {
    }
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == ListenableListEvent.TYPE.SWAPED) {
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == TYPE.REMOVED) {
    getBackgroundRefresher().refreshBackground();
  }
}
Program: 126521
Project: 126521
Buggy source:
@Override public void run(IProgressMonitor monitor){
  TreeItem root=xmlViewer.getTree().getItem(0);
  List<TreeItem> allItems=TreeUtils.collectAllItems(root);
  monitorWrap=SubMonitor.convert(monitor);
  String taskName=Messages.getString("String_Node_Str");
  int totalWork=allItems.size();
  monitorWrap.beginTask(taskName,totalWork);
  for (int i=0; i < totalWork; i++) {
    if (monitorWrap.isCanceled()) {
      return;
    }
    TreeItem treeItem=allItems.get(i);
    FOXTreeNode node=(FOXTreeNode)treeItem.getData();
    if (node.getColumn() == null) {
      continue;
    }
    createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
    monitorWrap.worked(1);
  }
  monitorWrap.done();
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor){
  TreeItem root=xmlViewer.getTree().getItem(0);
  List<TreeItem> allItems=TreeUtils.collectAllItems(root);
  monitorWrap=new EventLoopProgressMonitor(monitor);
  String taskName=Messages.getString("String_Node_Str");
  int totalWork=allItems.size();
  monitorWrap.beginTask(taskName,totalWork);
  for (int i=0; i < totalWork; i++) {
    if (monitorWrap.isCanceled()) {
      return;
    }
    TreeItem treeItem=allItems.get(i);
    FOXTreeNode node=(FOXTreeNode)treeItem.getData();
    if (node.getColumn() == null) {
      continue;
    }
    createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
    monitorWrap.worked(1);
  }
  monitorWrap.done();
}
Program: 126522
Project: 126522
Buggy source:
public void createLinks(){
  removeAllLinks();
  getBackgroundRefresher().refreshBackground();
  ProgressDialog progressDialog=new ProgressDialog(getSource().getShell(),1000){
    private IProgressMonitor monitorWrap;
    @Override public void run(    IProgressMonitor monitor){
      TreeItem root=xmlViewer.getTree().getItem(0);
      List<TreeItem> allItems=TreeUtils.collectAllItems(root);
      monitorWrap=SubMonitor.convert(monitor);
      String taskName=Messages.getString("String_Node_Str");
      int totalWork=allItems.size();
      monitorWrap.beginTask(taskName,totalWork);
      for (int i=0; i < totalWork; i++) {
        if (monitorWrap.isCanceled()) {
          return;
        }
        TreeItem treeItem=allItems.get(i);
        FOXTreeNode node=(FOXTreeNode)treeItem.getData();
        if (node.getColumn() == null) {
          continue;
        }
        createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
        monitorWrap.worked(1);
      }
      monitorWrap.done();
    }
  }
;
  try {
    progressDialog.executeProcess();
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
    ExceptionHandler.process(e);
  }
catch (  InterruptedException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public void createLinks(){
  removeAllLinks();
  getBackgroundRefresher().refreshBackground();
  ProgressDialog progressDialog=new ProgressDialog(getSource().getShell(),1000){
    private IProgressMonitor monitorWrap;
    @Override public void run(    IProgressMonitor monitor){
      TreeItem root=xmlViewer.getTree().getItem(0);
      List<TreeItem> allItems=TreeUtils.collectAllItems(root);
      monitorWrap=new EventLoopProgressMonitor(monitor);
      String taskName=Messages.getString("String_Node_Str");
      int totalWork=allItems.size();
      monitorWrap.beginTask(taskName,totalWork);
      for (int i=0; i < totalWork; i++) {
        if (monitorWrap.isCanceled()) {
          return;
        }
        TreeItem treeItem=allItems.get(i);
        FOXTreeNode node=(FOXTreeNode)treeItem.getData();
        if (node.getColumn() == null) {
          continue;
        }
        createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
        monitorWrap.worked(1);
      }
      monitorWrap.done();
    }
  }
;
  try {
    progressDialog.executeProcess();
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
    ExceptionHandler.process(e);
  }
catch (  InterruptedException e) {
    ExceptionHandler.process(e);
  }
}
Program: 126524
Project: 126524
Buggy source:
public void handleListenableListAfterTableViewerRefreshedEvent(final ListenableListEvent<SchemaTarget> event){
  if (event.type == ListenableListEvent.TYPE.ADDED) {
    ProgressDialog progressDialog=new ProgressDialog(getTree().getShell(),1000){
      private IProgressMonitor monitorWrap;
      @Override public void run(      IProgressMonitor monitor){
        monitorWrap=SubMonitor.convert(monitor);
        List<SchemaTarget> addedObjects=new ArrayList<SchemaTarget>(event.addedObjects);
        XmlToXPathLinker.this.createFieldsLinkWithProgressMonitor(monitorWrap,addedObjects.size(),addedObjects,event.index,addedObjects.size());
        monitorWrap.done();
      }
    }
;
    try {
      progressDialog.executeProcess();
    }
 catch (    InvocationTargetException e) {
      ExceptionHandler.process(e);
    }
catch (    InterruptedException e) {
    }
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == ListenableListEvent.TYPE.SWAPED) {
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == TYPE.REMOVED) {
    getBackgroundRefresher().refreshBackground();
  }
}

Fixed version (ground truth):
public void handleListenableListAfterTableViewerRefreshedEvent(final ListenableListEvent<SchemaTarget> event){
  if (event.type == ListenableListEvent.TYPE.ADDED) {
    ProgressDialog progressDialog=new ProgressDialog(getTree().getShell(),1000){
      private IProgressMonitor monitorWrap;
      @Override public void run(      IProgressMonitor monitor){
        monitorWrap=new EventLoopProgressMonitor(monitor);
        List<SchemaTarget> addedObjects=new ArrayList<SchemaTarget>(event.addedObjects);
        XmlToXPathLinker.this.createFieldsLinkWithProgressMonitor(monitorWrap,addedObjects.size(),addedObjects,event.index,addedObjects.size());
        monitorWrap.done();
      }
    }
;
    try {
      progressDialog.executeProcess();
    }
 catch (    InvocationTargetException e) {
      ExceptionHandler.process(e);
    }
catch (    InterruptedException e) {
    }
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == ListenableListEvent.TYPE.SWAPED) {
    getBackgroundRefresher().refreshBackground();
  }
 else   if (event.type == TYPE.REMOVED) {
    getBackgroundRefresher().refreshBackground();
  }
}
Program: 126525
Project: 126525
Buggy source:
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  Timer timer=Timer.getTimer("String_Node_Str");
  timer.start();
  if (needInitialize) {
    monitorWrap=SubMonitor.convert(monitor);
    try {
      final ProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
      factory.initialize();
    }
 catch (    Exception e) {
      throw new InvocationTargetException(e);
    }
  }
  viewer.refresh();
  viewer.setSelection(new TreeSelection());
  expandTreeRootIfOnlyOneRoot();
  if (PluginChecker.isJobLetPluginLoaded()) {
    IJobletProviderService jobletService=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    if (jobletService != null) {
      jobletService.loadComponentsFromProviders();
    }
  }
  timer.stop();
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  Timer timer=Timer.getTimer("String_Node_Str");
  timer.start();
  if (needInitialize) {
    monitorWrap=new EventLoopProgressMonitor(monitor);
    try {
      final ProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
      factory.initialize();
    }
 catch (    Exception e) {
      throw new InvocationTargetException(e);
    }
  }
  viewer.refresh();
  viewer.setSelection(new TreeSelection());
  expandTreeRootIfOnlyOneRoot();
  if (PluginChecker.isJobLetPluginLoaded()) {
    IJobletProviderService jobletService=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    if (jobletService != null) {
      jobletService.loadComponentsFromProviders();
    }
  }
  timer.stop();
}
Program: 126527
Project: 126527
Buggy source:
/** 
 * Constructor to use by a Wizard to create a new database connection.
 * @param existingNames
 * @param Composite
 * @param Wizard
 * @param ISelection
 */
public DatabaseForm(Composite parent,ConnectionItem connectionItem,String[] existingNames,boolean isCreation){
  super(parent,SWT.NONE,existingNames);
  this.connectionItem=connectionItem;
  this.isCreation=isCreation;
  setConnectionItem(connectionItem);
  this.metadataconnection=ConvertionHelper.convert(getConnection(),true);
  originalUischema=metadataconnection.getUiSchema() == null ? "String_Node_Str" : metadataconnection.getUiSchema();
  originalURL=metadataconnection.getUrl();
  originalIsNeedReload=ConnectionHelper.getIsConnNeedReload(getConnection());
  this.typeName=EDatabaseTypeName.getTypeFromDbType(metadataconnection.getDbType());
  if (typeName != null && typeName.isUseProvider()) {
    this.provider=ExtractMetaDataFromDataBase.getProviderByDbType(metadataconnection.getDbType());
  }
  setupForm(true);
  exportContextBtn.getControl().getParent().getParent().setParent(hidableArea);
  sash.setSashWidth(2);
  sash.setWeights(new int[]{21,12});
  addStringConnectionControls();
  GridLayout layout2=(GridLayout)getLayout();
  layout2.marginHeight=0;
  setLayout(layout2);
}

Fixed version (ground truth):
/** 
 * Constructor to use by a Wizard to create a new database connection.
 * @param existingNames
 * @param Composite
 * @param Wizard
 * @param ISelection
 */
public DatabaseForm(Composite parent,ConnectionItem connectionItem,String[] existingNames,boolean isCreation){
  super(parent,SWT.NONE,existingNames);
  this.connectionItem=connectionItem;
  this.isCreation=isCreation;
  setConnectionItem(connectionItem);
  this.metadataconnection=ConvertionHelper.convert(getConnection(),true);
  originalUischema=metadataconnection.getUiSchema() == null ? "String_Node_Str" : metadataconnection.getUiSchema();
  originalURL=metadataconnection.getUrl();
  originalIsNeedReload=ConnectionHelper.getIsConnNeedReload(getConnection());
  this.typeName=EDatabaseTypeName.getTypeFromDbType(metadataconnection.getDbType());
  if (typeName != null && typeName.isUseProvider()) {
    this.provider=ExtractMetaDataFromDataBase.getProviderByDbType(metadataconnection.getDbType());
  }
  setupForm(true);
  refreshHidableArea();
  addStringConnectionControls();
  GridLayout layout2=(GridLayout)getLayout();
  layout2.marginHeight=0;
  setLayout(layout2);
}
Program: 126528
Project: 126528
Buggy source:
/** 
 * Checks if Hive can be connected, if yes, then return <code>true</code> for {  {@link #isValide} with successfulmessage  {@link #messageException}. Otherwise, return <code>false</code>. In fact, in this method it invokes  {@link HiveConnectionManager#checkHiveConnection(IMetadataConnection)} to check hive connection. Added by MarvinWang on Mar 18, 2013.
 * @param metadataConn
 * @return
 */
public boolean checkHiveConnection(IMetadataConnection metadataConn){
  try {
    HiveConnectionManager.getInstance().checkConnection(metadataConn);
    isValide=true;
    messageException=Messages.getString("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    isValide=false;
    messageException=ExceptionUtils.getFullStackTrace(e);
    CommonExceptionHandler.process(e);
  }
catch (  InstantiationException e) {
    isValide=false;
    messageException=ExceptionUtils.getFullStackTrace(e);
    CommonExceptionHandler.process(e);
  }
catch (  IllegalAccessException e) {
    isValide=false;
    messageException=ExceptionUtils.getFullStackTrace(e);
    CommonExceptionHandler.process(e);
  }
catch (  SQLException e) {
    isValide=false;
    messageException=ExceptionUtils.getFullStackTrace(e);
    CommonExceptionHandler.process(e);
  }
  return isValide;
}

Fixed version (ground truth):
/** 
 * Checks if Hive can be connected, if yes, then return <code>true</code> for {  {@link #isValide} with successfulmessage  {@link #messageException}. Otherwise, return <code>false</code>. In fact, in this method it invokes  {@link HiveConnectionManager#checkHiveConnection(IMetadataConnection)} to check hive connection. Added by MarvinWang on Mar 18, 2013.
 * @param metadataConn
 * @return
 */
public boolean checkHiveConnection(IMetadataConnection metadataConn){
  try {
    HiveConnectionManager.getInstance().checkConnection(metadataConn);
    isValide=true;
    messageException=Messages.getString("String_Node_Str");
  }
 catch (  Exception e) {
    isValide=false;
    messageException=ExceptionUtils.getFullStackTrace(e);
    CommonExceptionHandler.process(e);
  }
  return isValide;
}
Program: 126529
Project: 126529
Buggy source:
/** 
 * Only work with one element.
 * @param element
 * @param text
 * @return
 */
public static Object getObjectValue(final IElement element,final String text){
  if (text == null) {
    return null;
  }
  IElementParameter param;
  List<IElementParameter> params=(List<IElementParameter>)element.getElementParametersWithChildrens();
  if (params != null && !params.isEmpty()) {
    for (int i=0; i < params.size(); i++) {
      param=params.get(i);
      if (text.indexOf(param.getVariableName()) != -1 || (param.getVariableName() != null && param.getVariableName().contains(text))) {
        if (param.getFieldType() == EParameterFieldType.TABLE) {
          return createTableValues((List<Map<String,Object>>)param.getValue(),param);
        }
        return param.getValue();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Only work with one element.
 * @param element
 * @param text
 * @return
 */
public static Object getObjectValue(final IElement element,final String text){
  if (text == null || element == null) {
    return null;
  }
  IElementParameter param;
  List<IElementParameter> params=(List<IElementParameter>)element.getElementParametersWithChildrens();
  if (params != null && !params.isEmpty()) {
    for (int i=0; i < params.size(); i++) {
      param=params.get(i);
      if (text.indexOf(param.getVariableName()) != -1 || (param.getVariableName() != null && param.getVariableName().contains(text))) {
        if (param.getFieldType() == EParameterFieldType.TABLE) {
          return createTableValues((List<Map<String,Object>>)param.getValue(),param);
        }
        return param.getValue();
      }
    }
  }
  return null;
}
Program: 126530
Project: 126530
Buggy source:
public void update();

Fixed version (ground truth):
public boolean update();
Program: 126532
Project: 126532
Buggy source:
/** 
 * Constructor to use by a Wizard to create a new database connection.
 * @param existingNames
 * @param Composite
 * @param Wizard
 * @param ISelection
 */
public DatabaseForm(Composite parent,ConnectionItem connectionItem,String[] existingNames,boolean isCreation){
  super(parent,SWT.NONE,existingNames);
  this.connectionItem=connectionItem;
  this.isCreation=isCreation;
  setConnectionItem(connectionItem);
  this.metadataconnection=ConvertionHelper.convert(getConnection(),true);
  originalUischema=metadataconnection.getUiSchema() == null ? "String_Node_Str" : metadataconnection.getUiSchema();
  originalURL=metadataconnection.getUrl();
  originalIsNeedReload=ConnectionHelper.getIsConnNeedReload(getConnection());
  this.typeName=EDatabaseTypeName.getTypeFromDbType(metadataconnection.getDbType());
  if (typeName != null && typeName.isUseProvider()) {
    this.provider=ExtractMetaDataFromDataBase.getProviderByDbType(metadataconnection.getDbType());
  }
  setupForm(true);
  exportContextBtn.getControl().getParent().getParent().setParent(hidableArea);
  sash.setSashWidth(2);
  sash.setWeights(new int[]{21,12});
  addStringConnectionControls();
  GridLayout layout2=(GridLayout)getLayout();
  layout2.marginHeight=0;
  setLayout(layout2);
}

Fixed version (ground truth):
/** 
 * Constructor to use by a Wizard to create a new database connection.
 * @param existingNames
 * @param Composite
 * @param Wizard
 * @param ISelection
 */
public DatabaseForm(Composite parent,ConnectionItem connectionItem,String[] existingNames,boolean isCreation){
  super(parent,SWT.NONE,existingNames);
  this.connectionItem=connectionItem;
  this.isCreation=isCreation;
  setConnectionItem(connectionItem);
  this.metadataconnection=ConvertionHelper.convert(getConnection(),true);
  originalUischema=metadataconnection.getUiSchema() == null ? "String_Node_Str" : metadataconnection.getUiSchema();
  originalURL=metadataconnection.getUrl();
  originalIsNeedReload=ConnectionHelper.getIsConnNeedReload(getConnection());
  this.typeName=EDatabaseTypeName.getTypeFromDbType(metadataconnection.getDbType());
  if (typeName != null && typeName.isUseProvider()) {
    this.provider=ExtractMetaDataFromDataBase.getProviderByDbType(metadataconnection.getDbType());
  }
  setupForm(true);
  refreshHidableArea();
  addStringConnectionControls();
  GridLayout layout2=(GridLayout)getLayout();
  layout2.marginHeight=0;
  setLayout(layout2);
}
Program: 126533
Project: 126533
Buggy source:
public void update();

Fixed version (ground truth):
public boolean update();