Program: 21637
Project: 21637
Buggy source:
/** 
 * This element comes with extra information.  The name of  the element identifies it as a resource in the parentType The resource in the parent type has type information.  So if the element is "&lt;myText>hi this is my text&lt;/myText>" and myText is defined as a "string" in the parentType then this element will be turned into a string.
 * @param parentElement TODO
 * @param parentType
 * @param child
 * @return
 */
public Object handleChildResource(OTXMLElement parentElement,String childName,Object childObj,String relativeParentPath,XMLDataObject parent,int xmlType,String comment) throws HandleElementException {
  OTClassProperty otProperty=otClass.getProperty(childName);
  if (otProperty == null) {
    System.err.println("String_Node_Str" + childName + "String_Node_Str"+ getObjectName());
    return null;
  }
  OTType otType=otProperty.getType();
  XMLReferenceInfo resInfo=null;
  if (xmlDB.isTrackResourceInfo()) {
    resInfo=parent.getReferenceInfo(childName);
    if (resInfo == null) {
      resInfo=new XMLReferenceInfo();
      parent.setResourceInfo(childName,resInfo);
    }
    resInfo.type=xmlType;
    resInfo.comment=comment;
  }
  if (otType instanceof OTClass && childObj instanceof String) {
    String refid=(String)childObj;
    if (refid != null && refid.length() > 0) {
      return new XMLDataObjectRef(refid,parentElement);
    }
  }
  if (otType instanceof OTClass) {
    if (!(childObj instanceof OTXMLElement)) {
      System.err.println("String_Node_Str");
      return null;
    }
    OTXMLElement child=(OTXMLElement)childObj;
    String childRefId=child.getAttributeValue("String_Node_Str");
    if (childRefId == null) {
      List children=child.getChildren();
      if (children.size() < 1) {
        return null;
      }
      childObj=children.get(0);
      if (children.size() > 1) {
        System.err.println("String_Node_Str" + TypeService.elementPath(child));
      }
      String childElementName=((OTXMLElement)childObj).getName();
      if (childElementName.equals("String_Node_Str")) {
        otType=OTrunkImpl.getOTClass("String_Node_Str");
      }
 else {
        otType=OTrunkImpl.getOTClass(childElementName);
        if (otType == null) {
          otType=typeService.getClassByShortcut(childElementName);
        }
        if (otType == null) {
          throw new IllegalStateException("String_Node_Str" + childElementName + "String_Node_Str");
        }
      }
    }
  }
  if (otType == null) {
    throw new IllegalStateException("String_Node_Str" + otProperty);
  }
  ResourceTypeHandler resHandler=typeService.getElementHandler(otType);
  if (resHandler == null) {
    System.err.println("String_Node_Str" + otType.getInstanceClass());
    return null;
  }
  if (childObj instanceof String) {
    if (resHandler instanceof PrimitiveResourceTypeHandler) {
      return ((PrimitiveResourceTypeHandler)resHandler).handleElement((String)childObj);
    }
 else {
      throw new HandleElementException("String_Node_Str");
    }
  }
 else {
    String childRelativePath=relativeParentPath + "String_Node_Str" + childName;
    return resHandler.handleElement((OTXMLElement)childObj,childRelativePath,parent);
  }
}

Fixed version (ground truth):
/** 
 * This element comes with extra information.  The name of  the element identifies it as a resource in the parentType The resource in the parent type has type information.  So if the element is "&lt;myText>hi this is my text&lt;/myText>" and myText is defined as a "string" in the parentType then this element will be turned into a string.
 * @param parentElement TODO
 * @param parentType
 * @param child
 * @return
 */
public Object handleChildResource(OTXMLElement parentElement,String childName,Object childObj,String relativeParentPath,XMLDataObject parent,int xmlType,String comment) throws HandleElementException {
  OTClassProperty otProperty=otClass.getProperty(childName);
  if (otProperty == null) {
    System.err.println("String_Node_Str" + childName + "String_Node_Str"+ getObjectName());
    return null;
  }
  OTType otType=otProperty.getType();
  XMLReferenceInfo resInfo=null;
  if (xmlDB.isTrackResourceInfo()) {
    resInfo=parent.getReferenceInfo(childName);
    if (resInfo == null) {
      resInfo=new XMLReferenceInfo();
      parent.setResourceInfo(childName,resInfo);
    }
    resInfo.type=xmlType;
    resInfo.comment=comment;
  }
  if (otType instanceof OTClass && childObj instanceof String) {
    String refid=(String)childObj;
    if (refid != null && refid.length() > 0) {
      return new XMLDataObjectRef(refid,parentElement);
    }
  }
  if (otType instanceof OTClass) {
    if (!(childObj instanceof OTXMLElement)) {
      System.err.println("String_Node_Str");
      return null;
    }
    OTXMLElement child=(OTXMLElement)childObj;
    String childRefId=child.getAttributeValue("String_Node_Str");
    if (childRefId == null) {
      List children=child.getChildren();
      if (children.size() < 1) {
        return null;
      }
      childObj=children.get(0);
      if (children.size() > 1) {
        System.err.println("String_Node_Str" + TypeService.elementPath(child));
      }
      String childElementName=((OTXMLElement)childObj).getName();
      if (childElementName.equals("String_Node_Str")) {
        otType=OTrunkImpl.getOTClass("String_Node_Str");
      }
 else {
        otType=OTrunkImpl.getOTClass(childElementName);
        if (otType == null) {
          otType=typeService.getClassByShortcut(childElementName);
        }
        if (otType == null) {
          throw new IllegalStateException("String_Node_Str" + childElementName + "String_Node_Str");
        }
      }
    }
  }
  if (otType == null) {
    throw new IllegalStateException("String_Node_Str" + otProperty.getName() + "String_Node_Str"+ otClass.getInstanceClass().getName());
  }
  ResourceTypeHandler resHandler=typeService.getElementHandler(otType);
  if (resHandler == null) {
    System.err.println("String_Node_Str" + otType.getInstanceClass());
    return null;
  }
  if (childObj instanceof String) {
    if (resHandler instanceof PrimitiveResourceTypeHandler) {
      return ((PrimitiveResourceTypeHandler)resHandler).handleElement((String)childObj);
    }
 else {
      throw new HandleElementException("String_Node_Str");
    }
  }
 else {
    String childRelativePath=relativeParentPath + "String_Node_Str" + childName;
    return resHandler.handleElement((OTXMLElement)childObj,childRelativePath,parent);
  }
}