Program: 148899
Project: 148899
Buggy source:
public static void deleteTreeObject(TreeObject xobject,ServerView view) throws Exception {
  XtentisPort port=Util.getPort(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
switch (xobject.getType()) {
case TreeObject.DATA_MODEL:
    port.deleteDataModel(new WSDeleteDataModel((WSDataModelPK)xobject.getWsKey()));
  deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.VIEW:
port.deleteView(new WSDeleteView((WSViewPK)xobject.getWsKey()));
deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.DATA_CLUSTER:
port.deleteDataCluster(new WSDeleteDataCluster((WSDataClusterPK)xobject.getWsKey()));
deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.STORED_PROCEDURE:
port.deleteStoredProcedure(new WSDeleteStoredProcedure((WSStoredProcedurePK)xobject.getWsKey()));
break;
case TreeObject.ROLE:
port.deleteRole(new WSDeleteRole((WSRolePK)xobject.getWsKey()));
break;
case TreeObject.ROUTING_RULE:
port.deleteRoutingRule(new WSDeleteRoutingRule((WSRoutingRulePK)xobject.getWsKey()));
break;
case TreeObject.TRANSFORMER:
port.deleteTransformerV2(new WSDeleteTransformerV2((WSTransformerV2PK)xobject.getWsKey()));
break;
case TreeObject.MENU:
port.deleteMenu(new WSDeleteMenu((WSMenuPK)xobject.getWsKey()));
deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.UNIVERSE:
port.deleteUniverse(new WSDeleteUniverse((WSUniversePK)xobject.getWsKey()));
break;
case TreeObject.SYNCHRONIZATIONPLAN:
port.deleteSynchronizationPlan(new WSDeleteSynchronizationPlan((WSSynchronizationPlanPK)xobject.getWsKey()));
break;
case TreeObject.CATEGORY_FOLDER:
break;
default :
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str" + IConstants.TALEND + "String_Node_Str"+ xobject.getType());
return;
}
if (xobject.getParent() != null) xobject.getParent().removeChild(xobject);
view.getViewer().refresh();
}

Fixed version (ground truth):
public static void deleteTreeObject(TreeObject xobject,ServerView view) throws Exception {
  XtentisPort port=Util.getPort(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.deleteTreeObject(port,xobject);
  }
switch (xobject.getType()) {
case TreeObject.DATA_MODEL:
    port.deleteDataModel(new WSDeleteDataModel((WSDataModelPK)xobject.getWsKey()));
  deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.VIEW:
port.deleteView(new WSDeleteView((WSViewPK)xobject.getWsKey()));
deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.DATA_CLUSTER:
port.deleteDataCluster(new WSDeleteDataCluster((WSDataClusterPK)xobject.getWsKey()));
deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.STORED_PROCEDURE:
port.deleteStoredProcedure(new WSDeleteStoredProcedure((WSStoredProcedurePK)xobject.getWsKey()));
break;
case TreeObject.ROUTING_RULE:
port.deleteRoutingRule(new WSDeleteRoutingRule((WSRoutingRulePK)xobject.getWsKey()));
break;
case TreeObject.TRANSFORMER:
port.deleteTransformerV2(new WSDeleteTransformerV2((WSTransformerV2PK)xobject.getWsKey()));
break;
case TreeObject.MENU:
port.deleteMenu(new WSDeleteMenu((WSMenuPK)xobject.getWsKey()));
deleteSpecificationFromAttachedRole(port,xobject,"String_Node_Str");
break;
case TreeObject.CATEGORY_FOLDER:
break;
default :
return;
}
if (xobject.getParent() != null) xobject.getParent().removeChild(xobject);
view.getViewer().refresh();
}