Program: 169051
Project: 169051
Buggy source:
protected JoinNode createOrUpdateNode(JoinNode baseNode,String basePath,String joinPath,String alias,String field,JoinType joinType,boolean fetch,boolean implicit,boolean fromSelect){
  JoinNode currentNode=baseNode;
  StringBuilder currentPath=new StringBuilder(basePath);
  String[] pathElements=(joinPath + (!joinPath.isEmpty() && field != null ? "String_Node_Str" : "String_Node_Str") + (field == null ? "String_Node_Str" : field)).split("String_Node_Str");
  if (!fromSelect && !basePath.isEmpty()) {
    baseNode.setSelectOnly(false);
    if (basePath.contains("String_Node_Str")) {
      for (      String pathElem : basePath.split("String_Node_Str")) {
        currentNode=currentNode.getNodes().get(pathElem);
        currentNode.setSelectOnly(false);
      }
      currentNode=baseNode;
    }
  }
  Class<?> currentClass;
  if (baseNode.getPropertyClass() == null) {
    currentClass=clazz;
  }
 else {
    currentClass=baseNode.getPropertyClass();
  }
  for (int j=0; j < pathElements.length; j++) {
    String propertyName=pathElements[j];
    EntityType type=metamodel.entity(currentClass);
    Attribute attr=type.getAttribute(propertyName);
    if (attr == null) {
      throw new IllegalArgumentException("String_Node_Str" + propertyName + "String_Node_Str"+ currentClass.getName());
    }
    boolean collectionValued=attr.isCollection();
    Class<?> resolvedFieldClass=ModelUtils.resolveFieldClass(attr);
    if (!ModelUtils.isJoinable(attr)) {
      LOG.fine(new StringBuilder("String_Node_Str").append(propertyName).append("String_Node_Str").append(currentClass.getName()).append("String_Node_Str").toString());
      break;
    }
    currentClass=resolvedFieldClass;
    JoinType modelAwareType;
    if ((attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE) && ((SingularAttribute)attr).isOptional() == false) {
      modelAwareType=JoinType.INNER;
    }
 else {
      modelAwareType=JoinType.LEFT;
    }
    if (j == pathElements.length - 1) {
      if (alias == null) {
        alias=propertyName;
      }
      if (joinType == null) {
        joinType=modelAwareType;
      }
      currentNode=getOrCreate(currentPath,currentNode,propertyName,resolvedFieldClass,alias,joinType,fetch,"String_Node_Str",implicit,attr.isCollection());
    }
 else {
      currentNode=getOrCreate(currentPath,currentNode,propertyName,resolvedFieldClass,propertyName,modelAwareType,fetch,"String_Node_Str",true,attr.isCollection());
    }
    if (fetch) {
      currentNode.setFetch(true);
    }
    if (!fromSelect) {
      currentNode.setSelectOnly(false);
    }
  }
  return currentNode;
}

Fixed version (ground truth):
protected JoinNode createOrUpdateNode(JoinNode baseNode,String basePath,String joinPath,String alias,String field,JoinType joinType,boolean fetch,boolean implicit,boolean fromSelect){
  JoinNode currentNode=baseNode;
  StringBuilder currentPath=new StringBuilder(basePath);
  String[] pathElements=(joinPath + (!joinPath.isEmpty() && field != null ? "String_Node_Str" : "String_Node_Str") + (field == null ? "String_Node_Str" : field)).split("String_Node_Str");
  if (!fromSelect && !basePath.isEmpty()) {
    baseNode.setSelectOnly(false);
    if (basePath.contains("String_Node_Str")) {
      for (      String pathElem : basePath.split("String_Node_Str")) {
        currentNode=currentNode.getNodes().get(pathElem);
        currentNode.setSelectOnly(false);
      }
      currentNode=baseNode;
    }
  }
  Class<?> currentClass;
  if (baseNode.getPropertyClass() == null) {
    currentClass=clazz;
  }
 else {
    currentClass=baseNode.getPropertyClass();
  }
  for (int j=0; j < pathElements.length; j++) {
    String propertyName=pathElements[j];
    ManagedType type=metamodel.managedType(currentClass);
    Attribute attr=type.getAttribute(propertyName);
    if (attr == null) {
      throw new IllegalArgumentException("String_Node_Str" + propertyName + "String_Node_Str"+ currentClass.getName());
    }
    boolean collectionValued=attr.isCollection();
    Class<?> resolvedFieldClass=ModelUtils.resolveFieldClass(attr);
    if (!ModelUtils.isJoinable(attr)) {
      LOG.fine(new StringBuilder("String_Node_Str").append(propertyName).append("String_Node_Str").append(currentClass.getName()).append("String_Node_Str").toString());
      break;
    }
    currentClass=resolvedFieldClass;
    JoinType modelAwareType;
    if ((attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE) && ((SingularAttribute)attr).isOptional() == false) {
      modelAwareType=JoinType.INNER;
    }
 else {
      modelAwareType=JoinType.LEFT;
    }
    if (j == pathElements.length - 1) {
      if (alias == null) {
        alias=propertyName;
      }
      if (joinType == null) {
        joinType=modelAwareType;
      }
      currentNode=getOrCreate(currentPath,currentNode,propertyName,resolvedFieldClass,alias,joinType,fetch,"String_Node_Str",implicit,attr.isCollection());
    }
 else {
      currentNode=getOrCreate(currentPath,currentNode,propertyName,resolvedFieldClass,propertyName,modelAwareType,fetch,"String_Node_Str",true,attr.isCollection());
    }
    if (fetch) {
      currentNode.setFetch(true);
    }
    if (!fromSelect) {
      currentNode.setSelectOnly(false);
    }
  }
  return currentNode;
}