nus-yam/ex-repair huggingface dataset:
Program: 136218
Project: 136218
Buggy source:
/** 
 * Set Assigned Type. Sets the Assigned type node and add this owner to that user list via where used listener. This method assures there is a target and that the owner is editable. Sets the TLModel type If the target represents a complex type (BO, Core, facet, alias) then the owner's name is changed.
 * @return true if assignment could be made, false otherwise
 */
public boolean set(TypeProvider target){
}

Fixed version (ground truth):
/** 
 * Set Assigned Type. Sets the Assigned type node and add this owner to that user list via where used listener. This method assures there is a target and that the owner is editable. Sets the TLModel type If the target represents a complex type (BO, Core, facet, alias) then the owner's name is changed.
 * @return true if assignment could be made, false otherwise
 */
public boolean set(TypeProvider target){
  if (owner == null || !owner.isEditable())   return false;
  if (target instanceof SharedFacetNode) {
    target=(TypeProvider)target.getParent();
    LOGGER.debug("String_Node_Str");
  }
  TypeProvider oldProvider=owner.getAssignedType();
  if (owner.getRequiredType() != null) {
    return false;
  }
  if (oldProvider == target) {
    if (!target.getWhereAssigned().contains(owner)) {
      target.addTypeUser(owner);
    }
    if (target != ModelNode.getUnassignedNode())     return false;
  }
  if (target == null || target == ModelNode.getUnassignedNode())   return false;
  TLModelElement tlTarget=target.getTLModelObject();
  if (target.getLibrary() != null && target.getLibrary().isBuiltIn() && target.getLibrary().getNamespace().equals(XMLConstants.W3C_XML_SCHEMA_NS_URI))   if (target.getXsdObjectHandler() != null)   tlTarget=target.getXsdObjectHandler().getTLLibraryMember();
  boolean result=owner.setAssignedType(tlTarget);
  if (result) {
    oldProvider.removeWhereAssigned(owner);
    target.addTypeUser(owner);
  }
  if (get().getTLModelObject() != tlTarget) {
    TypeProvider actual=get();
    if (actual.getXsdObjectHandler() == null || actual.getXsdObjectHandler().getTLLibraryMember() != tlTarget) {
      LOGGER.debug("String_Node_Str" + ((Node)target).getNameWithPrefix() + "String_Node_Str"+ owner+ "String_Node_Str"+ ((Node)get()).getNameWithPrefix());
      return false;
    }
  }
  return result;
}
Program: 136219
Project: 136219
Buggy source:
/** 
 * @return list of contextual facets identified by the contributed facets in this object
 */
public List<ContextualFacetNode> getContextualFacets(){
  if (!(this instanceof ContextualFacetOwnerInterface))   return Collections.emptyList();
  ArrayList<ContextualFacetNode> facets=new ArrayList<ContextualFacetNode>();
  for (  ContributedFacetNode n : getContributedFacets())   facets.add(n.getContributor());
  return facets;
}

Fixed version (ground truth):
/** 
 * @return list of contextual facets identified by the contributed facets in this object
 */
public List<ContextualFacetNode> getContextualFacets(){
  if (!(this instanceof ContextualFacetOwnerInterface))   return Collections.emptyList();
  ArrayList<ContextualFacetNode> facets=new ArrayList<ContextualFacetNode>();
  for (  Node n : getChildren())   if (n instanceof ContributedFacetNode)   facets.add(((ContributedFacetNode)n).getContributor());
 else   if (n instanceof ContextualFacetNode)   facets.add((ContextualFacetNode)n);
  return facets;
}
Program: 136221
Project: 136221
Buggy source:
private static PropertyNode createAttribute(TLAttribute tlObj,PropertyOwnerInterface parent){
  PropertyNode nn;
  TLPropertyType type=tlObj.getType();
  if (type != null && type.getNamespace() != null && type.getNamespace().equals(ModelNode.XSD_NAMESPACE) && type.getLocalName().equals("String_Node_Str"))   nn=new IdNode((TLModelElement)tlObj,parent);
  nn=new AttributeNode(tlObj,parent);
  return nn;
}

Fixed version (ground truth):
private static PropertyNode createAttribute(TLAttribute tlObj,PropertyOwnerInterface parent){
  PropertyNode nn;
  TLPropertyType type=tlObj.getType();
  if (type != null && type.getNamespace() != null && type.getNamespace().equals(ModelNode.XSD_NAMESPACE) && type.getLocalName().equals("String_Node_Str"))   nn=new IdNode((TLModelElement)tlObj,parent);
 else   if (tlObj.isReference())   nn=new AttributeReferenceNode(tlObj,parent);
 else   nn=new AttributeNode(tlObj,parent);
  return nn;
}
Program: 136222
Project: 136222
Buggy source:
public AttributeReferenceNode(TLModelElement tlObj,PropertyOwnerInterface parent,PropertyNodeType type){
  super(tlObj,(INode)parent,type);
  getTLModelObject().setReference(true);
}

Fixed version (ground truth):
/** 
 * @param tlObj TLAttribute
 * @param parent can be null
 */
public AttributeReferenceNode(TLAttribute tlObj,PropertyOwnerInterface parent){
  super(tlObj,(INode)parent,PropertyNodeType.ID_ATTR_REF);
  getTLModelObject().setReference(true);
  assert(modelObject instanceof AttributeMO);
}
Program: 136223
Project: 136223
Buggy source:
/** 
 * Set the context to the owning library's defaultContextId.
 */
public void fixContext(){
  if (getLibrary() == null)   return;
  String contextID=getLibrary().getDefaultContextId();
  if (getExampleHandler() != null)   exampleHandler.fix(null);
  if (getEquivalentHandler() != null)   equivalentHandler.fix(null);
}

Fixed version (ground truth):
/** 
 * Set the context to the owning library's defaultContextId.
 */
public void fixContext(){
  if (getLibrary() == null)   return;
  if (isEditable()) {
    if (getExampleHandler() != null)     exampleHandler.fix(null);
    if (getEquivalentHandler() != null)     equivalentHandler.fix(null);
  }
}
Program: 136224
Project: 136224
Buggy source:
/** 
 * Release the lock and let validation run
 */
public static void unblock(){
  semaphore.release();
  LOGGER.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Release the lock and let validation run
 */
public static void unblock(){
  semaphore.release();
}
Program: 136225
Project: 136225
Buggy source:
/** 
 * Prevent validation from running until released.
 */
public static void block(){
  try {
    semaphore.acquire();
  }
 catch (  InterruptedException e) {
    LOGGER.error("String_Node_Str",e.getLocalizedMessage());
    e.printStackTrace();
  }
  LOGGER.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Prevent validation from running until released.
 */
public static void block(){
  try {
    semaphore.acquire();
  }
 catch (  InterruptedException e) {
    LOGGER.error("String_Node_Str",e.getLocalizedMessage());
    e.printStackTrace();
  }
}
Program: 136226
Project: 136226
Buggy source:
/** 
 * Set the context to the passed context IF and ONLY IF that context is in the TL Library AND context controller. Uses default context otherwise.
 */
@Override public void fix(String sourceContext){
  if (sourceContext == null || !confirmContextExists(sourceContext))   sourceContext=owner.getLibrary().getDefaultContextId();
switch (type) {
case EXAMPLE:
    List<TLExample> examples=new ArrayList<TLExample>(((TLExampleOwner)tlOwner).getExamples());
  if (examples.isEmpty())   return;
TLExample keepThisTLE=examples.get(0);
if (examples.size() == 1) examples.get(0).setContext(sourceContext);
 else {
for (TLExample tle : examples) if (tle.getContext().equals(sourceContext)) keepThisTLE=tle;
for (TLExample tle : examples) if (tle != keepThisTLE) {
  convertToDoc(tle);
  tle.removeListener(this);
  ((TLExampleOwner)tlOwner).removeExample(tle);
}
 else tle.setContext(sourceContext);
}
break;
case EQUIVALENT:
List<TLEquivalent> equivalents=new ArrayList<TLEquivalent>(((TLEquivalentOwner)tlOwner).getEquivalents());
if (equivalents.isEmpty()) return;
TLEquivalent keepThisTLEq=equivalents.get(0);
if (equivalents.size() == 1) equivalents.get(0).setContext(sourceContext);
 else {
for (TLEquivalent tle : equivalents) if (tle.getContext().equals(sourceContext)) keepThisTLEq=tle;
for (TLEquivalent tle : equivalents) if (tle != keepThisTLEq) {
convertToDoc(tle);
tle.removeListener(this);
((TLEquivalentOwner)tlOwner).removeEquivalent(tle);
}
 else tle.setContext(sourceContext);
}
break;
}
}

Fixed version (ground truth):
/** 
 * Fix all the examples or equivalents on this property. Assures there is only one and it has the correct context. Set the context to the passed context IF and ONLY IF that context is in the TL Library AND context controller. Uses default context otherwise.
 */
@Override public void fix(String sourceContext){
  if (sourceContext == null || !confirmContextExists(sourceContext))   sourceContext=owner.getLibrary().getDefaultContextId();
switch (type) {
case EXAMPLE:
    List<TLExample> examples=new ArrayList<TLExample>(((TLExampleOwner)tlOwner).getExamples());
  if (examples.isEmpty())   return;
TLExample keepThisTLE=examples.get(0);
if (examples.size() == 1) examples.get(0).setContext(sourceContext);
 else {
for (TLExample tle : examples) if (tle.getContext().equals(sourceContext)) keepThisTLE=tle;
for (TLExample tle : examples) if (tle != keepThisTLE) {
  convertToDoc(tle);
  tle.removeListener(this);
  ((TLExampleOwner)tlOwner).removeExample(tle);
}
 else tle.setContext(sourceContext);
}
break;
case EQUIVALENT:
List<TLEquivalent> equivalents=new ArrayList<TLEquivalent>(((TLEquivalentOwner)tlOwner).getEquivalents());
if (equivalents.isEmpty()) return;
TLEquivalent keepThisTLEq=equivalents.get(0);
if (equivalents.size() == 1) equivalents.get(0).setContext(sourceContext);
 else {
for (TLEquivalent tle : equivalents) if (tle.getContext().equals(sourceContext)) keepThisTLEq=tle;
for (TLEquivalent tle : equivalents) if (tle != keepThisTLEq) {
convertToDoc(tle);
tle.removeListener(this);
((TLEquivalentOwner)tlOwner).removeEquivalent(tle);
}
 else tle.setContext(sourceContext);
}
break;
}
}
Program: 136227
Project: 136227
Buggy source:
/** 
 * Set the context to the owning library's defaultContextId.
 */
public void fixContext(){
  if (getLibrary() == null)   return;
  String contextID=getLibrary().getDefaultContextId();
  if (getExampleHandler() != null)   exampleHandler.set(exampleHandler.get(null),contextID);
  if (getEquivalentHandler() != null)   equivalentHandler.set(equivalentHandler.get(null),contextID);
}

Fixed version (ground truth):
/** 
 * Set the context to the owning library's defaultContextId.
 */
public void fixContext(){
  if (getLibrary() == null)   return;
  String contextID=getLibrary().getDefaultContextId();
  if (getExampleHandler() != null)   exampleHandler.fix(null);
  if (getEquivalentHandler() != null)   equivalentHandler.fix(null);
}
Program: 136228
Project: 136228
Buggy source:
private void applySelection(final IStructuredSelection iss){
  if (iss.getFirstElement() == null)   return;
  if (iss.getFirstElement() instanceof Node)   curNode=(Node)iss.getFirstElement();
  if (curNode instanceof VersionNode)   curNode=((VersionNode)curNode).get();
  selectedNodes.clear();
  for (  final Object o : iss.toList()) {
    if (o instanceof Node) {
      if (o instanceof VersionNode)       selectedNodes.add(((VersionNode)o).get());
 else       selectedNodes.add((Node)o);
      if (((Node)o).getLibrary() != null)       mc.postStatus(((Node)o).getEditStatusMsg());
    }
  }
}

Fixed version (ground truth):
private void applySelection(final IStructuredSelection iss){
  if (iss.getFirstElement() == null)   return;
  if (iss.getFirstElement() instanceof Node)   curNode=(Node)iss.getFirstElement();
  if (curNode instanceof VersionNode)   curNode=((VersionNode)curNode).get();
  selectedNodes.clear();
  for (  final Object o : iss.toList()) {
    if (o instanceof Node) {
      if (o instanceof VersionNode)       selectedNodes.add(((VersionNode)o).get());
 else       selectedNodes.add((Node)o);
      if (((Node)o).getLibrary() != null)       mc.postStatus(((Node)o).getEditStatusMsg());
    }
  }
  if (!ValidationManager.isValidNoWarnings(curNode)) {
    ValidationResultsView view=mc.getView_Validation();
    if (view != null)     view.setFindings(ValidationManager.validate(curNode),curNode);
  }
}
Program: 136229
Project: 136229
Buggy source:
@Override public void setCurrentNode(final INode n){
  prevNode=curNode;
  curNode=(Node)n;
}

Fixed version (ground truth):
@Override public void setCurrentNode(final INode n){
  prevNode=curNode;
  curNode=(Node)n;
  LOGGER.debug("String_Node_Str" + curNode + "String_Node_Str"+ prevNode);
}
Program: 136230
Project: 136230
Buggy source:
private ValidationFindings validate(Node n){
  try {
    return TLModelCompileValidator.validateModelElement(n.getTLModelObject());
  }
 catch (  Exception e) {
    LOGGER.debug("String_Node_Str" + n + "String_Node_Str"+ e.getLocalizedMessage());
  }
  mc.postStatus("String_Node_Str" + n.getLabel());
  return null;
}

Fixed version (ground truth):
private ValidationFindings validate(Node n){
  findings=ValidationManager.validate(n);
  mc.postStatus("String_Node_Str" + n.getLabel());
  return findings;
}
Program: 136231
Project: 136231
Buggy source:
public void setFindings(final ValidationFindings findings,final INode node){
  this.findings=findings;
  postFindings();
  currentNode=node;
}

Fixed version (ground truth):
/** 
 * Set the view global findings then post them.
 * @param findings
 * @param node
 */
public void setFindings(final ValidationFindings findings,final INode node){
  this.findings=findings;
  postFindings();
  currentNode=node;
}
Program: 136232
Project: 136232
Buggy source:
private void addOverlay(Node node,IDecoration decoration){
  if (!node.isValid())   decoration.addOverlay(errorDesc(),IDecoration.BOTTOM_LEFT);
 else   if (!node.isValid_NoWarnings())   decoration.addOverlay(warningDesc(),IDecoration.BOTTOM_LEFT);
}

Fixed version (ground truth):
private void addOverlay(Node node,IDecoration decoration){
  ValidationFindings findings=ValidationManager.validate(node);
  if (findings != null)   if (!ValidationManager.isValid(findings,FindingType.ERROR))   decoration.addOverlay(errorDesc,IDecoration.BOTTOM_LEFT);
 else   if (!ValidationManager.isValid(findings,FindingType.WARNING))   decoration.addOverlay(warningDesc,IDecoration.BOTTOM_LEFT);
}
Program: 136234
Project: 136234
Buggy source:
public LibraryNode getLatestVersion(LibraryNode lib,boolean includeDrafts) throws RepositoryException {
  LibraryNode replacement=null;
  ProjectItem projItem=lib.getProjectItem();
  Repository lRepo=lib.getProjectItem().getRepository();
  String baseNS=projItem.getBaseNamespace();
  if (projItem == null || lRepo == null || baseNS.isEmpty())   return null;
  List<RepositoryItem> ll;
  RepositoryItem replacementRI=null;
  String targetName=projItem.getContent().getName();
  if (includeDrafts)   replacementRI=getLatestRepoItem(lRepo,baseNS,TLLibraryStatus.DRAFT,targetName);
 else   replacementRI=getLatestRepoItem(lRepo,baseNS,TLLibraryStatus.UNDER_REVIEW,targetName);
  if (replacementRI == null)   replacementRI=getLatestRepoItem(lRepo,baseNS,TLLibraryStatus.FINAL,targetName);
  if (replacementRI == null)   return replacement;
  replacement=Node.getLibraryModelManager().get(replacementRI.getNamespace(),replacementRI.getLibraryName());
  if (replacement == null) {
    String message="String_Node_Str" + replacementRI.getNamespace() + "String_Node_Str"+ replacementRI.getLibraryName();
    mc.postStatus(message);
    ProjectItem newPI=mc.getProjectController().add(lib.getProject(),replacementRI);
    replacement=Node.getLibraryModelManager().get(replacementRI.getNamespace(),replacementRI.getLibraryName());
  }
  return replacement;
}

Fixed version (ground truth):
public LibraryNode getLatestVersion(LibraryNode lib,boolean includeDrafts) throws RepositoryException {
  LibraryNode replacement=null;
  ProjectItem projItem=lib.getProjectItem();
  Repository lRepo=lib.getProjectItem().getRepository();
  String baseNS=projItem.getBaseNamespace();
  if (projItem == null || lRepo == null || baseNS.isEmpty())   return null;
  String message="String_Node_Str" + lib;
  mc.postStatus(message);
  mc.showBusy(true);
  mc.refresh();
  LOGGER.debug(message);
  List<RepositoryItem> ll;
  RepositoryItem replacementRI=null;
  String targetName=projItem.getContent().getName();
  if (includeDrafts)   replacementRI=getLatestRepoItem(lRepo,baseNS,TLLibraryStatus.DRAFT,targetName);
 else   replacementRI=getLatestRepoItem(lRepo,baseNS,TLLibraryStatus.UNDER_REVIEW,targetName);
  if (replacementRI == null)   replacementRI=getLatestRepoItem(lRepo,baseNS,TLLibraryStatus.FINAL,targetName);
  if (replacementRI == null) {
    mc.postStatus("String_Node_Str");
    mc.showBusy(false);
    return replacement;
  }
  replacement=Node.getLibraryModelManager().get(replacementRI.getNamespace(),replacementRI.getLibraryName());
  if (replacement == null) {
    message="String_Node_Str" + replacementRI.getNamespace() + "String_Node_Str"+ replacementRI.getLibraryName();
    mc.postStatus(message);
    ProjectItem newPI=mc.getProjectController().add(lib.getProject(),replacementRI);
    replacement=Node.getLibraryModelManager().get(replacementRI.getNamespace(),replacementRI.getLibraryName());
  }
  mc.postStatus("String_Node_Str");
  mc.showBusy(false);
  return replacement;
}
Program: 136235
Project: 136235
Buggy source:
/** 
 * Get all of the components that use any aspect of the owning component. DO NOT make this a getChildren or the tree will become invalid with nodes having multiple parents which will break lots of getChildren() users.
 * @return new list of children
 */
@Override public List<Node> getChildren(){
  Set<Node> users=new HashSet<Node>();
  if (owner == null)   return Collections.emptyList();
  for (  Node l : owner.getWhereUsedHandler().getWhereUsed(true))   if (l instanceof LibraryNode)   users.add(new LibraryUserNode((LibraryNode)l,owner));
  return new ArrayList<Node>(users);
}

Fixed version (ground truth):
/** 
 * Get all of the components that use any aspect of the owning component. DO NOT make this a getChildren or the tree will become invalid with nodes having multiple parents which will break lots of getChildren() users.
 * @return new list of children
 */
@Override public List<Node> getChildren(){
  Set<Node> users=new HashSet<Node>();
  if (owner == null)   return Collections.emptyList();
  for (  Node l : owner.getWhereUsedHandler().getWhereUsed(true))   if (l instanceof LibraryNode && !l.isDeleted())   users.add(new LibraryUserNode((LibraryNode)l,owner));
  return new ArrayList<Node>(users);
}
Program: 136236
Project: 136236
Buggy source:
/** 
 * Move one node to the new destination library. Links the node, the tl object and corrects context.
 * @param source
 * @param destination
 */
public void moveNode(final ComponentNode source,final LibraryNode destination){
  if (destination == null || source == null) {
    LOGGER.warn("String_Node_Str");
    return;
  }
  if (!destination.isTLLibrary()) {
    LOGGER.warn("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  if (source.getChain() != null && source.getChain() == destination.getChain()) {
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  if (source.isInTLLibrary() && source.isTLLibraryMember()) {
    source.getLibrary().moveMember(source,destination);
  }
 else {
    LOGGER.warn("String_Node_Str" + source.getName() + "String_Node_Str");
    LOGGER.debug("String_Node_Str" + source.isInTLLibrary() + "String_Node_Str"+ source.isTLLibraryMember());
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  LOGGER.info("String_Node_Str" + source.getName() + "String_Node_Str"+ destination.getName());
}

Fixed version (ground truth):
/** 
 * Move one node to the new destination library. Links the node, the tl object and corrects context.
 * @param source
 * @param destination
 */
public void moveNode(final ComponentNode source,final LibraryNode destination){
  if (destination == null || source == null) {
    LOGGER.warn("String_Node_Str");
    return;
  }
  if (!destination.isTLLibrary()) {
    LOGGER.warn("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  if (source.getChain() != null && source.getChain() == destination.getChain()) {
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  if (!source.isInTLLibrary() || !source.isTLLibraryMember()) {
    LOGGER.warn("String_Node_Str" + source.getName() + "String_Node_Str");
    LOGGER.debug("String_Node_Str" + source.isInTLLibrary() + "String_Node_Str"+ source.isTLLibraryMember());
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  try {
    source.getLibrary().moveMember(source,destination);
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str" + e.getLocalizedMessage());
    DialogUserNotifier.openError("String_Node_Str",e.getLocalizedMessage());
    return;
  }
  LOGGER.info("String_Node_Str" + source.getName() + "String_Node_Str"+ destination.getName());
}
Program: 136237
Project: 136237
Buggy source:
@Override public boolean isTLLibrary(){
  return getTLaLib() instanceof TLLibrary;
}

Fixed version (ground truth):
@Override public boolean isTLLibrary(){
  return getTLModelObject() instanceof TLLibrary;
}
Program: 136239
Project: 136239
Buggy source:
/** 
 * Is this either of the built in libraries: XSD Schema or OTA_Common_v01_00
 */
@Override public boolean isBuiltIn(){
  return getTLaLib() instanceof BuiltInLibrary;
}

Fixed version (ground truth):
/** 
 * Is this either of the built in libraries: XSD Schema or OTA_Common_v01_00
 */
@Override public boolean isBuiltIn(){
  return getTLModelObject() instanceof BuiltInLibrary;
}
Program: 136240
Project: 136240
Buggy source:
public AbstractLibrary getTLaLib(){
  return absTLLibrary;
}

Fixed version (ground truth):
/** 
 * Use   {@link #getTLModelObject()}
 * @return
 */
@Deprecated public AbstractLibrary getTLaLib(){
  return absTLLibrary;
}
Program: 136241
Project: 136241
Buggy source:
@Override public void processOwnershipEvent(OwnershipEvent<?,?> event){
  Node affectedNode=getAffectedNode(event);
  LibraryNode ln=(LibraryNode)thisNode;
switch (event.getType()) {
case MEMBER_ADDED:
    if (affectedNode == null)     return;
  if (affectedNode instanceof ContextualFacetNode) {
    if (affectedNode.getParent() != null)     break;
    if (!((ContextualFacetNode)affectedNode).canBeLibraryMember())     break;
  }
if (affectedNode instanceof VersionNode) ln.linkMember(((VersionNode)affectedNode).getNewestVersion());
 else ln.linkMember(affectedNode);
if (ln.isInChain()) {
ln.getChain().add((ComponentNode)affectedNode);
}
break;
case MEMBER_REMOVED:
if (affectedNode == null || affectedNode.getParent() == null) return;
Node parent=affectedNode.getParent();
if (parent instanceof VersionNode) parent=parent.getParent();
if (parent == null || parent instanceof ComponentNode) {
break;
}
if (ln.getChain() != null) ln.getChain().removeAggregate((ComponentNode)affectedNode);
affectedNode.unlinkNode();
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void processOwnershipEvent(OwnershipEvent<?,?> event){
  Node affectedNode=getAffectedNode(event);
  LOGGER.debug("String_Node_Str" + event.getType() + "String_Node_Str"+ thisNode+ "String_Node_Str"+ affectedNode);
  LibraryNode ln=(LibraryNode)thisNode;
switch (event.getType()) {
case MEMBER_ADDED:
    if (affectedNode == null)     return;
  if (affectedNode instanceof ContextualFacetNode) {
    if (affectedNode.getParent() != null)     break;
    if (!((ContextualFacetNode)affectedNode).canBeLibraryMember())     break;
  }
if (affectedNode instanceof VersionNode) ln.linkMember(((VersionNode)affectedNode).getNewestVersion());
 else ln.linkMember(affectedNode);
if (ln.isInChain()) {
ln.getChain().add((ComponentNode)affectedNode);
}
break;
case MEMBER_REMOVED:
if (affectedNode == null || affectedNode.getParent() == null) return;
Node parent=affectedNode.getParent();
if (parent instanceof VersionNode) parent=parent.getParent();
if (parent == null || parent instanceof ComponentNode) {
break;
}
if (ln.getChain() != null) ln.getChain().removeAggregate((ComponentNode)affectedNode);
affectedNode.unlinkNode();
break;
default :
break;
}
}
Program: 136243
Project: 136243
Buggy source:
public void checkObject(Node node){
  assertTrue(node != null);
  if (node instanceof BusinessObjectNode)   new BusinessObjectTests().checkBusinessObject((BusinessObjectNode)node);
 else   if (node instanceof CoreObjectNode)   new CoreObjectTests().checkCore((CoreObjectNode)node);
 else   if (node instanceof VWA_Node)   new VWA_Tests().checkVWA((VWA_Node)node);
 else   if (node instanceof PropertyOwnerNode)   new FacetsTests().checkFacet((PropertyOwnerNode)node);
 else   if (node instanceof ServiceNode)   new ServiceTests().check((ServiceNode)node);
 else   if (node instanceof OperationNode)   new OperationTests().check((OperationNode)node);
  if (!node.isValid()) {
    printValidationFindings(node.getOwningComponent());
    assertTrue("String_Node_Str",node.isValid());
  }
}

Fixed version (ground truth):
public void checkObject(Node node){
  assertTrue(node != null);
  assertTrue("String_Node_Str",Node.GetNode(node.getTLModelObject()) == node);
  if (node instanceof BusinessObjectNode)   new BusinessObjectTests().checkBusinessObject((BusinessObjectNode)node);
 else   if (node instanceof CoreObjectNode)   new CoreObjectTests().checkCore((CoreObjectNode)node);
 else   if (node instanceof VWA_Node)   new VWA_Tests().checkVWA((VWA_Node)node);
 else   if (node instanceof PropertyOwnerNode)   new FacetsTests().checkFacet((PropertyOwnerNode)node);
 else   if (node instanceof ServiceNode)   new ServiceTests().check((ServiceNode)node);
 else   if (node instanceof OperationNode)   new OperationTests().check((OperationNode)node);
  if (!node.isValid()) {
    printValidationFindings(node.getOwningComponent());
    assertTrue("String_Node_Str",node.isValid());
  }
}
Program: 136244
Project: 136244
Buggy source:
/** 
 * Tests if a node can be added to based edit-ability and version status. Used in global selection tester. <b>Note,</b> a minor version might have to be created before properties can be added. (use isNewToChain() to test). • Values with Attributes (VWA) • Core Object • Business Object • Operation
 * @return true if the node can have properties added.
 */
public boolean isEnabled_AddProperties(){
  if (library == null || parent == null || !isEditable() || isDeleted())   return false;
  if (isEditable_inService() && getLibrary().getChain() != null && getLibrary().getChain().getHead() == getLibrary())   return !getLibrary().getChain().getHead().getEditStatus().equals(NodeEditStatus.PATCH);
  if (this instanceof VersionedObjectInterface)   return isEditable_isNewOrAsMinor();
  if (this instanceof Enumeration)   return isEditable_isNewOrAsMinor();
  if (this instanceof ExtensionPointNode)   return isEditable_newToChain();
  if (this instanceof ContextualFacetNode)   return isEditable_newToChain();
  if (this instanceof SimpleFacetNode || this instanceof ListFacetNode)   return false;
  if (this instanceof FacetNode)   return getOwningComponent().isEnabled_AddProperties();
  if (this instanceof VWA_AttributeFacetNode)   return getOwningComponent().isEnabled_AddProperties();
  if (this instanceof RoleFacetNode)   return getOwningComponent().isEnabled_AddProperties();
  if (this instanceof SimpleAttributeNode)   return false;
  if (this instanceof PropertyNode)   return this != getOwningComponent() ? getOwningComponent().isEnabled_AddProperties() : false;
  return false;
}

Fixed version (ground truth):
/** 
 * Tests if a node can be added to based edit-ability and version status. Used in global selection tester. <b>Note,</b> a minor version might have to be created before properties can be added. (use isNewToChain() to test). • Values with Attributes (VWA) • Core Object • Business Object • Operation
 * @return true if the node can have properties added.
 */
public boolean isEnabled_AddProperties(){
  if (library == null || parent == null || !isEditable() || isDeleted())   return false;
  if (isEditable_inService() && getLibrary().getChain() != null && getLibrary().getChain().getHead() == getLibrary())   return !getLibrary().getChain().getHead().getEditStatus().equals(NodeEditStatus.PATCH);
  if (this instanceof VersionedObjectInterface)   return isEditable_isNewOrAsMinor();
  if (this instanceof ExtensionPointNode)   return isEditable_newToChain();
  if (this instanceof SimpleFacetNode || this instanceof ListFacetNode)   return false;
  if (this instanceof FacetNode)   return getOwningComponent().isEnabled_AddProperties();
  if (this instanceof VWA_AttributeFacetNode)   return getOwningComponent().isEnabled_AddProperties();
  if (this instanceof RoleFacetNode)   return getOwningComponent().isEnabled_AddProperties();
  if (this instanceof SimpleAttributeNode)   return false;
  if (this instanceof PropertyNode)   return this != getOwningComponent() ? getOwningComponent().isEnabled_AddProperties() : false;
  return false;
}
Program: 136245
Project: 136245
Buggy source:
@Override public String getDecoration(){
  String decoration="String_Node_Str";
  if (OTM16Upgrade.otm16Enabled) {
    decoration+="String_Node_Str" + getLabel();
    if (whereContributed != null && whereContributed.getParent() != null)     if (whereContributed.getParent().getLibrary() == getLibrary())     decoration+="String_Node_Str" + whereContributed.getParent().getName();
 else     decoration+="String_Node_Str" + whereContributed.getParent().getNameWithPrefix();
  }
  return decoration;
}

Fixed version (ground truth):
@Override public String getDecoration(){
  String decoration="String_Node_Str";
  if (OTM16Upgrade.otm16Enabled) {
    decoration+="String_Node_Str" + getLabel();
    if (whereContributed != null && whereContributed.getParent() != null)     if (whereContributed.getParent().getLibrary() == getLibrary())     decoration+="String_Node_Str" + whereContributed.getParent().getName();
 else     decoration+="String_Node_Str" + whereContributed.getParent().getNameWithPrefix();
    decoration+="String_Node_Str" + getTlVersion();
    if (!isInHead())     decoration+="String_Node_Str";
    decoration+="String_Node_Str";
  }
  return decoration;
}
Program: 136246
Project: 136246
Buggy source:
/** 
 * Add this contextual facet to the owner. Removes existing contributed facet if needed.
 * @param owner
 * @param newFacet
 */
protected void add(ContextualFacetOwnerInterface owner,TLContextualFacet newFacet){
  if (getWhereContributed() != null)   getWhereContributed().unlinkNode();
  if (OTM16Upgrade.otm16Enabled) {
    owner.getLibrary().addMember(this);
    ContributedFacetNode contrib=new ContributedFacetNode(newFacet);
    ((Node)owner).linkChild(contrib);
  }
 else {
    ((Node)owner).linkChild(this);
  }
}

Fixed version (ground truth):
/** 
 * Add this contextual facet to the owner. Removes existing contributed facet if needed.
 * @param owner
 * @param newFacet
 */
protected void add(ContextualFacetOwnerInterface owner,TLContextualFacet newFacet){
  if (getWhereContributed() != null)   getWhereContributed().unlinkNode();
  if (OTM16Upgrade.otm16Enabled) {
    if (getLibrary() == null)     owner.getLibrary().addMember(this);
    ContributedFacetNode contrib=new ContributedFacetNode(newFacet);
    ((Node)owner).linkChild(contrib);
  }
 else {
    ((Node)owner).linkChild(this);
  }
}
Program: 136247
Project: 136247
Buggy source:
public void setOwner(ContextualFacetOwnerInterface owner){
  TLContextualFacet newFacet=getTLModelObject();
  newFacet.setOwningEntity(owner.getTLModelObject());
  newFacet.setOwningLibrary(owner.getLibrary().getTLLibrary());
  if (owner.getTLModelObject() instanceof TLBusinessObject)   ((TLBusinessObject)owner.getTLModelObject()).addQueryFacet(newFacet);
  super.add(owner,newFacet);
}

Fixed version (ground truth):
public void setOwner(ContextualFacetOwnerInterface owner){
  TLContextualFacet newFacet=getTLModelObject();
  newFacet.setOwningEntity(owner.getTLModelObject());
  if (getLibrary() != null)   newFacet.setOwningLibrary(getLibrary().getTLLibrary());
 else   newFacet.setOwningLibrary(owner.getLibrary().getTLLibrary());
  if (owner.getTLModelObject() instanceof TLBusinessObject)   ((TLBusinessObject)owner.getTLModelObject()).addQueryFacet(newFacet);
  super.add(owner,newFacet);
}
Program: 136248
Project: 136248
Buggy source:
private Node linkContextual(ContextualFacetNode cf,Node subject,LibraryNode lib,String name,String description){
  cf.setName(name);
  cf.setDescription(description);
  if (subject instanceof ContextualFacetOwnerInterface)   cf.setOwner((ContextualFacetOwnerInterface)subject);
 else   lib.addMember(cf);
  return cf;
}

Fixed version (ground truth):
private Node linkContextual(ContextualFacetNode cf,Node subject,LibraryNode lib,String name,String description){
  cf.setName(name);
  cf.setDescription(description);
  lib.addMember(cf);
  if (subject instanceof ContextualFacetOwnerInterface)   cf.setOwner((ContextualFacetOwnerInterface)subject);
  return cf;
}
Program: 136249
Project: 136249
Buggy source:
@Override public boolean isEnabled(){
  LibraryNode ln=null;
  Node n=mc.getSelectedNode_NavigatorView();
  if (n != null)   ln=n.getLibrary();
  if (ln == null)   return false;
  RepositoryItemState state=ln.getProjectItem().getState();
  TLLibraryStatus status=ln.getProjectItem().getStatus();
  LOGGER.debug(ln + "String_Node_Str" + status+ "String_Node_Str"+ state+ "String_Node_Str"+ ln.getStatus().nextStatus());
  if (!ln.isInProjectNS())   return false;
  if (ln.getProjectItem().getStatus() == null || ln.getProjectItem().getStatus().nextStatus() == null)   return false;
  if (!ln.getProjectItem().getStatus().nextStatus().equals(targetStatus))   return false;
  if (targetStatus.equals(TLLibraryStatus.OBSOLETE)) {
    if (!OTM16Upgrade.otm16Enabled)     return false;
    if (!RepositoryUtils.isOTM16Library(ln.getProjectItem().getContent()))     return false;
  }
  return ln.isManaged();
}

Fixed version (ground truth):
@Override public boolean isEnabled(){
  LibraryNode ln=null;
  Node n=mc.getSelectedNode_NavigatorView();
  if (n != null)   ln=n.getLibrary();
  if (ln == null)   return false;
  RepositoryItemState state=ln.getProjectItem().getState();
  TLLibraryStatus status=ln.getProjectItem().getStatus();
  if (!ln.isInProjectNS())   return false;
  if (ln.getProjectItem().getStatus() == null || ln.getProjectItem().getStatus().nextStatus() == null)   return false;
  if (!ln.getProjectItem().getStatus().nextStatus().equals(targetStatus))   return false;
  if (targetStatus.equals(TLLibraryStatus.OBSOLETE)) {
    if (!OTM16Upgrade.otm16Enabled)     return false;
    if (!RepositoryUtils.isOTM16Library(ln.getProjectItem().getContent()))     return false;
  }
  return ln.isManaged();
}
Program: 136250
Project: 136250
Buggy source:
/** 
 * run repository controller create major version
 */
@Override public void run(){
  RepositoryController rc=mc.getRepositoryController();
  if (rc == null) {
    this.notifyResult(false);
    return;
  }
  for (  Node node : mc.getSelectedNodes_NavigatorView()) {
    node=node.getLibrary();
    if (!(node.getLibrary() instanceof LibraryNode)) {
      DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
      continue;
    }
    LibraryNode ln=node.getLibrary();
    if (ln.getTLaLib().getOwningModel() == null) {
      DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
      continue;
    }
switch (targetStatus) {
case FINAL:
      mc.postStatus("String_Node_Str" + ln);
    break;
case UNDER_REVIEW:
  mc.postStatus("String_Node_Str" + node);
break;
case OBSOLETE:
mc.postStatus("String_Node_Str" + node);
break;
default :
return;
}
this.notifyResult(rc.promote(ln,targetStatus));
}
}

Fixed version (ground truth):
/** 
 * run repository controller create major version
 */
@Override public void run(){
  RepositoryController rc=mc.getRepositoryController();
  if (rc == null) {
    this.notifyResult(false);
    return;
  }
  for (  Node node : mc.getSelectedNodes_NavigatorView()) {
    node=node.getLibrary();
    if (!(node.getLibrary() instanceof LibraryNode)) {
      DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
      continue;
    }
    LibraryNode ln=node.getLibrary();
    if (ln.getTLModelObject().getOwningModel() == null) {
      DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
      continue;
    }
switch (targetStatus) {
case FINAL:
      mc.postStatus("String_Node_Str" + ln);
    break;
case UNDER_REVIEW:
  mc.postStatus("String_Node_Str" + node);
break;
case OBSOLETE:
mc.postStatus("String_Node_Str" + node);
break;
default :
return;
}
this.notifyResult(rc.promote(ln,targetStatus));
}
}
Program: 136251
Project: 136251
Buggy source:
@Override public boolean isEnabled(){
  Node n=mc.getSelectedNode_NavigatorView();
  if (n instanceof LibraryProviderNode)   return true;
  return n != null && n.isEditable() ? n instanceof TypeUserNode : false;
}

Fixed version (ground truth):
@Override public boolean isEnabled(){
  Node n=mc.getSelectedNode_NavigatorView();
  if (n instanceof LibraryProviderNode)   return ((LibraryProviderNode)n).getParent().isEditable();
  return n != null && n.isEditable() ? n instanceof TypeUserNode : false;
}
Program: 136254
Project: 136254
Buggy source:
public String getDecoration(){
  String decoration="String_Node_Str";
  if (this instanceof TypeProvider && !(this instanceof ImpliedNode))   decoration+="String_Node_Str" + ((TypeProvider)this).getWhereUsedAndDescendantsCount() + "String_Node_Str";
  if (isDeleted())   decoration+="String_Node_Str";
  if (isDeprecated())   decoration+="String_Node_Str";
  if (this instanceof ExtensionOwner) {
    if (getLibrary() != null)     getLibrary().checkExtension(this);
    String extensionTxt="String_Node_Str";
    ComponentNode exBase=(ComponentNode)getExtendsType();
    if (exBase != null) {
      extensionTxt+="String_Node_Str" + exBase.getNameWithPrefix() + "String_Node_Str";
      if (getChain() != null)       extensionTxt+="String_Node_Str";
    }
    if (getChain() != null) {
      if (isInHead())       if (getLibrary().isMajorVersion())       extensionTxt+="String_Node_Str";
 else       if (isNewToChain())       extensionTxt+="String_Node_Str";
 else       extensionTxt+="String_Node_Str";
 else       extensionTxt+="String_Node_Str" + getTlVersion();
      if (isEditable())       extensionTxt+="String_Node_Str";
    }
    if (isEditable()) {
      if (getChain() == null)       extensionTxt+="String_Node_Str";
 else       if (isInHead())       if (isNewToChain())       extensionTxt+="String_Node_Str";
 else       extensionTxt+="String_Node_Str";
 else       if (this instanceof VersionedObjectInterface)       extensionTxt+="String_Node_Str";
    }
    decoration+=surround(extensionTxt);
  }
  return decoration;
}

Fixed version (ground truth):
public String getDecoration(){
  String decoration="String_Node_Str";
  if (this instanceof TypeProvider && !(this instanceof ImpliedNode))   decoration+="String_Node_Str" + ((TypeProvider)this).getWhereUsedNode().getWhereUsedCount() + "String_Node_Str";
  if (isDeleted())   decoration+="String_Node_Str";
  if (isDeprecated())   decoration+="String_Node_Str";
  if (this instanceof ExtensionOwner) {
    if (getLibrary() != null)     getLibrary().checkExtension(this);
    String extensionTxt="String_Node_Str";
    ComponentNode exBase=(ComponentNode)getExtendsType();
    if (exBase != null) {
      extensionTxt+="String_Node_Str" + exBase.getNameWithPrefix() + "String_Node_Str";
      if (getChain() != null)       extensionTxt+="String_Node_Str";
    }
    if (getChain() != null) {
      if (isInHead())       if (getLibrary().isMajorVersion())       extensionTxt+="String_Node_Str";
 else       if (isNewToChain())       extensionTxt+="String_Node_Str";
 else       extensionTxt+="String_Node_Str";
 else       extensionTxt+="String_Node_Str" + getTlVersion();
      if (isEditable())       extensionTxt+="String_Node_Str";
    }
    if (isEditable()) {
      if (getChain() == null)       extensionTxt+="String_Node_Str";
 else       if (isInHead())       if (isNewToChain())       extensionTxt+="String_Node_Str";
 else       extensionTxt+="String_Node_Str";
 else       if (this instanceof VersionedObjectInterface)       extensionTxt+="String_Node_Str";
    }
    decoration+=surround(extensionTxt);
  }
  return decoration;
}
Program: 136255
Project: 136255
Buggy source:
/** 
 * {@link org.opentravel.schemas.actions.VersionMajorAction#run()}
 */
@Override public LibraryNode createMajorVersion(LibraryNode library){
  if (!versionPreparation(library))   return null;
  RepositoryNode rn=find(library.getProjectItem().getRepository());
  MajorVersionHelper mvh=new MajorVersionHelper(library.getProject().getTLProject());
  TLLibrary major=null;
  LibraryNode newLib=null;
  try {
    major=mvh.createNewMajorVersion(library.getTLLibrary());
  }
 catch (  VersionSchemeException e) {
    postRepoException(e);
  }
catch (  ValidationException e) {
    postRepoException(e);
  }
catch (  LibrarySaveException e) {
    postRepoException(e);
  }
  LibraryChainNode lcn=null;
  if (major != null) {
    newLib=new LibraryNode(major,library.getProject());
    List<LibraryChainNode> chains=manage(rn,Collections.singletonList(newLib));
    lcn=findLibrary(chains,newLib.getLibrary().getName());
    if (lcn != null) {
      lock(newLib);
    }
    sync(rn);
  }
  return newLib;
}

Fixed version (ground truth):
/** 
 * {@link org.opentravel.schemas.actions.VersionMajorAction#run()}
 */
@Override public LibraryNode createMajorVersion(LibraryNode library){
  if (!versionPreparation(library))   return null;
  RepositoryNode rn=find(library.getProjectItem().getRepository());
  MajorVersionHelper mvh=new MajorVersionHelper(library.getProject().getTLProject());
  TLLibrary tlMajor=null;
  LibraryNode newLib=null;
  LibraryChainNode lcn=null;
  ProjectNode thisProject=library.getProject();
  try {
    tlMajor=mvh.createNewMajorVersion(library.getTLLibrary());
  }
 catch (  VersionSchemeException e) {
    postRepoException(e);
  }
catch (  ValidationException e) {
    postRepoException(e);
  }
catch (  LibrarySaveException e) {
    postRepoException(e);
  }
catch (  IllegalArgumentException e) {
    postRepoException(e);
  }
  if (tlMajor != null) {
    newLib=new LibraryNode(tlMajor,library.getProject());
    List<LibraryChainNode> chains=manage(rn,Collections.singletonList(newLib));
    lcn=findLibrary(chains,newLib.getLibrary().getName());
    if (lcn != null) {
      LibraryModelManager libMrg=Node.getLibraryModelManager();
      ProjectController pc=mc.getProjectController();
      List<ProjectNode> pList=libMrg.findProjects(library);
      for (      ProjectNode pn : libMrg.findProjects(library)) {
        pc.remove(library,pn);
        if (pn != thisProject)         new LibraryNavNode(lcn,pn);
      }
      lock(newLib);
    }
    sync(rn);
  }
  return newLib;
}
Program: 136257
Project: 136257
Buggy source:
private LibraryNavNode modelLibraryInterface(ProjectItem pi,ProjectNode project){
  LibraryInterface li=null;
  LOGGER.debug("String_Node_Str" + pi.getLibraryName());
  if (pi.getRepository() == null)   li=new LibraryNode(pi.getContent(),project);
 else {
    String chainName=project.makeChainIdentity(pi);
    LibraryChainNode chain=getChain(chainName);
    if (chain == null) {
      li=createNewChain(pi,project);
    }
 else {
      if (!libraries.contains(chain)) {
        LOGGER.debug("String_Node_Str");
        li=new LibraryChainNode(pi,project);
      }
 else       li=chain;
    }
  }
  LibraryNavNode newLNN=null;
  if (li != null) {
    if (!libraries.contains(li))     libraries.add(li);
    if (li.getParent() instanceof LibraryNavNode)     newLNN=(LibraryNavNode)li.getParent();
  }
 else   LOGGER.error("String_Node_Str");
  if (newLNN == null)   LOGGER.warn("String_Node_Str");
  return newLNN;
}

Fixed version (ground truth):
private LibraryNavNode modelLibraryInterface(ProjectItem pi,ProjectNode project){
  LibraryInterface li=null;
  LibraryNavNode newLNN=null;
  LOGGER.debug("String_Node_Str" + pi.getLibraryName());
  if (pi.getRepository() == null)   li=new LibraryNode(pi.getContent(),project);
 else {
    String chainName=project.makeChainIdentity(pi);
    LibraryChainNode chain=getChain(chainName);
    if (chain == null) {
      li=createNewChain(pi,project);
    }
 else {
      if (!libraries.contains(chain)) {
        LOGGER.debug("String_Node_Str");
        li=new LibraryChainNode(pi,project);
      }
 else {
        LOGGER.debug("String_Node_Str");
        li=chain;
        if (li.getParent() instanceof LibraryNavNode)         newLNN=new LibraryNavNode(chain,project);
      }
    }
  }
  if (li != null && newLNN == null) {
    if (!libraries.contains(li))     libraries.add(li);
    if (li.getParent() instanceof LibraryNavNode)     newLNN=(LibraryNavNode)li.getParent();
 else     LOGGER.error("String_Node_Str" + li + "String_Node_Str");
  }
  if (li == null)   LOGGER.error("String_Node_Str" + pi.getLibraryName() + "String_Node_Str");
  assert(newLNN != null);
  return newLNN;
}
Program: 136258
Project: 136258
Buggy source:
/** 
 * Remove the associated library from the associated project both in the TL and GUI models.
 */
public void remove(LibraryNavNode libraryNavNode);

Fixed version (ground truth):
/** 
 * Remove the passed library from the passed project.
 */
public void remove(LibraryInterface library,ProjectNode pn);
Program: 136259
Project: 136259
Buggy source:
public String getName(){
  if (parentObject instanceof TLSimpleFacet)   ((TLSimpleFacet)parentObject).getLocalName();
 else   if (parentObject instanceof TLCoreObject)   return ((TLCoreObject)parentObject).getLocalName() + "String_Node_Str";
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getName(){
  if (parentObject instanceof TLSimpleFacet)   return ((TLSimpleFacet)parentObject).getLocalName();
 else   if (parentObject instanceof TLCoreObject)   return ((TLCoreObject)parentObject).getLocalName() + "String_Node_Str";
  return "String_Node_Str";
}
Program: 136261
Project: 136261
Buggy source:
@Override public void delete(){
  removeBaseListener();
  if (getTLModelObj().getOwningEntity() == null) {
    return;
  }
  if ((getTLModelObj().getFacetType().equals(TLFacetType.REQUEST)) || (getTLModelObj().getFacetType().equals(TLFacetType.RESPONSE)) || (getTLModelObj().getFacetType().equals(TLFacetType.NOTIFICATION))) {
    getTLModelObj().clearFacet();
  }
 else   if (getTLModelObj().getFacetType().equals(TLFacetType.CHOICE))   ((TLChoiceObject)getTLModelObj().getOwningEntity()).removeChoiceFacet((TLContextualFacet)getTLModelObj());
  if (getTLModelObj().getFacetType().equals(TLFacetType.CUSTOM)) {
    ((TLBusinessObject)getTLModelObj().getOwningEntity()).removeCustomFacet((TLContextualFacet)getTLModelObj());
  }
 else   if (getTLModelObj().getFacetType().equals(TLFacetType.QUERY)) {
    ((TLBusinessObject)getTLModelObj().getOwningEntity()).removeQueryFacet((TLContextualFacet)getTLModelObj());
  }
 else {
    getTLModelObj().clearFacet();
  }
}

Fixed version (ground truth):
@Override public void delete(){
  removeBaseListener();
  if (getTLModelObj().getOwningEntity() == null) {
    return;
  }
  TLFacetOwner oe=getTLModelObj().getOwningEntity();
  AbstractLibrary ol=getTLModelObj().getOwningLibrary();
  TLFacetType facetType=getTLModelObj().getFacetType();
  if (facetType.equals(TLFacetType.REQUEST) || facetType.equals(TLFacetType.RESPONSE) || facetType.equals(TLFacetType.NOTIFICATION)) {
    getTLModelObj().clearFacet();
  }
 else   if (facetType.equals(TLFacetType.CHOICE)) {
    ((TLChoiceObject)oe).removeChoiceFacet((TLContextualFacet)getTLModelObj());
    ol.removeNamedMember((TLContextualFacet)getTLModelObj());
  }
 else   if (getTLModelObj().getFacetType().equals(TLFacetType.CUSTOM)) {
    ((TLBusinessObject)oe).removeCustomFacet((TLContextualFacet)getTLModelObj());
    ol.removeNamedMember((TLContextualFacet)getTLModelObj());
  }
 else   if (getTLModelObj().getFacetType().equals(TLFacetType.QUERY)) {
    ((TLBusinessObject)oe).removeQueryFacet((TLContextualFacet)getTLModelObj());
    ol.removeNamedMember((TLContextualFacet)getTLModelObj());
  }
 else {
    getTLModelObj().clearFacet();
  }
}
Program: 136262
Project: 136262
Buggy source:
/** 
 * Create a component node for a <b>non</b>-top-level model element. Only creates node and sets name and description.
 * @param obj
 */
public ComponentNode(final TLModelElement obj){
  super(obj);
  if (obj instanceof TLFacet)   addMOChildren();
  setListner();
}

Fixed version (ground truth):
/** 
 * Create a component node for a <b>non</b>-top-level model element. Only creates node and sets name and description.
 * @param obj
 */
public ComponentNode(final TLModelElement obj){
  super(obj);
  setListner();
}