nus-yam/ex-repair huggingface dataset:
Program: 63992
Project: 63992
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(getNameForFragmentBytes(xPathFragment));
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(getNameForFragmentBytes(xPathFragment));
  if (xPathFragment.isGeneratedPrefix()) {
    namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
  }
}
Program: 63993
Project: 63993
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    isStartElementOpen=true;
    writer.write('<');
    writer.write(getNameForFragment(xPathFragment));
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    isStartElementOpen=true;
    writer.write('<');
    writer.write(getNameForFragment(xPathFragment));
    if (xPathFragment.isGeneratedPrefix()) {
      namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63994
Project: 63994
Buggy source:
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen=true;
  this.xPathFragment=xPathFragment;
  this.attributes=null;
  this.namespaceDeclarations=null;
  writePrefixMappings();
}

Fixed version (ground truth):
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen=true;
  this.xPathFragment=xPathFragment;
  this.attributes=null;
  this.namespaceDeclarations=null;
  if (xPathFragment.isGeneratedPrefix()) {
    namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
  }
  writePrefixMappings();
}
Program: 63995
Project: 63995
Buggy source:
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  try {
    String namespaceURI=xPathFragment.getNamespaceURI();
    if (namespaceURI == null) {
      NamespaceContext namespaceContext=xmlStreamWriter.getNamespaceContext();
      if (null == namespaceContext) {
        xmlStreamWriter.writeStartElement(xPathFragment.getLocalName());
      }
 else {
        String defaultNamespace=namespaceContext.getNamespaceURI(Constants.EMPTY_STRING);
        xmlStreamWriter.writeStartElement(Constants.EMPTY_STRING,xPathFragment.getLocalName(),Constants.EMPTY_STRING);
        if (defaultNamespace != null && defaultNamespace.length() > 0) {
          xmlStreamWriter.writeDefaultNamespace(Constants.EMPTY_STRING);
        }
      }
    }
 else {
      String prefix=getPrefixForFragment(xPathFragment);
      if (prefix == null) {
        prefix=Constants.EMPTY_STRING;
      }
      xmlStreamWriter.writeStartElement(prefix,xPathFragment.getLocalName(),namespaceURI);
    }
    writePrefixMappings();
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  try {
    String namespaceURI=xPathFragment.getNamespaceURI();
    if (namespaceURI == null) {
      NamespaceContext namespaceContext=xmlStreamWriter.getNamespaceContext();
      if (null == namespaceContext) {
        xmlStreamWriter.writeStartElement(xPathFragment.getLocalName());
      }
 else {
        String defaultNamespace=namespaceContext.getNamespaceURI(Constants.EMPTY_STRING);
        xmlStreamWriter.writeStartElement(Constants.EMPTY_STRING,xPathFragment.getLocalName(),Constants.EMPTY_STRING);
        if (defaultNamespace != null && defaultNamespace.length() > 0) {
          xmlStreamWriter.writeDefaultNamespace(Constants.EMPTY_STRING);
        }
      }
    }
 else {
      String prefix=getPrefixForFragment(xPathFragment);
      if (prefix == null) {
        prefix=Constants.EMPTY_STRING;
      }
      xmlStreamWriter.writeStartElement(prefix,xPathFragment.getLocalName(),namespaceURI);
      if (xPathFragment.isGeneratedPrefix()) {
        namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
      }
    }
    writePrefixMappings();
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63996
Project: 63996
Buggy source:
/** 
 * INTERNAL: This method is used to build the results. Interpreting the SQLResultSetMapping.
 */
protected List buildObjectsFromRecords(List databaseRecords,SQLResultSetMapping mapping){
  int numberOfRecords=databaseRecords.size();
  List results=new ArrayList(numberOfRecords);
  if (mapping == null) {
    for (Iterator iterator=databaseRecords.iterator(); iterator.hasNext(); ) {
      DatabaseRecord record=(DatabaseRecord)iterator.next();
      results.add(record.values().toArray());
    }
  }
 else {
    for (Iterator iterator=databaseRecords.iterator(); iterator.hasNext(); ) {
      if (mapping.getResults().size() > 1) {
        Object[] resultElement=new Object[mapping.getResults().size()];
        DatabaseRecord record=(DatabaseRecord)iterator.next();
        for (int i=0; i < mapping.getResults().size(); i++) {
          resultElement[i]=((SQLResult)mapping.getResults().get(i)).getValueFromRecord(record,this);
        }
        results.add(resultElement);
      }
 else       if (mapping.getResults().size() == 1) {
        DatabaseRecord record=(DatabaseRecord)iterator.next();
        results.add(((SQLResult)mapping.getResults().get(0)).getValueFromRecord(record,this));
      }
 else {
        return results;
      }
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * INTERNAL: This method is used to build the results. Interpreting the SQLResultSetMapping.
 */
protected List buildObjectsFromRecords(List databaseRecords,SQLResultSetMapping mapping){
  int numberOfRecords=databaseRecords.size();
  List results=new ArrayList(numberOfRecords);
  if (mapping == null) {
    if (shouldReturnNameValuePairs()) {
      return databaseRecords;
    }
    for (Iterator iterator=databaseRecords.iterator(); iterator.hasNext(); ) {
      DatabaseRecord record=(DatabaseRecord)iterator.next();
      results.add(record.values().toArray());
    }
  }
 else {
    for (Iterator iterator=databaseRecords.iterator(); iterator.hasNext(); ) {
      if (mapping.getResults().size() > 1) {
        Object[] resultElement=new Object[mapping.getResults().size()];
        DatabaseRecord record=(DatabaseRecord)iterator.next();
        for (int i=0; i < mapping.getResults().size(); i++) {
          resultElement[i]=((SQLResult)mapping.getResults().get(i)).getValueFromRecord(record,this);
        }
        results.add(resultElement);
      }
 else       if (mapping.getResults().size() == 1) {
        DatabaseRecord record=(DatabaseRecord)iterator.next();
        results.add(((SQLResult)mapping.getResults().get(0)).getValueFromRecord(record,this));
      }
 else {
        return results;
      }
    }
  }
  return results;
}
Program: 64000
Project: 64000
Buggy source:
/** 
 * PUBLIC: Returns if this should marshal to a fragment.  If true an XML header string is not written out.
 * @return if this should marshal to a fragment or not
 */
public boolean isFragment(){
  return mediaType.isApplicationXML() && fragment;
}

Fixed version (ground truth):
/** 
 * PUBLIC: Returns if this should marshal to a fragment.  If true an XML header string is not written out.
 * @return if this should marshal to a fragment or not
 */
public boolean isFragment(){
  return isApplicationXML() && fragment;
}
Program: 64001
Project: 64001
Buggy source:
/** 
 * Copy constructor
 */
protected XMLMarshaller(XMLMarshaller xmlMarshaller){
  super(xmlMarshaller);
  attachmentMarshaller=xmlMarshaller.getAttachmentMarshaller();
  attributePrefix=xmlMarshaller.getAttributePrefix();
  fragment=xmlMarshaller.isFragment();
  includeRoot=xmlMarshaller.isIncludeRoot();
  marshalEmptyCollections=xmlMarshaller.isMarshalEmptyCollections();
  mediaType=(MEDIA_TYPE)xmlMarshaller.getMediaType();
  namespaceSeparator=xmlMarshaller.getNamespaceSeparator();
  noNamespaceSchemaLocation=xmlMarshaller.getNoNamespaceSchemaLocation();
  reduceAnyArrays=xmlMarshaller.isReduceAnyArrays();
  if (null != xmlMarshaller.getSchema()) {
    setSchema(xmlMarshaller.getSchema());
  }
  schemaLocation=xmlMarshaller.getSchemaLocation();
  valueWrapper=xmlMarshaller.getValueWrapper();
  wrapperAsCollectionName=xmlMarshaller.isWrapperAsCollectionName();
  xmlHeader=xmlMarshaller.getXmlHeader();
}

Fixed version (ground truth):
/** 
 * Copy constructor
 */
protected XMLMarshaller(XMLMarshaller xmlMarshaller){
  super(xmlMarshaller);
  attachmentMarshaller=xmlMarshaller.getAttachmentMarshaller();
  attributePrefix=xmlMarshaller.getAttributePrefix();
  fragment=xmlMarshaller.isFragment();
  includeRoot=xmlMarshaller.isIncludeRoot();
  marshalEmptyCollections=xmlMarshaller.isMarshalEmptyCollections();
  mediaType=(MEDIA_TYPE)xmlMarshaller.mediaType;
  namespaceSeparator=xmlMarshaller.getNamespaceSeparator();
  noNamespaceSchemaLocation=xmlMarshaller.getNoNamespaceSchemaLocation();
  reduceAnyArrays=xmlMarshaller.isReduceAnyArrays();
  if (null != xmlMarshaller.getSchema()) {
    setSchema(xmlMarshaller.getSchema());
  }
  schemaLocation=xmlMarshaller.getSchemaLocation();
  valueWrapper=xmlMarshaller.getValueWrapper();
  wrapperAsCollectionName=xmlMarshaller.isWrapperAsCollectionName();
  xmlHeader=xmlMarshaller.getXmlHeader();
}
Program: 64003
Project: 64003
Buggy source:
/** 
 * Determine if the @XMLRootElement should be marshalled when present.   Ignored marshalling XML.   
 * @return
 * @since 2.4
 */
@Override public boolean isIncludeRoot(){
  if (mediaType.isApplicationJSON()) {
    return includeRoot;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determine if the @XMLRootElement should be marshalled when present.   Ignored marshalling XML.   
 * @return
 * @since 2.4
 */
@Override public boolean isIncludeRoot(){
  if (isApplicationJSON()) {
    return includeRoot;
  }
  return true;
}
Program: 64009
Project: 64009
Buggy source:
public void setXPathInObject(String uri,String localName,Object childObject){
  CoreAttributeAccessor variableAttributeAccessor=((VariableXPathObjectMapping)this.getMapping()).getVariableAttributeAccessor();
  if (!variableAttributeAccessor.isWriteOnly()) {
    Object value=null;
    if (((VariableXPathObjectMapping)getMapping()).getVariableAttributeAccessor().getAttributeClass() == ClassConstants.QNAME) {
      if (uri != null && uri.length() > 0) {
        value=new QName(uri,localName);
      }
 else {
        value=new QName(localName);
      }
    }
 else {
      value=localName;
    }
    variableAttributeAccessor.setAttributeValueInObject(childObject,value);
  }
}

Fixed version (ground truth):
public void setXPathInObject(String uri,String localName,Object childObject){
  CoreAttributeAccessor variableAttributeAccessor=((VariableXPathObjectMapping)this.getMapping()).getVariableAttributeAccessor();
  if (!variableAttributeAccessor.isWriteOnly()) {
    Object value=null;
    if (((VariableXPathObjectMapping)getMapping()).getVariableAttributeAccessor().getAttributeClass() == CoreClassConstants.QNAME) {
      if (uri != null && uri.length() > 0) {
        value=new QName(uri,localName);
      }
 else {
        value=new QName(localName);
      }
    }
 else {
      value=localName;
    }
    variableAttributeAccessor.setAttributeValueInObject(childObject,value);
  }
}
Program: 64010
Project: 64010
Buggy source:
public void setContainerPolicy(ContainerPolicy containerPolicy);

Fixed version (ground truth):
public void setContainerPolicy(CONTAINER_POLICY containerPolicy);
Program: 64011
Project: 64011
Buggy source:
public void setVariableAttributeAccessor(AttributeAccessor variableAttributeAccessor);

Fixed version (ground truth):
public void setVariableAttributeAccessor(ATTRIBUTE_ACCESSOR variableAttributeAccessor);
Program: 64012
Project: 64012
Buggy source:
public AttributeAccessor getVariableAttributeAccessor();

Fixed version (ground truth):
public ATTRIBUTE_ACCESSOR getVariableAttributeAccessor();
Program: 64014
Project: 64014
Buggy source:
public UnmappedContentHandlerWrapper(UnmappedContentHandler unmappedContentHandler,SAXUnmarshallerHandler saxUnmarshallerHandler){
  super(null);
  this.depth=0;
  this.unmappedContentHandler=unmappedContentHandler;
  setUnmarshaller((XMLUnmarshaller)saxUnmarshallerHandler.getUnmarshaller());
  setXMLReader(saxUnmarshallerHandler.getXMLReader());
  setUnmarshalNamespaceResolver(saxUnmarshallerHandler.getUnmarshalNamespaceResolver());
  unmappedContentHandler.setUnmarshalRecord(new org.eclipse.persistence.oxm.record.UnmarshalRecord(this));
}

Fixed version (ground truth):
public UnmappedContentHandlerWrapper(UnmappedContentHandler unmappedContentHandler,SAXUnmarshallerHandler saxUnmarshallerHandler){
  super(null);
  this.depth=0;
  this.unmappedContentHandler=unmappedContentHandler;
  setUnmarshaller(saxUnmarshallerHandler.getUnmarshaller());
  setXMLReader(saxUnmarshallerHandler.getXMLReader());
  setUnmarshalNamespaceResolver(saxUnmarshallerHandler.getUnmarshalNamespaceResolver());
  unmappedContentHandler.setUnmarshalRecord(new org.eclipse.persistence.oxm.record.UnmarshalRecord(this));
}
Program: 64016
Project: 64016
Buggy source:
public CoreAttributeGroup findGroup(ClassDescriptor type){
  if (this.type == null || this.type.equals(type.getJavaClass())) {
    return this;
  }
  if (this.hasInheritance()) {
    CoreAttributeGroup result=getSubClassGroups().get(type.getJavaClass());
    while (result == null && type.getInheritancePolicy().getParentDescriptor() != null) {
      type=type.getInheritancePolicy().getParentDescriptor();
      result=getSubClassGroups().get(type.getJavaClass());
    }
    if (result != null) {
      return result;
    }
  }
  return (CoreAttributeGroup)this;
}

Fixed version (ground truth):
public CoreAttributeGroup findGroup(DESCRIPTOR type){
  if (this.type == null || this.type.equals(type.getJavaClass())) {
    return this;
  }
  if (this.hasInheritance()) {
    CoreAttributeGroup result=getSubClassGroups().get(type.getJavaClass());
    while (result == null && type.getInheritancePolicy().getParentDescriptor() != null) {
      type=(DESCRIPTOR)type.getInheritancePolicy().getParentDescriptor();
      result=getSubClassGroups().get(type.getJavaClass());
    }
    if (result != null) {
      return result;
    }
  }
  return (CoreAttributeGroup)this;
}
Program: 64017
Project: 64017
Buggy source:
/** 
 * Locate the AttributeGroup where the leaf attribute in the path should be applied to.
 * @param create indicates if intermediate AttributeGroup required within the specified path should be created as needed. When checking the state of the map callers should set this to false to avoid changing the state unexpectedly
 */
protected ATTRIBUTE_ITEM getItem(String[] attributePath,boolean create){
  ATTRIBUTE_ITEM item=null;
  CoreAttributeGroup<ATTRIBUTE_ITEM> currentGroup=(CoreAttributeGroup)this;
  for (int index=0; index < attributePath.length; index++) {
    String attrName=attributePath[index];
    item=currentGroup.getItems().get(attrName);
    if (item == null) {
      if (!create) {
        if (this.superClassGroup != null) {
          return (ATTRIBUTE_ITEM)this.superClassGroup.getItem(attributePath,create);
        }
        return null;
      }
      item=(ATTRIBUTE_ITEM)newItem(currentGroup,attrName);
      currentGroup.getItems().put(attrName,item);
    }
    if (item.getGroup() == null && index < (attributePath.length - 1)) {
      if (!create) {
        return null;
      }
      CoreAttributeGroup newGroup=newGroup(attrName,currentGroup);
      item.setRootGroup(newGroup);
    }
    currentGroup=item.getGroup();
  }
  return item;
}

Fixed version (ground truth):
/** 
 * Locate the AttributeGroup where the leaf attribute in the path should be applied to.
 * @param create indicates if intermediate AttributeGroup required within the specified path should be created as needed. When checking the state of the map callers should set this to false to avoid changing the state unexpectedly
 */
protected ATTRIBUTE_ITEM getItem(String[] attributePath,boolean create){
  ATTRIBUTE_ITEM item=null;
  CoreAttributeGroup<ATTRIBUTE_ITEM,DESCRIPTOR> currentGroup=(CoreAttributeGroup)this;
  for (int index=0; index < attributePath.length; index++) {
    String attrName=attributePath[index];
    item=currentGroup.getItems().get(attrName);
    if (item == null) {
      if (!create) {
        if (this.superClassGroup != null) {
          return (ATTRIBUTE_ITEM)this.superClassGroup.getItem(attributePath,create);
        }
        return null;
      }
      item=(ATTRIBUTE_ITEM)newItem(currentGroup,attrName);
      currentGroup.getItems().put(attrName,item);
    }
    if (item.getGroup() == null && index < (attributePath.length - 1)) {
      if (!create) {
        return null;
      }
      CoreAttributeGroup newGroup=newGroup(attrName,currentGroup);
      item.setRootGroup(newGroup);
    }
    currentGroup=item.getGroup();
  }
  return item;
}
Program: 64019
Project: 64019
Buggy source:
/** 
 * INTERNAL: This method is used internally in the clone processing.
 * @param cloneMap
 * @return
 */
public CoreAttributeGroup clone(Map<CoreAttributeGroup<ATTRIBUTE_ITEM>,CoreAttributeGroup<ATTRIBUTE_ITEM>> cloneMap){
  CoreAttributeGroup clone=cloneMap.get(this);
  if (clone != null) {
    return clone;
  }
  try {
    clone=(CoreAttributeGroup)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    e.printStackTrace();
  }
  clone.name=this.name;
  clone.type=this.type;
  clone.typeName=this.typeName;
  clone.isValidated=this.isValidated;
  cloneMap.put(this,clone);
  if (this.allsubclasses != null) {
    for (    CoreAttributeGroup group : this.allsubclasses.values()) {
      clone.getSubClassGroups().put(group.getType(),group.clone(cloneMap));
    }
  }
  if (this.superClassGroup != null) {
    clone.superClassGroup=this.superClassGroup.clone(cloneMap);
  }
  if (this.subClasses != null) {
    clone.subClasses=new HashSet<CoreAttributeGroup>();
    for (    CoreAttributeGroup group : this.subClasses) {
      clone.subClasses.add(group.clone(cloneMap));
    }
  }
  clone.items=null;
  if (hasItems()) {
    clone.items=new HashMap<String,AttributeItem>();
    for (    ATTRIBUTE_ITEM item : this.items.values()) {
      clone.items.put(item.getAttributeName(),item.clone(cloneMap,clone));
    }
  }
  return clone;
}

Fixed version (ground truth):
/** 
 * INTERNAL: This method is used internally in the clone processing.
 * @param cloneMap
 * @return
 */
public CoreAttributeGroup clone(Map<CoreAttributeGroup<ATTRIBUTE_ITEM,DESCRIPTOR>,CoreAttributeGroup<ATTRIBUTE_ITEM,DESCRIPTOR>> cloneMap){
  CoreAttributeGroup clone=cloneMap.get(this);
  if (clone != null) {
    return clone;
  }
  try {
    clone=(CoreAttributeGroup)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    e.printStackTrace();
  }
  clone.name=this.name;
  clone.type=this.type;
  clone.typeName=this.typeName;
  clone.isValidated=this.isValidated;
  cloneMap.put(this,clone);
  if (this.allsubclasses != null) {
    for (    CoreAttributeGroup group : this.allsubclasses.values()) {
      clone.getSubClassGroups().put(group.getType(),group.clone(cloneMap));
    }
  }
  if (this.superClassGroup != null) {
    clone.superClassGroup=this.superClassGroup.clone(cloneMap);
  }
  if (this.subClasses != null) {
    clone.subClasses=new HashSet<CoreAttributeGroup>();
    for (    CoreAttributeGroup group : this.subClasses) {
      clone.subClasses.add(group.clone(cloneMap));
    }
  }
  clone.items=null;
  if (hasItems()) {
    clone.items=new HashMap<String,ATTRIBUTE_ITEM>();
    for (    ATTRIBUTE_ITEM item : this.items.values()) {
      clone.items.put(item.getAttributeName(),item.clone(cloneMap,clone));
    }
  }
  return clone;
}
Program: 64020
Project: 64020
Buggy source:
/** 
 * Subclass may create different types.
 */
protected CoreAttributeGroup newGroup(String name,CoreAttributeGroup parent){
  return new CoreAttributeGroup<CoreAttributeItem>(name);
}

Fixed version (ground truth):
/** 
 * Subclass may create different types.
 */
protected CoreAttributeGroup newGroup(String name,CoreAttributeGroup parent){
  return new CoreAttributeGroup<ATTRIBUTE_ITEM,DESCRIPTOR>(name);
}
Program: 64022
Project: 64022
Buggy source:
public void addSubGroup(ATTRIBUTE_GROUP group){
  if (group != null) {
    if (this.subGroups == null) {
      this.subGroups=new HashMap<Object,ATTRIBUTE_GROUP>();
    }
    if (this.group == null) {
      this.group=group;
    }
    Object type=group.getType();
    if (type == null) {
      type=group.getTypeName();
    }
    if (type == null) {
      type=ClassConstants.Object_Class;
      if (this.subGroups.containsKey(type)) {
        throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str"));
      }
    }
    this.subGroups.put(type,group);
    if (orderInheritance(group,this.subGroups)) {
      group.insertSubClass(this.group);
      this.group=group;
    }
  }
}

Fixed version (ground truth):
public void addSubGroup(ATTRIBUTE_GROUP group){
  if (group != null) {
    if (this.subGroups == null) {
      this.subGroups=new HashMap<Object,ATTRIBUTE_GROUP>();
    }
    if (this.group == null) {
      this.group=group;
    }
    Object type=group.getType();
    if (type == null) {
      type=group.getTypeName();
    }
    if (type == null) {
      type=CoreClassConstants.OBJECT;
      if (this.subGroups.containsKey(type)) {
        throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str"));
      }
    }
    this.subGroups.put(type,group);
    if (orderInheritance(group,this.subGroups)) {
      group.insertSubClass(this.group);
      this.group=group;
    }
  }
}
Program: 64023
Project: 64023
Buggy source:
/** 
 * Will order the subGroups based on hierarchy.  Returns true if the group is the new root.
 * @param group
 * @param subGroups
 * @return true if the group is the new root.
 */
protected static boolean orderInheritance(CoreAttributeGroup group,Map<Object,? extends CoreAttributeGroup> subGroups){
  Class type=group.getType();
  if (type != null) {
    CoreAttributeGroup superClass=null;
    while (!type.equals(ClassConstants.Object_Class) && superClass == null) {
      type=type.getSuperclass();
      superClass=subGroups.get(type);
    }
    if (superClass != null) {
      superClass.insertSubClass(group);
    }
 else {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Will order the subGroups based on hierarchy.  Returns true if the group is the new root.
 * @param group
 * @param subGroups
 * @return true if the group is the new root.
 */
protected static boolean orderInheritance(CoreAttributeGroup group,Map<Object,? extends CoreAttributeGroup> subGroups){
  Class type=group.getType();
  if (type != null) {
    CoreAttributeGroup superClass=null;
    while (!type.equals(CoreClassConstants.OBJECT) && superClass == null) {
      type=type.getSuperclass();
      superClass=subGroups.get(type);
    }
    if (superClass != null) {
      superClass.insertSubClass(group);
    }
 else {
      return true;
    }
  }
  return false;
}
Program: 64024
Project: 64024
Buggy source:
public ATTRIBUTE_GROUP getKeyGroup(Class type){
  if (this.keyGroups == null || type == null) {
    return null;
  }
  ATTRIBUTE_GROUP result=this.keyGroups.get(type);
  while (result == null && !type.equals(ClassConstants.Object_Class)) {
    type=type.getSuperclass();
    if (type == null) {
      throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str",new Object[]{type,this.attributeName}));
    }
    result=this.keyGroups.get(type);
  }
  return result;
}

Fixed version (ground truth):
public ATTRIBUTE_GROUP getKeyGroup(Class type){
  if (this.keyGroups == null || type == null) {
    return null;
  }
  ATTRIBUTE_GROUP result=this.keyGroups.get(type);
  while (result == null && !type.equals(CoreClassConstants.OBJECT)) {
    type=type.getSuperclass();
    if (type == null) {
      throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str",new Object[]{type,this.attributeName}));
    }
    result=this.keyGroups.get(type);
  }
  return result;
}
Program: 64025
Project: 64025
Buggy source:
public ATTRIBUTE_GROUP getGroup(Class type){
  if (this.subGroups == null || type == null) {
    return null;
  }
  ATTRIBUTE_GROUP result=this.subGroups.get(type);
  while (result == null && !type.equals(ClassConstants.Object_Class)) {
    type=type.getSuperclass();
    if (type == null) {
      throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str",new Object[]{type,this.attributeName}));
    }
    result=this.subGroups.get(type);
  }
  return result;
}

Fixed version (ground truth):
public ATTRIBUTE_GROUP getGroup(Class type){
  if (this.subGroups == null || type == null) {
    return null;
  }
  ATTRIBUTE_GROUP result=this.subGroups.get(type);
  while (result == null && !type.equals(CoreClassConstants.OBJECT)) {
    type=type.getSuperclass();
    if (type == null) {
      throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str",new Object[]{type,this.attributeName}));
    }
    result=this.subGroups.get(type);
  }
  return result;
}
Program: 64026
Project: 64026
Buggy source:
public void addKeyGroup(ATTRIBUTE_GROUP keyGroup){
  if (keyGroup != null) {
    if (this.keyGroups == null) {
      this.keyGroups=new HashMap<Object,ATTRIBUTE_GROUP>();
    }
    if (this.keyGroup == null) {
      this.keyGroup=keyGroup;
    }
    Object type=keyGroup.getType();
    if (type == null) {
      type=keyGroup.getTypeName();
    }
    if (type == null) {
      type=ClassConstants.Object_Class;
      if (this.keyGroups.containsKey(type)) {
        throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str"));
      }
    }
    this.keyGroups.put(type,keyGroup);
    if (orderInheritance(keyGroup,this.keyGroups)) {
      keyGroup.insertSubClass(this.keyGroup);
      this.keyGroup=keyGroup;
    }
  }
}

Fixed version (ground truth):
public void addKeyGroup(ATTRIBUTE_GROUP keyGroup){
  if (keyGroup != null) {
    if (this.keyGroups == null) {
      this.keyGroups=new HashMap<Object,ATTRIBUTE_GROUP>();
    }
    if (this.keyGroup == null) {
      this.keyGroup=keyGroup;
    }
    Object type=keyGroup.getType();
    if (type == null) {
      type=keyGroup.getTypeName();
    }
    if (type == null) {
      type=CoreClassConstants.OBJECT;
      if (this.keyGroups.containsKey(type)) {
        throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str"));
      }
    }
    this.keyGroups.put(type,keyGroup);
    if (orderInheritance(keyGroup,this.keyGroups)) {
      keyGroup.insertSubClass(this.keyGroup);
      this.keyGroup=keyGroup;
    }
  }
}
Program: 64028
Project: 64028
Buggy source:
public void testIsolationBeforeEarlyTxBegin(){
  EntityManager em=createDSEntityManager();
  beginTransaction(em);
  int cfeID=0;
  try {
    CacheableForceProtectedEntity cte=em.find(CacheableForceProtectedEntity.class,m_cacheableForceProtectedEntity1Id);
    ServerSession session=em.unwrap(ServerSession.class);
    CacheableProtectedEntity cfe=new CacheableProtectedEntity();
    em.persist(cfe);
    cfeID=cfe.getId();
    cfe.setForcedProtected(cte);
    cte.getCacheableProtecteds().add(cfe);
    em.flush();
    CacheableRelationshipsEntity cre=em.find(CacheableRelationshipsEntity.class,m_cacheableRelationshipsEntityId);
    CacheableRelationshipsEntity cachedCRE=(CacheableRelationshipsEntity)session.getIdentityMapAccessor().getFromIdentityMap(cre);
    assertTrue("String_Node_Str",cachedCRE.getCacheableFalses() == null || cachedCRE.getCacheableFalses().isEmpty());
    commitTransaction(em);
    beginTransaction(em);
    cte.getCacheableProtecteds().clear();
    cfe.setForcedProtected(null);
    cfe=em.find(CacheableProtectedEntity.class,cfeID);
    em.remove(cfe);
    commitTransaction(em);
  }
  finally {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEM(em);
  }
}

Fixed version (ground truth):
public void testIsolationBeforeEarlyTxBegin(){
  EntityManager em=createDSEntityManager();
  beginTransaction(em);
  int cfeID=0;
  try {
    CacheableForceProtectedEntity cte=em.find(CacheableForceProtectedEntity.class,m_cacheableForceProtectedEntity1Id);
    ServerSession session=em.unwrap(ServerSession.class);
    CacheableProtectedEntity cfe=new CacheableProtectedEntity();
    em.persist(cfe);
    cfeID=cfe.getId();
    cfe.setForcedProtected(cte);
    cte.getCacheableProtecteds().add(cfe);
    commitTransaction(em);
    CacheableRelationshipsEntity cre=em.find(CacheableRelationshipsEntity.class,m_cacheableRelationshipsEntityId);
    assertNotNull("String_Node_Str",cre);
    CacheableRelationshipsEntity cachedCRE=(CacheableRelationshipsEntity)session.getIdentityMapAccessor().getFromIdentityMap(cre);
    assertNotNull("String_Node_Str",cachedCRE);
    assertTrue("String_Node_Str",cachedCRE.getCacheableFalses() == null || cachedCRE.getCacheableFalses().isEmpty());
  }
  finally {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    try {
      beginTransaction(em);
      CacheableForceProtectedEntity cte=em.find(CacheableForceProtectedEntity.class,m_cacheableForceProtectedEntity1Id);
      CacheableProtectedEntity cfe=em.find(CacheableProtectedEntity.class,cfeID);
      cte.getCacheableProtecteds().clear();
      cfe.setForcedProtected(null);
      em.remove(cfe);
      commitTransaction(em);
    }
 catch (    Exception e) {
      if (isTransactionActive(em)) {
        rollbackTransaction(em);
      }
    }
    closeEM(em);
  }
}
Program: 64031
Project: 64031
Buggy source:
public void testElementCollection(){
  EntityManager em=createEntityManager();
  Query query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  List args=new ArrayList();
  args.add(0);
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.setParameter("String_Node_Str","String_Node_Str");
  query.setParameter("String_Node_Str",0);
  query.getResultList();
  closeEntityManager(em);
}

Fixed version (ground truth):
public void testElementCollection(){
  EntityManager em=createEntityManager();
  Query query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  List args=new ArrayList();
  args.add(0);
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.setParameter("String_Node_Str","String_Node_Str");
  query.setParameter("String_Node_Str",0);
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.setParameter("String_Node_Str","String_Node_Str");
  query.setParameter("String_Node_Str",20);
  query.getResultList();
  closeEntityManager(em);
}
Program: 64032
Project: 64032
Buggy source:
public void testMarshallerCharacterEscapeHandler() throws Exception {
  String SUN_CHARACTER_ESCAPE_HANDLER="String_Node_Str";
  String SUN_JSE_CHARACTER_ESCAPE_HANDLER="String_Node_Str";
  CharacterEscapeHandler handler=new CustomCharacterEscapeHandler();
  m.setProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER,handler);
  assertEquals(handler,m.getProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER));
  m.setProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER,null);
  assertNull(m.getProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER));
  m.setProperty(SUN_CHARACTER_ESCAPE_HANDLER,handler);
  assertEquals(handler,m.getProperty(SUN_CHARACTER_ESCAPE_HANDLER));
  m.setProperty(SUN_CHARACTER_ESCAPE_HANDLER,null);
  assertNull(m.getProperty(SUN_CHARACTER_ESCAPE_HANDLER));
  m.setProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER,handler);
  assertEquals(handler,m.getProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER));
  m.setProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER,null);
  assertNull(m.getProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER));
}

Fixed version (ground truth):
public void testMarshallerCharacterEscapeHandler() throws Exception {
  String SUN_CHARACTER_ESCAPE_HANDLER_MARSHALLER="String_Node_Str";
  String SUN_JSE_CHARACTER_ESCAPE_HANDLER_MARSHALLER="String_Node_Str";
  CharacterEscapeHandler handler=new CustomCharacterEscapeHandler();
  m.setProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER,handler);
  assertEquals(handler,m.getProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER));
  m.setProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER,null);
  assertNull(m.getProperty(MarshallerProperties.CHARACTER_ESCAPE_HANDLER));
  m.setProperty(SUN_CHARACTER_ESCAPE_HANDLER_MARSHALLER,handler);
  assertEquals(handler,m.getProperty(SUN_CHARACTER_ESCAPE_HANDLER_MARSHALLER));
  m.setProperty(SUN_CHARACTER_ESCAPE_HANDLER_MARSHALLER,null);
  assertNull(m.getProperty(SUN_CHARACTER_ESCAPE_HANDLER_MARSHALLER));
  m.setProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER_MARSHALLER,handler);
  assertEquals(handler,m.getProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER_MARSHALLER));
  m.setProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER_MARSHALLER,null);
  assertNull(m.getProperty(SUN_JSE_CHARACTER_ESCAPE_HANDLER_MARSHALLER));
}
Program: 64035
Project: 64035
Buggy source:
/** 
 * Test a simple procedure.
 */
public void testSimpleProcedure(){
  if (!getServerSession().getPlatform().isOracle()) {
    return;
  }
  EntityManager em=createEntityManager();
  beginTransaction(em);
  try {
    Query query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str","String_Node_Str");
    query.getSingleResult();
    query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str",true);
    query.getSingleResult();
    query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str","String_Node_Str");
    query.setParameter("String_Node_Str",true);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.getSingleResult();
    query.getSingleResult();
    query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str",true);
    query.getSingleResult();
  }
  finally {
    closeEntityManagerAndTransaction(em);
  }
}

Fixed version (ground truth):
/** 
 * Test a simple procedure.
 */
public void testSimpleProcedure(){
  if (!getServerSession().getPlatform().isOracle()) {
    return;
  }
  EntityManager em=createEntityManager();
  beginTransaction(em);
  try {
    Query query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str","String_Node_Str");
    query.executeUpdate();
    query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str",true);
    query.executeUpdate();
    query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str","String_Node_Str");
    query.setParameter("String_Node_Str",true);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.setParameter("String_Node_Str",1);
    query.executeUpdate();
    query.executeUpdate();
    query=em.createNamedQuery("String_Node_Str");
    query.setParameter("String_Node_Str",true);
    query.executeUpdate();
  }
  finally {
    closeEntityManagerAndTransaction(em);
  }
}
Program: 64037
Project: 64037
Buggy source:
/** 
 * INTERNAL: MappedSuperclasses need special handling to get their type from an inheriting subclass. This function determines the type for an attribute by returning the same inherited attribute from a subclass
 * @param name
 * @return
 */
public AttributeImpl getMemberFromInheritingType(String name){
  AttributeImpl inheritedAttribute=null;
  for (  IdentifiableTypeImpl inheritingType : inheritingIdentifiableTypes.values()) {
    if (inheritingType.getMembers().containsKey(name)) {
      inheritedAttribute=(AttributeImpl)inheritingType.getAttribute(name);
      break;
    }
  }
  return inheritedAttribute;
}

Fixed version (ground truth):
/** 
 * INTERNAL: MappedSuperclasses need special handling to get their type from an inheriting subclass. This function determines the type for an attribute by returning the same inherited attribute from a subclass
 * @param name
 * @return
 */
public AttributeImpl getMemberFromInheritingType(String name){
  AttributeImpl inheritedAttribute=null;
  for (  IdentifiableTypeImpl inheritingType : inheritingIdentifiableTypes.values()) {
    Map inheritingTypeMembers=inheritingType.getMembers();
    if ((null == inheritingTypeMembers) && inheritingType.isMappedSuperclass()) {
      ((ManagedTypeImpl)inheritingType).initialize();
      inheritingTypeMembers=inheritingType.getMembers();
    }
    if (inheritingTypeMembers.containsKey(name)) {
      inheritedAttribute=(AttributeImpl)inheritingType.getAttribute(name);
      break;
    }
  }
  return inheritedAttribute;
}
Program: 64039
Project: 64039
Buggy source:
/** 
 * Rest named single result query.
 * @param queryName the query name
 * @param returnType the return type
 * @param persistenceUnit the persistence unit
 * @param parameters the parameters
 * @param hints the hints
 * @param outputMediaType the output media type
 * @return the object
 * @throws URISyntaxException the uRI syntax exception
 */
public static String restNamedSingleResultQuery(String queryName,String persistenceUnit,Map<String,Object> parameters,Map<String,String> hints,MediaType outputMediaType) throws URISyntaxException {
  StringBuilder resourceURL=new StringBuilder();
  resourceURL.append(RestUtils.getServerURI() + persistenceUnit + "String_Node_Str"+ queryName);
  RestUtils.appendParametersAndHints(resourceURL,parameters,hints);
  WebResource webResource=client.resource(resourceURL.toString());
  ClientResponse response=webResource.accept(outputMediaType).get(ClientResponse.class);
  Status status=response.getClientResponseStatus();
  if (status != Status.OK) {
    throw new RestCallFailedException(status);
  }
  return response.getEntity(String.class);
}

Fixed version (ground truth):
/** 
 * Rest named single result query.
 * @param queryName the query name
 * @param persistenceUnit the persistence unit
 * @param parameters the parameters
 * @param hints the hints
 * @param outputMediaType the output media type
 * @return the object
 * @throws URISyntaxException the uRI syntax exception
 */
public static String restNamedSingleResultQuery(String queryName,String persistenceUnit,Map<String,Object> parameters,Map<String,String> hints,MediaType outputMediaType) throws URISyntaxException {
  StringBuilder resourceURL=new StringBuilder();
  resourceURL.append(RestUtils.getServerURI() + persistenceUnit + "String_Node_Str"+ queryName);
  RestUtils.appendParametersAndHints(resourceURL,parameters,hints);
  WebResource webResource=client.resource(resourceURL.toString());
  ClientResponse response=webResource.accept(outputMediaType).get(ClientResponse.class);
  Status status=response.getClientResponseStatus();
  if (status != Status.OK) {
    throw new RestCallFailedException(status);
  }
  return response.getEntity(String.class);
}
Program: 64040
Project: 64040
Buggy source:
private static void appendParametersAndHints(StringBuilder resourceURL,Map<String,Object> parameters,Map<String,String> hints){
  if (parameters != null && !parameters.isEmpty()) {
    for (    String key : parameters.keySet()) {
      resourceURL.append("String_Node_Str" + key + "String_Node_Str"+ parameters.get(key));
    }
  }
  if (hints != null && !hints.isEmpty()) {
    boolean firstElement=true;
    for (    String key : hints.keySet()) {
      if (firstElement) {
        resourceURL.append("String_Node_Str");
      }
 else {
        resourceURL.append("String_Node_Str");
      }
      resourceURL.append(key + "String_Node_Str" + hints.get(key));
    }
  }
}

Fixed version (ground truth):
private static void appendParametersAndHints(StringBuilder resourceURL,Map<String,Object> parameters,Map<String,String> hints){
  if (parameters != null && !parameters.isEmpty()) {
    for (    String key : parameters.keySet()) {
      resourceURL.append("String_Node_Str" + key + "String_Node_Str"+ parameters.get(key));
    }
  }
  if (hints != null && !hints.isEmpty()) {
    boolean firstElement=true;
    for (    String key : hints.keySet()) {
      if (firstElement) {
        resourceURL.append("String_Node_Str");
        firstElement=false;
      }
 else {
        resourceURL.append("String_Node_Str");
      }
      resourceURL.append(key + "String_Node_Str" + hints.get(key));
    }
  }
}
Program: 64041
Project: 64041
Buggy source:
@SuppressWarnings("String_Node_Str") public static <T>T restCreate(PersistenceContext context,String object,String type,Class<T> resultClass,String persistenceUnit,Map<String,String> tenantId,MediaType mediaType) throws URISyntaxException {
  StringBuilder uri=new StringBuilder();
  uri.append(RestUtils.getServerURI() + persistenceUnit);
  if (tenantId != null) {
    for (    String key : tenantId.keySet()) {
      uri.append("String_Node_Str" + key + "String_Node_Str"+ tenantId.get(key));
    }
  }
  uri.append("String_Node_Str" + type);
  WebResource webResource=client.resource(uri.toString());
  ClientResponse response=webResource.type(mediaType).accept(mediaType).put(ClientResponse.class,object.toString());
  Status status=response.getClientResponseStatus();
  if (status != Status.CREATED) {
    throw new RestCallFailedException(status);
  }
  String result=response.getEntity(String.class);
  T resultObject=null;
  try {
    resultObject=(T)context.unmarshalEntity(type,mediaType,new ByteArrayInputStream(result.getBytes()));
  }
 catch (  JAXBException e) {
    fail("String_Node_Str" + e);
  }
  return resultObject;
}

Fixed version (ground truth):
/** 
 * Rest create.
 * @param < T > the generic type
 * @param context the context
 * @param object the object
 * @param type the type
 * @param resultClass the result class
 * @param persistenceUnit the persistence unit
 * @param tenantId the tenant id
 * @param mediaType the media type
 * @return the t
 * @throws URISyntaxException the uRI syntax exception
 */
@SuppressWarnings("String_Node_Str") public static <T>T restCreate(PersistenceContext context,String object,String type,Class<T> resultClass,String persistenceUnit,Map<String,String> tenantId,MediaType mediaType) throws URISyntaxException {
  StringBuilder uri=new StringBuilder();
  uri.append(RestUtils.getServerURI() + persistenceUnit);
  if (tenantId != null) {
    for (    String key : tenantId.keySet()) {
      uri.append("String_Node_Str" + key + "String_Node_Str"+ tenantId.get(key));
    }
  }
  uri.append("String_Node_Str" + type);
  WebResource webResource=client.resource(uri.toString());
  ClientResponse response=webResource.type(mediaType).accept(mediaType).put(ClientResponse.class,object.toString());
  Status status=response.getClientResponseStatus();
  if (status != Status.CREATED) {
    throw new RestCallFailedException(status);
  }
  String result=response.getEntity(String.class);
  T resultObject=null;
  try {
    resultObject=(T)context.unmarshalEntity(type,mediaType,new ByteArrayInputStream(result.getBytes()));
  }
 catch (  JAXBException e) {
    fail("String_Node_Str" + e);
  }
  return resultObject;
}
Program: 64042
Project: 64042
Buggy source:
/** 
 * Rest update query.
 * @param queryName the query name
 * @param returnType the return type
 * @param persistenceUnit the persistence unit
 * @param parameters the parameters
 * @param hints the hints
 * @return the object
 * @throws URISyntaxException the uRI syntax exception
 */
public static String restUpdateQuery(String queryName,String persistenceUnit,Map<String,Object> parameters,Map<String,String> hints,MediaType mediaType) throws URISyntaxException {
  StringBuilder resourceURL=new StringBuilder();
  resourceURL.append(RestUtils.getServerURI() + persistenceUnit + "String_Node_Str"+ queryName);
  RestUtils.appendParametersAndHints(resourceURL,parameters,hints);
  WebResource webResource=client.resource(resourceURL.toString());
  ClientResponse response=webResource.accept(mediaType).post(ClientResponse.class);
  Status status=response.getClientResponseStatus();
  if (status != Status.OK) {
    throw new RestCallFailedException(status);
  }
  return response.getEntity(String.class);
}

Fixed version (ground truth):
/** 
 * Rest update query.
 * @param queryName the query name
 * @param persistenceUnit the persistence unit
 * @param parameters the parameters
 * @param hints the hints
 * @param mediaType the media type
 * @return the object
 * @throws URISyntaxException the uRI syntax exception
 */
public static String restUpdateQuery(String queryName,String persistenceUnit,Map<String,Object> parameters,Map<String,String> hints,MediaType mediaType) throws URISyntaxException {
  StringBuilder resourceURL=new StringBuilder();
  resourceURL.append(RestUtils.getServerURI() + persistenceUnit + "String_Node_Str"+ queryName);
  RestUtils.appendParametersAndHints(resourceURL,parameters,hints);
  WebResource webResource=client.resource(resourceURL.toString());
  ClientResponse response=webResource.accept(mediaType).post(ClientResponse.class);
  Status status=response.getClientResponseStatus();
  if (status != Status.OK) {
    throw new RestCallFailedException(status);
  }
  return response.getEntity(String.class);
}