Program: 136260
Project: 136260
Buggy source:
/** 
 * Create libraries and library chains from the project item. Will create library or chain if it has not already be added. Newly created libraries will have their parent set. Types are set but <b>not</b> resolved.
 * @param pi - project item to model
 * @param project - project node to associate with the Nav node (and newly create libraries and chains)
 * @return Return a LibraryNavNode to use as a child in a tree.
 */
public LibraryNavNode add(ProjectItem pi,ProjectNode project){
  LOGGER.debug("String_Node_Str" + pi.getLibraryName());
  LibraryInterface li=null;
  LibraryNavNode newLNN=null;
  Node n=Node.GetNode((TLModelElement)pi.getContent());
  if (n instanceof LibraryInterface)   li=((LibraryInterface)n);
  if (li != null)   assert(!((Node)li).isDeleted());
  if (li != null && project.getLibraries().contains(li)) {
    return null;
  }
  if (li == null) {
    newLNN=modelLibraryInterface(pi,project);
  }
 else {
    if (li.getChain() == null)     newLNN=new LibraryNavNode((LibraryNode)li,project);
 else     newLNN=new LibraryNavNode(li.getChain(),project);
  }
  assert(newLNN != null);
  assert(newLNN.getLibrary() != null);
  newLNN.getLibrary().updateLibraryStatus();
  assert(newLNN.getParent() == project);
  if (li instanceof LibraryNode) {
    if (!((LibraryNode)li).isInChain())     assert(newLNN.getLibrary() == li);
 else     assert(newLNN.getThisLib() instanceof LibraryChainNode);
    ((LibraryChainNode)newLNN.getThisLib()).getLibraries().contains(li);
  }
 else   if (li instanceof LibraryChainNode)   assert(((LibraryChainNode)li).getLibraries().contains(newLNN.getLibrary()));
  LOGGER.debug("String_Node_Str" + pi.getLibraryName());
  return newLNN;
}

Fixed version (ground truth):
/** 
 * Create libraries and library chains from the project item. Will create library or chain if it has not already be added. Newly created libraries will have their parent set. Types are set but <b>not</b> resolved.
 * @param pi - project item to model
 * @param project - project node to associate with the Nav node (and newly create libraries and chains)
 * @return Return a LibraryNavNode to use as a child in a tree.
 */
public LibraryNavNode add(ProjectItem pi,ProjectNode project){
  LOGGER.debug("String_Node_Str" + pi.getLibraryName());
  LibraryInterface li=null;
  LibraryNavNode newLNN=null;
  Node n=Node.GetNode((TLModelElement)pi.getContent());
  if (n instanceof LibraryInterface)   li=((LibraryInterface)n);
  if (li != null)   assert(!((Node)li).isDeleted());
  if (li != null && project.getLibraries().contains(li)) {
    return null;
  }
  if (li == null) {
    newLNN=modelLibraryInterface(pi,project);
  }
 else {
    if (li.getChain() == null)     newLNN=new LibraryNavNode((LibraryNode)li,project);
 else     newLNN=new LibraryNavNode(li.getChain(),project);
  }
  assert(newLNN != null);
  assert(newLNN.getLibrary() != null);
  newLNN.getLibrary().updateLibraryStatus();
  assert(newLNN.getParent() == project);
  if (li instanceof LibraryNode) {
    if (!((LibraryNode)li).isInChain())     assert(newLNN.getLibrary() == li);
 else {
      assert(newLNN.getThisLib() instanceof LibraryChainNode);
      assert((LibraryChainNode)newLNN.getThisLib()).getLibraries().contains(li);
    }
  }
 else   if (li instanceof LibraryChainNode)   assert(((LibraryChainNode)li).getLibraries().contains(newLNN.getLibrary()));
  LOGGER.debug("String_Node_Str" + pi.getLibraryName());
  return newLNN;
}