nus-yam/ex-repair huggingface dataset:
Program: 147710
Project: 147710
Buggy source:
private static ExternalInfoHolder<?> getHolderFromExtension(String type){
  IExtensionPoint point=Platform.getExtensionRegistry().getExtensionPoint(holderExtension);
  if (null == point) {
    return null;
  }
  for (  IExtension ext : point.getExtensions()) {
    IConfigurationElement[] configurationElements=ext.getConfigurationElements();
    for (    IConfigurationElement ce : configurationElements) {
      String id=ce.getAttribute("String_Node_Str");
      if (type.equals(id)) {
        try {
          return (ExternalInfoHolder<?>)ce.createExecutableExtension("String_Node_Str");
        }
 catch (        CoreException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static ExternalInfoHolder<?> getHolderFromExtension(String type){
  IExtensionPoint point=Platform.getExtensionRegistry().getExtensionPoint(holderExtension);
  if (null == point) {
    return null;
  }
  for (  IExtension ext : point.getExtensions()) {
    IConfigurationElement[] configurationElements=ext.getConfigurationElements();
    for (    IConfigurationElement ce : configurationElements) {
      String id=ce.getAttribute("String_Node_Str");
      if (type.equals(id)) {
        try {
          return (ExternalInfoHolder<?>)ce.createExecutableExtension("String_Node_Str");
        }
 catch (        CoreException e) {
          log.error(e.getMessage());
        }
      }
    }
  }
  return null;
}
Program: 147711
Project: 147711
Buggy source:
public ConsistencyCheckResult checkConsistency(MDMServerDef serverDef,Collection<IRepositoryViewObject> viewObjs) throws XtentisException, RemoteException {
  updateLocalDigestValue(viewObjs);
  Map<IRepositoryViewObject,WSDigestValueTimeStamp> viewObjMap=queryServerDigestValue(serverDef,viewObjs);
  int conflictCount=getConflictCount(viewObjMap);
  if (conflictCount > 0) {
    if (isWarnUserWhenConflict()) {
      ConfirmConflictMessageDialog confirmDialog=new ConfirmConflictMessageDialog(getShell(),conflictCount);
      int returnValue=confirmDialog.open();
      if (returnValue == IDialogConstants.OK_ID) {
        int strategy=confirmDialog.getStrategy();
        return getCheckResultByStrategy(strategy,viewObjMap);
      }
 else       if (returnValue == IDialogConstants.DETAILS_ID) {
        ConsistencyConflictDialog dialog=new ConsistencyConflictDialog(getShell(),conflictCount,viewObjMap);
        dialog.open();
        return dialog.getResult();
      }
 else {
        return new ConsistencyCheckResult();
      }
    }
 else {
      int strategy=getConflictStrategy();
      return getCheckResultByStrategy(strategy,viewObjMap);
    }
  }
 else {
    return new ConsistencyCheckResult(viewObjs);
  }
}

Fixed version (ground truth):
public ConsistencyCheckResult checkConsistency(MDMServerDef serverDef,Collection<IRepositoryViewObject> viewObjs) throws XtentisException, RemoteException {
  updateLocalDigestValue(viewObjs);
  Map<IRepositoryViewObject,WSDigest> viewObjMap=queryServerDigestValue(serverDef,viewObjs);
  int conflictCount=getConflictCount(viewObjMap);
  if (conflictCount > 0) {
    if (isWarnUserWhenConflict()) {
      ConfirmConflictMessageDialog confirmDialog=new ConfirmConflictMessageDialog(getShell(),conflictCount);
      int returnValue=confirmDialog.open();
      if (returnValue == IDialogConstants.OK_ID) {
        int strategy=confirmDialog.getStrategy();
        return getCheckResultByStrategy(strategy,viewObjMap);
      }
 else       if (returnValue == IDialogConstants.DETAILS_ID) {
        ConsistencyConflictDialog dialog=new ConsistencyConflictDialog(getShell(),conflictCount,viewObjMap);
        dialog.open();
        return dialog.getResult();
      }
 else {
        return new ConsistencyCheckResult();
      }
    }
 else {
      int strategy=getConflictStrategy();
      return getCheckResultByStrategy(strategy,viewObjMap);
    }
  }
 else {
    return new ConsistencyCheckResult(viewObjs);
  }
}
Program: 147712
Project: 147712
Buggy source:
private int getConflictCount(Map<IRepositoryViewObject,WSDigestValueTimeStamp> map){
  int total=0;
  for (  IRepositoryViewObject viewObj : map.keySet()) {
    WSDigestValueTimeStamp digestTime=map.get(viewObj);
    if (digestTime != null && digestTime.getDigestValue() != null) {
      String localDigestValue=getLocalDigestValue(viewObj.getProperty().getItem());
      if (localDigestValue != null) {
        if (!localDigestValue.equals(digestTime.getDigestValue())) {
          total++;
        }
      }
    }
  }
  return total;
}

Fixed version (ground truth):
private int getConflictCount(Map<IRepositoryViewObject,WSDigest> map){
  int total=0;
  for (  IRepositoryViewObject viewObj : map.keySet()) {
    WSDigest digestTime=map.get(viewObj);
    if (digestTime != null && digestTime.getDigestValue() != null) {
      String localDigestValue=getLocalDigestValue(viewObj.getProperty().getItem());
      if (localDigestValue != null) {
        if (!localDigestValue.equals(digestTime.getDigestValue())) {
          total++;
        }
      }
    }
  }
  return total;
}
Program: 147713
Project: 147713
Buggy source:
private ConsistencyCheckResult getCheckResultByStrategy(int strategy,Map<IRepositoryViewObject,WSDigestValueTimeStamp> viewObjMap){
  List<IRepositoryViewObject> toDeployObjs=new LinkedList<IRepositoryViewObject>();
  List<IRepositoryViewObject> toSkipObjs=new LinkedList<IRepositoryViewObject>();
  for (  IRepositoryViewObject viewObj : viewObjMap.keySet()) {
    WSDigestValueTimeStamp dt=viewObjMap.get(viewObj);
    if (dt == null) {
      toDeployObjs.add(viewObj);
    }
 else {
      Item item=viewObj.getProperty().getItem();
      String localDigestValue=ConsistencyService.getInstance().getLocalDigestValue(item);
      String serverDigestValue=dt.getDigestValue();
      if (localDigestValue.equals(serverDigestValue)) {
        if (strategy == CONFLICT_STRATEGY_DEFAULT || strategy == CONFLICT_STRATEGY_SKIP_DIFFERENCE) {
          toSkipObjs.add(viewObj);
        }
 else         if (strategy == CONFLICT_STRATEGY_OVERWRITE) {
          toDeployObjs.add(viewObj);
        }
      }
 else {
        if (strategy == CONFLICT_STRATEGY_SKIP_DIFFERENCE) {
          toSkipObjs.add(viewObj);
        }
 else         if (strategy == CONFLICT_STRATEGY_DEFAULT || strategy == CONFLICT_STRATEGY_OVERWRITE) {
          toDeployObjs.add(viewObj);
        }
      }
    }
  }
  return new ConsistencyCheckResult(toDeployObjs,toSkipObjs);
}

Fixed version (ground truth):
private ConsistencyCheckResult getCheckResultByStrategy(int strategy,Map<IRepositoryViewObject,WSDigest> viewObjMap){
  List<IRepositoryViewObject> toDeployObjs=new LinkedList<IRepositoryViewObject>();
  List<IRepositoryViewObject> toSkipObjs=new LinkedList<IRepositoryViewObject>();
  for (  IRepositoryViewObject viewObj : viewObjMap.keySet()) {
    WSDigest dt=viewObjMap.get(viewObj);
    if (dt == null) {
      toDeployObjs.add(viewObj);
    }
 else {
      Item item=viewObj.getProperty().getItem();
      String localDigestValue=ConsistencyService.getInstance().getLocalDigestValue(item);
      String serverDigestValue=dt.getDigestValue();
      if (localDigestValue.equals(serverDigestValue)) {
        if (strategy == CONFLICT_STRATEGY_DEFAULT || strategy == CONFLICT_STRATEGY_SKIP_DIFFERENCE) {
          toSkipObjs.add(viewObj);
        }
 else         if (strategy == CONFLICT_STRATEGY_OVERWRITE) {
          toDeployObjs.add(viewObj);
        }
      }
 else {
        if (strategy == CONFLICT_STRATEGY_SKIP_DIFFERENCE) {
          toSkipObjs.add(viewObj);
        }
 else         if (strategy == CONFLICT_STRATEGY_DEFAULT || strategy == CONFLICT_STRATEGY_OVERWRITE) {
          toDeployObjs.add(viewObj);
        }
      }
    }
  }
  return new ConsistencyCheckResult(toDeployObjs,toSkipObjs);
}
Program: 147714
Project: 147714
Buggy source:
public <T>Map<T,WSDigestValueTimeStamp> queryServerDigestValue(MDMServerDef serverDef,Collection<T> objs) throws XtentisException, RemoteException {
  Map<T,WSDigestValueTimeStamp> result=new LinkedHashMap<T,WSDigestValueTimeStamp>();
  XtentisPort port=RepositoryWebServiceAdapter.getXtentisPort(serverDef);
  for (  T obj : objs) {
    String type=null;
    String objectName=null;
    if (obj instanceof IRepositoryViewObject) {
      IRepositoryViewObject viewObj=(IRepositoryViewObject)obj;
      type=viewObj.getRepositoryObjectType().getKey();
      objectName=viewObj.getLabel();
    }
 else     if (obj instanceof TreeObject) {
      TreeObject treeObj=(TreeObject)obj;
      ERepositoryObjectType repositoryObjectType=RepositoryQueryService.getRepositoryObjectType(treeObj.getType());
      if (type != null) {
        type=repositoryObjectType.getKey();
        objectName=treeObj.getDisplayName();
      }
    }
    if (type != null && objectName != null) {
      WSDigestValueTimeStamp digest=port.getDigest(new WSDigestValueKey(type,objectName));
      result.put(obj,digest);
    }
  }
  return result;
}

Fixed version (ground truth):
public <T>Map<T,WSDigest> queryServerDigestValue(MDMServerDef serverDef,Collection<T> objs) throws XtentisException, RemoteException {
  Map<T,WSDigest> result=new LinkedHashMap<T,WSDigest>();
  XtentisPort port=RepositoryWebServiceAdapter.getXtentisPort(serverDef);
  for (  T obj : objs) {
    String type=null;
    String objectName=null;
    if (obj instanceof IRepositoryViewObject) {
      IRepositoryViewObject viewObj=(IRepositoryViewObject)obj;
      type=viewObj.getRepositoryObjectType().getKey();
      objectName=viewObj.getLabel();
    }
 else     if (obj instanceof TreeObject) {
      TreeObject treeObj=(TreeObject)obj;
      ERepositoryObjectType repositoryObjectType=RepositoryQueryService.getRepositoryObjectType(treeObj.getType());
      if (type != null) {
        type=repositoryObjectType.getKey();
        objectName=treeObj.getDisplayName();
      }
    }
    if (type != null && objectName != null) {
      WSDigest digest=port.getDigest(new WSDigestKey(type,objectName));
      result.put(obj,digest);
    }
  }
  return result;
}
Program: 147715
Project: 147715
Buggy source:
public void updateDigestValue(MDMServerDef serverDef,IRepositoryViewObject viewObj) throws XtentisException {
  XtentisPort port=RepositoryWebServiceAdapter.getXtentisPort(serverDef);
  updateLocalDigestValue(viewObj);
  Item item=viewObj.getProperty().getItem();
  WSDigestValueTimeStamp value=new WSDigestValueTimeStamp(getLocalDigestValue(item),0L);
  String type=viewObj.getRepositoryObjectType().getKey();
  String objectName=viewObj.getLabel();
  WSDigestValueKey key=new WSDigestValueKey(type,objectName);
  WSLong timeValue=port.updateDigest(key,value);
  if (timeValue != null) {
    updateLocalTimestamp(item,timeValue.getValue());
  }
}

Fixed version (ground truth):
public void updateDigestValue(MDMServerDef serverDef,IRepositoryViewObject viewObj) throws XtentisException, RemoteException {
  XtentisPort port=RepositoryWebServiceAdapter.getXtentisPort(serverDef);
  updateLocalDigestValue(viewObj);
  Item item=viewObj.getProperty().getItem();
  String type=viewObj.getRepositoryObjectType().getKey();
  String objectName=viewObj.getLabel();
  WSDigestKey key=new WSDigestKey(type,objectName);
  WSDigest value=new WSDigest(key,getLocalDigestValue(item),0L);
  WSLong timeValue=port.updateDigest(value);
  if (timeValue != null) {
    updateLocalTimestamp(item,timeValue.getValue());
  }
}
Program: 147716
Project: 147716
Buggy source:
private void updateServerConsistencyStatus(MDMServerDef serverDef,Collection<IRepositoryViewObject> viewObjs) throws XtentisException {
  ConsistencyService consistencyService=ConsistencyService.getInstance();
  for (  IRepositoryViewObject viewObj : viewObjs) {
    consistencyService.updateDigestValue(serverDef,viewObj);
  }
}

Fixed version (ground truth):
private void updateServerConsistencyStatus(MDMServerDef serverDef,Collection<IRepositoryViewObject> viewObjs) throws XtentisException, RemoteException {
  ConsistencyService consistencyService=ConsistencyService.getInstance();
  for (  IRepositoryViewObject viewObj : viewObjs) {
    consistencyService.updateDigestValue(serverDef,viewObj);
  }
}
Program: 147718
Project: 147718
Buggy source:
/** 
 * Create the dialog.
 * @param parentShell
 * @param conflictCount
 */
public ConsistencyConflictDialog(Shell parentShell,int conflictCount,Map<IRepositoryViewObject,WSDigestValueTimeStamp> viewObjMap){
  super(parentShell);
  this.conflictCount=conflictCount;
  this.viewObjMap=viewObjMap;
  setShellStyle(getShellStyle() | SWT.RESIZE);
}

Fixed version (ground truth):
/** 
 * Create the dialog.
 * @param parentShell
 * @param conflictCount
 */
public ConsistencyConflictDialog(Shell parentShell,int conflictCount,Map<IRepositoryViewObject,WSDigest> viewObjMap){
  super(parentShell);
  this.conflictCount=conflictCount;
  this.viewObjMap=viewObjMap;
  setShellStyle(getShellStyle() | SWT.RESIZE);
}
Program: 147719
Project: 147719
Buggy source:
public String getColumnText(Object element,int columnIndex){
  IRepositoryViewObject viewObj=(IRepositoryViewObject)element;
  if (element instanceof FolderRepositoryObject) {
    if (columnIndex == 0) {
      return getViewObjName(viewObj);
    }
  }
 else {
switch (columnIndex) {
case 0:
      return getViewObjName(viewObj);
case 1:
    CompareResultEnum compareResult=getCompareResult(viewObj);
switch (compareResult) {
case NOT_EXIST_IN_SERVER:
    return Messages.ConsistencyConflictDialog_notExist;
case SAME:
  return Messages.ConsistencyConflict_Same;
case DIFFERENT:
return Messages.ConsistencyConflict_Different;
}
break;
case 2:
return getOperationLabel(viewObj);
case 3:
Item item=viewObj.getProperty().getItem();
long localTimestamp=ConsistencyService.getInstance().getLocalTimestamp(item);
if (localTimestamp > 0) {
return df.format(new Date(localTimestamp));
}
break;
case 4:
WSDigestValueTimeStamp dt=viewObjMap.get(viewObj);
if (dt != null) {
return df.format(new Date(dt.getTimeStamp()));
}
break;
}
}
return "String_Node_Str";
}

Fixed version (ground truth):
public String getColumnText(Object element,int columnIndex){
  IRepositoryViewObject viewObj=(IRepositoryViewObject)element;
  if (element instanceof FolderRepositoryObject) {
    if (columnIndex == 0) {
      return getViewObjName(viewObj);
    }
  }
 else {
switch (columnIndex) {
case 0:
      return getViewObjName(viewObj);
case 1:
    CompareResultEnum compareResult=getCompareResult(viewObj);
switch (compareResult) {
case NOT_EXIST_IN_SERVER:
    return Messages.ConsistencyConflictDialog_notExist;
case SAME:
  return Messages.ConsistencyConflict_Same;
case DIFFERENT:
return Messages.ConsistencyConflict_Different;
}
break;
case 2:
return getOperationLabel(viewObj);
case 3:
Item item=viewObj.getProperty().getItem();
long localTimestamp=ConsistencyService.getInstance().getLocalTimestamp(item);
if (localTimestamp > 0) {
return df.format(new Date(localTimestamp));
}
break;
case 4:
WSDigest dt=viewObjMap.get(viewObj);
if (dt != null) {
return df.format(new Date(dt.getTimeStamp()));
}
break;
}
}
return "String_Node_Str";
}
Program: 147720
Project: 147720
Buggy source:
private CompareResultEnum getCompareResult(IRepositoryViewObject viewObj){
  CompareResultEnum result=compareResultMap.get(viewObj);
  if (result == null) {
    WSDigestValueTimeStamp dt=viewObjMap.get(viewObj);
    if (dt == null) {
      result=CompareResultEnum.NOT_EXIST_IN_SERVER;
    }
 else {
      Item item=viewObj.getProperty().getItem();
      String localDigestValue=ConsistencyService.getInstance().getLocalDigestValue(item);
      String serverDigestValue=dt.getDigestValue();
      if (localDigestValue.equals(serverDigestValue)) {
        result=CompareResultEnum.SAME;
      }
 else {
        result=CompareResultEnum.DIFFERENT;
      }
    }
    compareResultMap.put(viewObj,result);
  }
  return result;
}

Fixed version (ground truth):
private CompareResultEnum getCompareResult(IRepositoryViewObject viewObj){
  CompareResultEnum result=compareResultMap.get(viewObj);
  if (result == null) {
    WSDigest dt=viewObjMap.get(viewObj);
    if (dt == null) {
      result=CompareResultEnum.NOT_EXIST_IN_SERVER;
    }
 else {
      Item item=viewObj.getProperty().getItem();
      String localDigestValue=ConsistencyService.getInstance().getLocalDigestValue(item);
      String serverDigestValue=dt.getDigestValue();
      if (localDigestValue.equals(serverDigestValue)) {
        result=CompareResultEnum.SAME;
      }
 else {
        result=CompareResultEnum.DIFFERENT;
      }
    }
    compareResultMap.put(viewObj,result);
  }
  return result;
}
Program: 147721
Project: 147721
Buggy source:
public void setLocalDigestTime(WSDigestValueTimeStamp localDigestTime){
  this.localDigestTime=localDigestTime;
}

Fixed version (ground truth):
public void setLocalDigestTime(WSDigest localDigestTime){
  this.localDigestTime=localDigestTime;
}
Program: 147722
Project: 147722
Buggy source:
public WSDigestValueTimeStamp getServerDigestTime(){
  return this.serverDigestTime;
}

Fixed version (ground truth):
public WSDigest getServerDigestTime(){
  return this.serverDigestTime;
}
Program: 147723
Project: 147723
Buggy source:
public void setServerDigestTime(WSDigestValueTimeStamp serverDigestTime){
  this.serverDigestTime=serverDigestTime;
}

Fixed version (ground truth):
public void setServerDigestTime(WSDigest serverDigestTime){
  this.serverDigestTime=serverDigestTime;
}
Program: 147724
Project: 147724
Buggy source:
public WSDigestValueTimeStamp getLocalDigestTime(){
  return this.localDigestTime;
}

Fixed version (ground truth):
public WSDigest getLocalDigestTime(){
  return this.localDigestTime;
}
Program: 147726
Project: 147726
Buggy source:
@Override public String getText(Object element){
  if (!(element instanceof TreeParent)) {
    ConsistencyData consistencyData=consistencyMap.get(element);
    WSDigestValueTimeStamp dt=isLocal ? consistencyData.getLocalDigestTime() : consistencyData.getServerDigestTime();
    if (dt != null) {
      return DATE_FORMAT.format(new Date(dt.getTimeStamp()));
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getText(Object element){
  if (!(element instanceof TreeParent)) {
    ConsistencyData consistencyData=consistencyMap.get(element);
    WSDigest dt=isLocal ? consistencyData.getLocalDigestTime() : consistencyData.getServerDigestTime();
    if (dt != null) {
      return DATE_FORMAT.format(new Date(dt.getTimeStamp()));
    }
  }
  return "String_Node_Str";
}
Program: 147728
Project: 147728
Buggy source:
public static IEditorPart getRepositoryEditor(RepositoryNode node){
  IEditorPart[] parts=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getDirtyEditors();
  for (  IEditorPart part : parts) {
    IEditorInput inputObj=part.getEditorInput();
    if (inputObj instanceof RepositoryEditorInput) {
      RepositoryEditorInput input=(RepositoryEditorInput)inputObj;
      if (input.getRepositoryNode().equals(node)) {
        return part;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static IEditorPart getRepositoryEditor(RepositoryNode node){
  IEditorPart[] parts=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getDirtyEditors();
  for (  IEditorPart part : parts) {
    IEditorInput inputObj=part.getEditorInput();
    if (inputObj instanceof RepositoryEditorInput) {
      RepositoryEditorInput input=(RepositoryEditorInput)inputObj;
      if (equals(input.getRepositoryNode(),node)) {
        return part;
      }
    }
  }
  return null;
}
Program: 147729
Project: 147729
Buggy source:
private boolean isInSvnMode(){
  if (isInSvnMode == null) {
    try {
      if (!factory.isLocalConnectionProvider()) {
        if (svnProviderSerice != null && svnProviderSerice.isProjectInSvnMode()) {
          isInSvnMode=Boolean.TRUE;
        }
      }
    }
 catch (    PersistenceException e) {
      log.error(e.getMessage(),e);
    }
    if (isInSvnMode == null) {
      isInSvnMode=Boolean.FALSE;
    }
  }
  return isInSvnMode.booleanValue();
}

Fixed version (ground truth):
private boolean isInSvnMode(){
  if (isInSvnMode == null) {
    try {
      if (!factory.isLocalConnectionProvider()) {
        IMDMSVNProviderService service=getSvnProviderService();
        if (service != null && service.isProjectInSvnMode()) {
          isInSvnMode=Boolean.TRUE;
        }
      }
    }
 catch (    PersistenceException e) {
      log.error(e.getMessage(),e);
    }
    if (isInSvnMode == null) {
      isInSvnMode=Boolean.FALSE;
    }
  }
  return isInSvnMode.booleanValue();
}
Program: 147730
Project: 147730
Buggy source:
@Override public String getToolTipText(Object element){
  if (isInSvnMode()) {
    IRepositoryViewObject viewObj=(IRepositoryViewObject)element;
    String toolTip=svnProviderSerice.getLockInfo(viewObj);
    return toolTip;
  }
  return null;
}

Fixed version (ground truth):
@Override public String getToolTipText(Object element){
  if (isInSvnMode()) {
    IRepositoryViewObject viewObj=(IRepositoryViewObject)element;
    if (getSvnProviderService() != null) {
      String toolTip=getSvnProviderService().getLockInfo(viewObj);
      return toolTip;
    }
  }
  return null;
}
Program: 147731
Project: 147731
Buggy source:
public com.amalto.workbench.webservices.WSDigestValueTimeStamp getDigest(WSDigestKey wsDigestKey) throws java.rmi.RemoteException ;

Fixed version (ground truth):
public com.amalto.workbench.webservices.WSDigest getDigest(WSDigestKey wsDigestKey) throws java.rmi.RemoteException ;
Program: 147732
Project: 147732
Buggy source:
public WSDigestValueTimeStamp getDigest(WSDigestKey wsDigestKey) throws RemoteException {
  return null;
}

Fixed version (ground truth):
public WSDigest getDigest(WSDigestKey wsDigestKey) throws RemoteException {
  return null;
}
Program: 147733
Project: 147733
Buggy source:
public void openConsole(){
  List<MDMServerDef> allServerDefs=ServerDefService.getAllServerDefs();
  if (allServerDefs == null || allServerDefs.isEmpty()) {
    MessageDialog.openInformation(null,Messages.ShowMDMServerConsole_InfoDialog_Title,Messages.ShowMDMServerConsole_InfoDialog_Message);
  }
 else   if (allServerDefs.size() == 1) {
    MDMServerDef serverDef=allServerDefs.get(0).getDecryptedServerDef();
    showMDMServerConsole(serverDef);
  }
 else {
    SelectServerDefDialog d=new SelectServerDefDialog(new Shell());
    d.create();
    d.setSelectServer(allServerDefs.get(0));
    if (d.open() == IDialogConstants.OK_ID) {
      MDMServerDef serverDef=d.getSelectedServerDef();
      showMDMServerConsole(serverDef);
    }
  }
}

Fixed version (ground truth):
public void openConsole(){
  List<MDMServerDef> allServerDefs=ServerDefService.getAllServerDefs();
  if (allServerDefs == null || allServerDefs.isEmpty()) {
    MessageDialog.openInformation(null,Messages.ShowMDMServerConsole_InfoDialog_Title,Messages.ShowMDMServerConsole_InfoDialog_Message);
  }
 else   if (allServerDefs.size() == 1) {
    MDMServerDef serverDef=allServerDefs.get(0);
    showMDMServerConsole(serverDef);
  }
 else {
    SelectServerDefDialog d=new SelectServerDefDialog(new Shell());
    d.create();
    d.setSelectServer(allServerDefs.get(0));
    if (d.open() == IDialogConstants.OK_ID) {
      MDMServerDef serverDef=d.getSelectedServerDef();
      showMDMServerConsole(serverDef);
    }
  }
}
Program: 147734
Project: 147734
Buggy source:
public static DefaultHttpClient createClient(URI uri,String username,String password) throws SecurityException {
  HttpParams params=new BasicHttpParams();
  params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,CONNECT_TIMEOUT);
  params.setParameter(CoreConnectionPNames.SO_TIMEOUT,SOCKET_TIMEOUT);
  params.setParameter(CoreConnectionPNames.TCP_NODELAY,false);
  ClientConnectionManager cm=new ThreadSafeClientConnManager();
  HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1);
  DefaultHttpClient client=new DefaultHttpClient(cm,params);
  if ("String_Node_Str".equals(uri.getScheme())) {
    client=enableSSL(client,uri.getPort());
  }
  AuthScope authScope=new AuthScope(uri.getHost(),uri.getPort());
  UsernamePasswordCredentials credentials=new UsernamePasswordCredentials(username,password);
  client.getCredentialsProvider().setCredentials(authScope,credentials);
  return client;
}

Fixed version (ground truth):
public static DefaultHttpClient createClient(String url,String username,String password) throws SecurityException {
  URI uri=URI.create(url);
  HttpParams params=new BasicHttpParams();
  params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,CONNECT_TIMEOUT);
  params.setParameter(CoreConnectionPNames.SO_TIMEOUT,SOCKET_TIMEOUT);
  params.setParameter(CoreConnectionPNames.TCP_NODELAY,false);
  ClientConnectionManager cm=new ThreadSafeClientConnManager();
  HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1);
  DefaultHttpClient client=new DefaultHttpClient(cm,params);
  if ("String_Node_Str".equals(uri.getScheme())) {
    client=enableSSL(client,uri.getPort());
  }
  AuthScope authScope=new AuthScope(uri.getHost(),uri.getPort());
  UsernamePasswordCredentials credentials=new UsernamePasswordCredentials(username,password);
  client.getCredentialsProvider().setCredentials(authScope,credentials);
  return client;
}
Program: 147735
Project: 147735
Buggy source:
public static DefaultHttpClient enableSSL(DefaultHttpClient client,String url) throws SecurityException, IllegalArgumentException {
  int port=getPortFromUrl(url);
  return enableSSL(client,port);
}

Fixed version (ground truth):
public static DefaultHttpClient enableSSL(DefaultHttpClient client,String url){
  int port=getPortFromUrl(url);
  return enableSSL(client,port);
}
Program: 147736
Project: 147736
Buggy source:
public static int getPortFromUrl(String url) throws IllegalArgumentException {
  if (url == null) {
    throw new IllegalArgumentException();
  }
  Matcher m=Pattern.compile(PATTERN_URL).matcher(url);
  if (m.find()) {
    String portStr=m.group(1);
    return Integer.parseInt(portStr);
  }
 else {
    return 80;
  }
}

Fixed version (ground truth):
public static int getPortFromUrl(String url){
  if (url == null) {
    throw new IllegalArgumentException();
  }
  Matcher m=Pattern.compile(PATTERN_URL).matcher(url);
  if (m.find()) {
    String portStr=m.group(1);
    return Integer.parseInt(portStr);
  }
 else {
    return 80;
  }
}
Program: 147737
Project: 147737
Buggy source:
public static String uploadFileToAppServer(String URL,String localFilename,String username,String password) throws XtentisException {
  HttpUriRequest request=createUploadFileToServerRequest(URL,localFilename);
  try {
    DefaultHttpClient client=createClient(URI.create(URL),username,password);
    HttpResponse response=client.execute(request);
    if (HttpStatus.SC_OK != response.getStatusLine().getStatusCode()) {
      throw new XtentisException(Messages.Util_21 + response.getStatusLine().getStatusCode() + Messages.Util_22+ response.getStatusLine().getReasonPhrase());
    }
    HttpEntity rentity=response.getEntity();
    return EntityUtils.toString(rentity);
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    throw new XtentisException(e.getClass().getName() + Messages.Util_23 + e.getLocalizedMessage());
  }
 finally {
    request.abort();
  }
}

Fixed version (ground truth):
public static String uploadFileToAppServer(String URL,String localFilename,String username,String password) throws XtentisException {
  HttpUriRequest request=createUploadFileToServerRequest(URL,localFilename);
  DefaultHttpClient client=createClient(URL,username,password);
  String errMessage=Messages.Util_21 + "String_Node_Str" + Messages.Util_22+ "String_Node_Str";
  byte[] data=getResponseEntityIfOk(client,request,errMessage);
  return new String(data);
}
Program: 147738
Project: 147738
Buggy source:
private static HttpUriRequest createUploadRequest(String URL,String localFilename,String filename,String imageCatalog){
  HttpPost request=new HttpPost(URI.create(URL));
  MultipartEntity entity=new MultipartEntity();
  if (!Messages.Util_24.equalsIgnoreCase(localFilename)) {
    File file=new File(localFilename);
    if (file.exists()) {
      entity.addPart("String_Node_Str",new FileBody(file));
    }
  }
  if (imageCatalog != null) {
    entity.addPart("String_Node_Str",StringBody.create(imageCatalog,STRING_CONTENT_TYPE,null));
  }
  if (filename != null) {
    int pos=filename.lastIndexOf('.');
    if (pos != -1) {
      filename=filename.substring(0,pos);
    }
    entity.addPart("String_Node_Str",StringBody.create(filename,STRING_CONTENT_TYPE,null));
  }
  request.setEntity(entity);
  return request;
}

Fixed version (ground truth):
static HttpUriRequest createUploadRequest(String URL,String localFilename,String filename,String imageCatalog,HashMap<String,String> picturePathMap){
  HttpPost request=new HttpPost(URL);
  MultipartEntity entity=new MultipartEntity();
  if (!Messages.Util_24.equalsIgnoreCase(localFilename)) {
    File file=new File(localFilename);
    if (file.exists()) {
      entity.addPart("String_Node_Str",new FileBody(file));
    }
  }
  if (imageCatalog != null) {
    entity.addPart("String_Node_Str",StringBody.create(imageCatalog,STRING_CONTENT_TYPE,null));
  }
  if (filename != null) {
    int pos=filename.lastIndexOf('.');
    if (pos != -1) {
      filename=filename.substring(0,pos);
    }
    entity.addPart("String_Node_Str",StringBody.create(filename,STRING_CONTENT_TYPE,null));
  }
  request.setEntity(entity);
  return request;
}
Program: 147739
Project: 147739
Buggy source:
private static HttpUriRequest createUploadFileToServerRequest(String URL,final String fileName){
  HttpPost request=new HttpPost(URI.create(URL));
  String path=fileName;
  if (URL.indexOf("String_Node_Str") == -1) {
    if (URL.indexOf("String_Node_Str") != -1) {
      path=URL.substring(URL.indexOf("String_Node_Str") + 1);
    }
    MultipartEntity entity=new MultipartEntity();
    entity.addPart(path,new FileBody(new File(fileName)));
    request.setEntity(entity);
  }
  return request;
}

Fixed version (ground truth):
static HttpUriRequest createUploadFileToServerRequest(String URL,final String fileName){
  HttpPost request=new HttpPost(URL);
  String path=fileName;
  if (URL.indexOf("String_Node_Str") == -1) {
    if (URL.indexOf("String_Node_Str") != -1) {
      path=URL.substring(URL.indexOf("String_Node_Str") + 1);
    }
    MultipartEntity entity=new MultipartEntity();
    entity.addPart(path,new FileBody(new File(fileName)));
    request.setEntity(entity);
  }
  return request;
}
Program: 147740
Project: 147740
Buggy source:
public static String uploadImageFile(String URL,String localFilename,String filename,String imageCatalog,String username,String password,HashMap<String,String> picturePathMap) throws XtentisException {
  HttpUriRequest request=createUploadRequest(URL,localFilename,filename,imageCatalog);
  try {
    DefaultHttpClient client=createClient(URI.create(URL),username,password);
    HttpResponse response=client.execute(request);
    if (HttpStatus.SC_OK != response.getStatusLine().getStatusCode()) {
      throw new XtentisException(Messages.Util_25 + response.getStatusLine().getStatusCode() + Messages.Util_26+ response.getStatusLine().getReasonPhrase());
    }
    HttpEntity rentity=response.getEntity();
    String content=EntityUtils.toString(rentity);
    log.debug("String_Node_Str" + content);
    if (content.contains("String_Node_Str")) {
      String returnValue=content.substring(content.indexOf("String_Node_Str"),content.indexOf("String_Node_Str") - 1);
      if (picturePathMap != null) {
        File file=new File(localFilename);
        String fileName1=file.getName();
        picturePathMap.put(fileName1,returnValue);
      }
      return returnValue;
    }
 else {
      log.warn("String_Node_Str");
      return "String_Node_Str";
    }
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    throw new XtentisException(e.getClass().getName() + "String_Node_Str" + e.getLocalizedMessage());
  }
 finally {
    request.abort();
  }
}

Fixed version (ground truth):
public static String uploadImageFile(String URL,String localFilename,String filename,String imageCatalog,String username,String password,HashMap<String,String> picturePathMap) throws XtentisException {
  HttpUriRequest request=createUploadRequest(URL,localFilename,filename,imageCatalog,picturePathMap);
  DefaultHttpClient client=createClient(URL,username,password);
  String errMessage=Messages.Util_25 + "String_Node_Str" + Messages.Util_26+ "String_Node_Str";
  byte[] data=getResponseEntityIfOk(client,request,errMessage);
  String content=new String(data);
  if (content.contains("String_Node_Str")) {
    String returnValue=content.substring(content.indexOf("String_Node_Str"),content.indexOf("String_Node_Str") - 1);
    if (picturePathMap != null) {
      File file=new File(localFilename);
      String fileName1=file.getName();
      picturePathMap.put(fileName1,returnValue);
    }
    return returnValue;
  }
 else {
    log.warn("String_Node_Str");
    return "String_Node_Str";
  }
}
Program: 147741
Project: 147741
Buggy source:
@Override public void error(FieldMetadata field,String message,Element element,int lineNumber,int columnNumber,ValidationError error){
  if (error != ValidationError.XML_SCHEMA) {
    int group;
    try {
      ComplexTypeMetadata containingType=field.getContainingType();
      while (containingType instanceof ContainedComplexTypeMetadata) {
        containingType=((ContainedComplexTypeMetadata)containingType).getContainerType();
      }
      group=containingType.isInstantiable() ? IComponentValidationRule.MSG_GROUP_ENTITY : IComponentValidationRule.MSG_GROUP_TYPE;
    }
 catch (    Exception e) {
      group=IComponentValidationRule.MSG_GROUP_ENTITY;
    }
    ModelValidationMessage validationMessage=new ModelValidationMessage(IComponentValidationRule.SEV_ERROR,message,"String_Node_Str",dataModelName,lineNumber,columnNumber,group,element,getEntityName(field),getEntityName(field),getPath(field));
    addMessage(lineNumber,columnNumber,error,validationMessage);
    errorCount++;
  }
}

Fixed version (ground truth):
@Override public void error(FieldMetadata field,String message,Element element,Integer lineNumber,Integer columnNumber,ValidationError error){
  if (error != ValidationError.XML_SCHEMA) {
    int group;
    try {
      ComplexTypeMetadata containingType=field.getContainingType();
      while (containingType instanceof ContainedComplexTypeMetadata) {
        containingType=((ContainedComplexTypeMetadata)containingType).getContainerType();
      }
      group=containingType.isInstantiable() ? IComponentValidationRule.MSG_GROUP_ENTITY : IComponentValidationRule.MSG_GROUP_TYPE;
    }
 catch (    Exception e) {
      group=IComponentValidationRule.MSG_GROUP_ENTITY;
    }
    ModelValidationMessage validationMessage=new ModelValidationMessage(IComponentValidationRule.SEV_ERROR,message,"String_Node_Str",dataModelName,getValue(lineNumber,-1),getValue(columnNumber,-1),group,element,getEntityName(field),getEntityName(field),getPath(field));
    addMessage(getValue(lineNumber,-1),getValue(columnNumber,-1),error,validationMessage);
    errorCount++;
  }
}
Program: 147742
Project: 147742
Buggy source:
private void addMessage(int lineNumber,int columnNumber,ValidationError error,ModelValidationMessage validationMessage){
  MultiKeyMap errorsByType=errors.get(error);
  if (errorsByType == null) {
    errorsByType=new MultiKeyMap();
    errors.put(error,errorsByType);
  }
  errorsByType.put(lineNumber,columnNumber,validationMessage);
}

Fixed version (ground truth):
private void addMessage(int lineNumber,int columnNumber,ValidationError error,ModelValidationMessage validationMessage){
  MultiKeyMap errorsByType=errors.get(error);
  if (errorsByType == null) {
    errorsByType=new MultiKeyMap();
    errors.put(error,errorsByType);
  }
  errorsByType.put(getValue(lineNumber,-1),getValue(columnNumber,-1),validationMessage);
}
Program: 147743
Project: 147743
Buggy source:
@Override public void fatal(FieldMetadata field,String message,Element element,int lineNumber,int columnNumber,ValidationError error){
  error(field,message,element,lineNumber,columnNumber,error);
}

Fixed version (ground truth):
@Override public void fatal(FieldMetadata field,String message,Element element,Integer lineNumber,Integer columnNumber,ValidationError error){
  error(field,message,element,getValue(lineNumber,-1),getValue(columnNumber,-1),error);
}
Program: 147744
Project: 147744
Buggy source:
@Override public void warning(FieldMetadata field,String message,Element element,int lineNumber,int columnNumber,ValidationError error){
  int group=field.getContainingType().isInstantiable() ? IComponentValidationRule.MSG_GROUP_ENTITY : IComponentValidationRule.MSG_GROUP_TYPE;
  ModelValidationMessage validationMessage=new ModelValidationMessage(IComponentValidationRule.SEV_WARNING,message,"String_Node_Str",dataModelName,lineNumber,columnNumber,group,element,getEntityName(field),getEntityName(field),getPath(field));
  addMessage(lineNumber,columnNumber,error,validationMessage);
}

Fixed version (ground truth):
@Override public void warning(FieldMetadata field,String message,Element element,Integer lineNumber,Integer columnNumber,ValidationError error){
  int group=field.getContainingType().isInstantiable() ? IComponentValidationRule.MSG_GROUP_ENTITY : IComponentValidationRule.MSG_GROUP_TYPE;
  ModelValidationMessage validationMessage=new ModelValidationMessage(IComponentValidationRule.SEV_WARNING,message,"String_Node_Str",dataModelName,getValue(lineNumber,-1),getValue(columnNumber,-1),group,element,getEntityName(field),getEntityName(field),getPath(field));
  addMessage(getValue(lineNumber,-1),getValue(columnNumber,-1),error,validationMessage);
}
Program: 147746
Project: 147746
Buggy source:
private TreePath[] removeInvalidTreePaths(TreePath[] expandedElementPaths){
  Map<Integer,Set<TreePath>> pathMaps=new HashMap<Integer,Set<TreePath>>();
  int maxSegmentCount=-1;
  for (  TreePath path : expandedElementPaths) {
    int segmentCount=path.getSegmentCount();
    Set<TreePath> pathSet=pathMaps.get(segmentCount);
    if (pathSet == null) {
      pathSet=new HashSet<TreePath>();
      pathMaps.put(segmentCount,pathSet);
    }
    pathSet.add(path);
    if (maxSegmentCount < segmentCount)     maxSegmentCount=segmentCount;
  }
  Set<TreePath> roots=pathMaps.get(1);
  if (roots == null || roots.size() == 0) {
    return new TreePath[0];
  }
  List<TreePath> paths=new ArrayList<TreePath>();
  paths.addAll(roots);
  for (int i=2; i < maxSegmentCount + 1; i++) {
    Set<TreePath> set=pathMaps.get(i);
    if (set == null || set.size() == 0)     break;
    Set<TreePath> parents=pathMaps.get(i - 1);
    for (    TreePath path : set) {
      if (parents.contains(path.getParentPath()))       paths.add(path);
 else       set.remove(path);
    }
  }
  return paths.toArray(new TreePath[0]);
}

Fixed version (ground truth):
private TreePath[] removeInvalidTreePaths(TreePath[] expandedElementPaths){
  Map<Integer,Set<TreePath>> pathMaps=new HashMap<Integer,Set<TreePath>>();
  int maxSegmentCount=-1;
  for (  TreePath path : expandedElementPaths) {
    int segmentCount=path.getSegmentCount();
    Set<TreePath> pathSet=pathMaps.get(segmentCount);
    if (pathSet == null) {
      pathSet=new HashSet<TreePath>();
      pathMaps.put(segmentCount,pathSet);
    }
    pathSet.add(path);
    if (maxSegmentCount < segmentCount)     maxSegmentCount=segmentCount;
  }
  Set<TreePath> roots=pathMaps.get(1);
  if (roots == null || roots.size() == 0) {
    return new TreePath[0];
  }
  List<TreePath> paths=new ArrayList<TreePath>();
  paths.addAll(roots);
  for (int i=2; i < maxSegmentCount + 1; i++) {
    Set<TreePath> set=pathMaps.get(i);
    if (set == null || set.size() == 0)     break;
    Set<TreePath> parents=pathMaps.get(i - 1);
    Iterator<TreePath> iterator=set.iterator();
    while (iterator.hasNext()) {
      TreePath path=iterator.next();
      if (parents.contains(path.getParentPath()))       paths.add(path);
 else       iterator.remove();
    }
  }
  return paths.toArray(new TreePath[0]);
}
Program: 147749
Project: 147749
Buggy source:
private List<XSDNode> getExpandedNodes(TreePath[] expandedElementPaths){
  TreePath[] expandedPaths=removeInvalidTreePaths(expandedElementPaths);
  List<XSDNode> expanded=new ArrayList<XSDNode>();
  XSDNode rootNode=null;
  for (  TreePath path : expandedPaths) {
    int segmentCount=path.getSegmentCount();
    rootNode=XSDNode.newNode(path.getFirstSegment());
    if (expanded.contains(rootNode)) {
      rootNode=expanded.get(expanded.indexOf(rootNode));
    }
 else {
      expanded.add(rootNode);
    }
    for (int i=1; i < segmentCount; i++) {
      Object segment=path.getSegment(i);
      XSDNode newNode=XSDNode.newNode(segment);
      if (rootNode.childs == null)       rootNode.addChild(newNode);
 else {
        if (rootNode.childs.contains(newNode)) {
          newNode=rootNode.childs.get(rootNode.childs.indexOf(newNode));
        }
 else {
          rootNode.addChild(newNode);
        }
      }
      rootNode=newNode;
    }
  }
  return expanded;
}

Fixed version (ground truth):
private List<ExpandInfoNode> getExpandedNodes(TreePath[] expandedElementPaths){
  TreePath[] expandedPaths=removeInvalidTreePaths(expandedElementPaths);
  List<ExpandInfoNode> expanded=new ArrayList<ExpandInfoNode>();
  ExpandInfoNode rootNode=null;
  for (  TreePath path : expandedPaths) {
    int segmentCount=path.getSegmentCount();
    Object firstSegment=path.getFirstSegment();
    rootNode=ExpandInfoNode.create(getName(firstSegment),firstSegment.getClass().getName());
    if (expanded.contains(rootNode)) {
      rootNode=expanded.get(expanded.indexOf(rootNode));
    }
 else {
      expanded.add(rootNode);
    }
    for (int i=1; i < segmentCount; i++) {
      Object segment=path.getSegment(i);
      ExpandInfoNode newNode=ExpandInfoNode.create(getName(segment),segment.getClass().getName());
      if (rootNode.childs == null)       rootNode.addChild(newNode);
 else {
        if (rootNode.childs.contains(newNode)) {
          newNode=rootNode.childs.get(rootNode.childs.indexOf(newNode));
        }
 else {
          rootNode.addChild(newNode);
        }
      }
      rootNode=newNode;
    }
  }
  return expanded;
}
Program: 147750
Project: 147750
Buggy source:
@Override public int hashCode(){
  if (data != null)   return data.hashCode();
  return super.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  if (name != null)   return (name + "String_Node_Str" + type).hashCode();
 else   return type.hashCode();
}
Program: 147751
Project: 147751
Buggy source:
private Map<XSDNode,Object> getNodeElementPairs(Object[] elementChildrens,List<XSDNode> nodes){
  Map<XSDNode,Object> pairs=new HashMap<XSDNode,Object>();
  for (  Object child : elementChildrens) {
    for (    XSDNode node : nodes)     if (isSameXSDElement(child,node.data)) {
      pairs.put(node,child);
    }
  }
  return pairs;
}

Fixed version (ground truth):
private Map<ExpandInfoNode,Object> getNodeElementPairs(Object[] elementChildrens,List<ExpandInfoNode> nodes){
  Map<ExpandInfoNode,Object> pairs=new HashMap<ExpandInfoNode,Object>();
  for (  Object child : elementChildrens) {
    for (    ExpandInfoNode node : nodes)     if (isSameXSDElement(child,node)) {
      pairs.put(node,child);
    }
  }
  return pairs;
}
Program: 147752
Project: 147752
Buggy source:
@Override public boolean equals(Object obj){
  if (obj == null)   return false;
  if (obj instanceof XSDNode) {
    XSDNode node=(XSDNode)obj;
    return node.data == data;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj == null)   return false;
  if (obj instanceof ExpandInfoNode) {
    ExpandInfoNode node=(ExpandInfoNode)obj;
    if (name != null)     return name.equals(node.name) && type.equals(node.type);
 else     return type.equals(node.type);
  }
  return false;
}
Program: 147753
Project: 147753
Buggy source:
public void addChild(XSDNode obj){
  if (childs == null) {
    childs=new ArrayList<XSDNode>();
  }
  childs.add(obj);
}

Fixed version (ground truth):
public void addChild(ExpandInfoNode obj){
  if (childs == null) {
    childs=new ArrayList<ExpandInfoNode>();
  }
  childs.add(obj);
}
Program: 147754
Project: 147754
Buggy source:
public TreeExpandHelper(){
  expandedElements=new ArrayList<TreeExpandHelper.XSDNode>();
  expandedTypes=new ArrayList<TreeExpandHelper.XSDNode>();
}

Fixed version (ground truth):
public TreeExpandHelper(){
  expandedElements=new ArrayList<TreeExpandHelper.ExpandInfoNode>();
  expandedTypes=new ArrayList<TreeExpandHelper.ExpandInfoNode>();
}
Program: 147755
Project: 147755
Buggy source:
@Override public void error(FieldMetadata field,String message,Element element,int lineNumber,int columnNumber,ValidationError error){
  if (error != ValidationError.XML_SCHEMA) {
    ComplexTypeMetadata containingType=field.getContainingType();
    while (containingType instanceof ContainedComplexTypeMetadata) {
      containingType=((ContainedComplexTypeMetadata)containingType).getContainerType();
    }
    int group=containingType.isInstantiable() ? IComponentValidationRule.MSG_GROUP_ENTITY : IComponentValidationRule.MSG_GROUP_TYPE;
    ModelValidationMessage validationMessage=new ModelValidationMessage(IComponentValidationRule.SEV_ERROR,message,"String_Node_Str",dataModelName,lineNumber,columnNumber,group,element,getEntityName(field),getEntityName(field),getPath(field));
    addMessage(lineNumber,columnNumber,error,validationMessage);
    errorCount++;
  }
}

Fixed version (ground truth):
@Override public void error(FieldMetadata field,String message,Element element,int lineNumber,int columnNumber,ValidationError error){
  if (error != ValidationError.XML_SCHEMA) {
    int group;
    try {
      ComplexTypeMetadata containingType=field.getContainingType();
      while (containingType instanceof ContainedComplexTypeMetadata) {
        containingType=((ContainedComplexTypeMetadata)containingType).getContainerType();
      }
      group=containingType.isInstantiable() ? IComponentValidationRule.MSG_GROUP_ENTITY : IComponentValidationRule.MSG_GROUP_TYPE;
    }
 catch (    Exception e) {
      group=IComponentValidationRule.MSG_GROUP_ENTITY;
    }
    ModelValidationMessage validationMessage=new ModelValidationMessage(IComponentValidationRule.SEV_ERROR,message,"String_Node_Str",dataModelName,lineNumber,columnNumber,group,element,getEntityName(field),getEntityName(field),getPath(field));
    addMessage(lineNumber,columnNumber,error,validationMessage);
    errorCount++;
  }
}
Program: 147756
Project: 147756
Buggy source:
private boolean doValidateAndAlertObjectExistence(int result,String name,ERepositoryObjectType objectType,String typeName){
  if (result == STATUS_OK) {
    return true;
  }
 else {
    String message=null;
    if (typeName == null) {
      typeName=objectType.getLabel();
    }
    if (result == STATUS_EXISTED) {
      message=Messages.bind(Messages.ValidateService_ObjectExist,name,typeName);
    }
 else     if (result == STATUS_DELETED) {
      message=Messages.bind(Messages.ValidateService_DeletedObjectExist,name,typeName);
    }
    return MessageDialog.openConfirm(getShell(),Messages.Confirm_Overwrite,message);
  }
}

Fixed version (ground truth):
private boolean doValidateAndAlertObjectExistence(int result,String name,ERepositoryObjectType objectType,String typeName){
  if (result == STATUS_OK) {
    return true;
  }
 else {
    String message=null;
    if (typeName == null) {
      typeName=objectType.toString();
    }
    if (result == STATUS_EXISTED) {
      message=Messages.bind(Messages.ValidateService_ObjectExist,name,typeName);
    }
 else     if (result == STATUS_DELETED) {
      message=Messages.bind(Messages.ValidateService_DeletedObjectExist,name,typeName);
    }
    return MessageDialog.openConfirm(getShell(),Messages.Confirm_Overwrite,message);
  }
}