Program: 136271
Project: 136271
Buggy source:
/** 
 * Create a component in the head library that versions (extends) the selected node. Prompts the user to confirm before creating node.
 * @return newly created node or null if user cancelled or error.
 */
public ComponentNode createVersionExtension(Node selectedNode){
  ComponentNode actOnNode=null;
  boolean result=false;
  if (selectedNode.getChain() == null)   return null;
  if (selectedNode.isInHead())   LOGGER.warn("String_Node_Str" + selectedNode + "String_Node_Str");
  if (selectedNode.getChain().getHead().isPatchVersion()) {
    if (!(selectedNode instanceof ExtensionPointNode)) {
      if (result=postConfirm("String_Node_Str",selectedNode))       actOnNode=((ComponentNode)selectedNode).createPatchVersionComponent();
    }
  }
 else   if (selectedNode.getChain().getHead().isMinorOrMajorVersion()) {
    if (selectedNode instanceof VersionedObjectInterface) {
      if (result=postConfirm("String_Node_Str",selectedNode))       actOnNode=((VersionedObjectInterface)selectedNode).createMinorVersionComponent();
    }
 else     if (selectedNode.isEditable_inService())     if (selectedNode.getLibrary().getChain().getHead() == selectedNode.getLibrary())     actOnNode=(ComponentNode)selectedNode;
 else     actOnNode=new OperationNode((ServiceNode)selectedNode.getLibrary().getServiceRoot().getChildren().get(0),"String_Node_Str");
  }
  if (actOnNode == null && result == true)   DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str" + selectedNode + "String_Node_Str");
  return actOnNode;
}

Fixed version (ground truth):
/** 
 * Create a component in the head library that versions (extends) the selected node. Prompts the user to confirm before creating node.
 * @return newly created node or null if user cancelled or error.
 */
public ComponentNode createVersionExtension(Node selectedNode){
  ComponentNode actOnNode=null;
  FacetNode selectedFacet=null;
  boolean result=false;
  if (selectedNode.getChain() == null)   return null;
  if (selectedNode.isInHead())   LOGGER.warn("String_Node_Str" + selectedNode + "String_Node_Str");
  if (selectedNode.getChain().getHead().isPatchVersion()) {
    if (!(selectedNode instanceof ExtensionPointNode)) {
      if (result=postConfirm("String_Node_Str",selectedNode))       actOnNode=((ComponentNode)selectedNode).createPatchVersionComponent();
    }
  }
 else   if (selectedNode.getChain().getHead().isMinorOrMajorVersion()) {
    if (selectedNode instanceof FacetNode) {
      selectedFacet=(FacetNode)selectedNode;
      selectedNode=selectedNode.getOwningComponent();
    }
    if (selectedNode instanceof VersionedObjectInterface) {
      if (result=postConfirm("String_Node_Str",selectedNode))       actOnNode=((VersionedObjectInterface)selectedNode).createMinorVersionComponent();
    }
 else     if (selectedNode.isEditable_inService())     if (selectedNode.getLibrary().getChain().getHead() == selectedNode.getLibrary())     actOnNode=(ComponentNode)selectedNode;
 else     actOnNode=new OperationNode((ServiceNode)selectedNode.getLibrary().getServiceRoot().getChildren().get(0),"String_Node_Str");
  }
  if (actOnNode == null && result == true)   DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str" + selectedNode + "String_Node_Str");
  if (selectedFacet != null) {
    for (    Node n : actOnNode.getChildren())     if (n.getName().equals(selectedFacet.getName()))     actOnNode=(ComponentNode)n;
  }
  return actOnNode;
}