nus-yam/ex-repair huggingface dataset:
Program: 66573
Project: 66573
Buggy source:
/** 
 * INTERNAL: Check that the qualifier on the table names are properly set.
 */
protected void verifyTableQualifiers(Platform platform){
  DatabaseTable table;
  Enumeration tableEnumeration;
  String tableQualifier=platform.getTableQualifier();
  if (tableQualifier.length() == 0) {
    return;
  }
  tableEnumeration=getTables().elements();
  while (tableEnumeration.hasMoreElements()) {
    table=(DatabaseTable)tableEnumeration.nextElement();
    if (table.getTableQualifier().length() == 0) {
      table.setTableQualifier(tableQualifier);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Check that the qualifier on the table names are properly set.
 */
protected void verifyTableQualifiers(Platform platform){
  String tableQualifier=platform.getTableQualifier();
  if (tableQualifier.length() == 0) {
    return;
  }
  for (  DatabaseTable table : getTables()) {
    if (table.getTableQualifier().length() == 0) {
      table.setTableQualifier(tableQualifier);
    }
  }
}
Program: 66574
Project: 66574
Buggy source:
/** 
 * INTERNAL: Validate the entire post-initialization descriptor.
 */
protected void validateAfterInitialization(AbstractSession session){
  selfValidationAfterInitialization(session);
  for (Enumeration mappings=getMappings().elements(); mappings.hasMoreElements(); ) {
    ((DatabaseMapping)mappings.nextElement()).validateAfterInitialization(session);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Validate the entire post-initialization descriptor.
 */
protected void validateAfterInitialization(AbstractSession session){
  selfValidationAfterInitialization(session);
  for (  DatabaseMapping mapping : getMappings()) {
    mapping.validateAfterInitialization(session);
  }
}
Program: 66577
Project: 66577
Buggy source:
/** 
 * INTERNAL: Validate the entire pre-initialization descriptor.
 */
protected void validateBeforeInitialization(AbstractSession session){
  selfValidationBeforeInitialization(session);
  for (Enumeration mappings=getMappings().elements(); mappings.hasMoreElements(); ) {
    ((DatabaseMapping)mappings.nextElement()).validateBeforeInitialization(session);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Validate the entire pre-initialization descriptor.
 */
protected void validateBeforeInitialization(AbstractSession session){
  selfValidationBeforeInitialization(session);
  for (  DatabaseMapping mapping : getMappings()) {
    mapping.validateBeforeInitialization(session);
  }
}
Program: 66578
Project: 66578
Buggy source:
public static DescriptorException noRelationTableMechanism(DatabaseMapping mapping){
  Object[] args={};
  DescriptorException descriptorException=new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class,NO_RELATION_TABLE_MECHANISM,args),mapping);
  descriptorException.setErrorCode(NO_RELATION_TABLE_MECHANISM);
  return descriptorException;
}

Fixed version (ground truth):
public static DescriptorException noRelationTableMechanism(DatabaseMapping mapping){
  Object[] args={mapping};
  DescriptorException descriptorException=new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class,NO_RELATION_TABLE_MECHANISM,args),mapping);
  descriptorException.setErrorCode(NO_RELATION_TABLE_MECHANISM);
  return descriptorException;
}
Program: 66580
Project: 66580
Buggy source:
/** 
 * Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches.
 */
public void putQueryResult(ReadQuery query,Vector parameters,Object results){
  Object queryKey=query.getName();
  if ((queryKey == null) || ((String)queryKey).length() == 0) {
    queryKey=query;
  }
  IdentityMap map=this.queryResults.get(queryKey);
  if (map == null) {
synchronized (this.queryResults) {
      map=this.queryResults.get(queryKey);
      if (map == null) {
        map=buildNewIdentityMap(query.getQueryResultsCachePolicy().getCacheType(),query.getQueryResultsCachePolicy().getMaximumCachedResults(),null);
        this.queryResults.put(queryKey,map);
      }
    }
  }
  Object lookupParameters;
  if (parameters == null) {
    lookupParameters=new CacheId(new Object[0]);
  }
 else {
    lookupParameters=new CacheId(parameters.toArray());
  }
  long queryTime=0;
  if (query.isObjectLevelReadQuery()) {
    queryTime=((ObjectLevelReadQuery)query).getExecutionTime();
  }
  if (queryTime == 0) {
    queryTime=System.currentTimeMillis();
  }
  if (results == null) {
    if (query.getQueryResultsCachePolicy().isNullIgnored()) {
      return;
    }
    results=InvalidObject.instance();
  }
  map.put(lookupParameters,results,null,queryTime);
}

Fixed version (ground truth):
/** 
 * Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches.
 */
public void putQueryResult(ReadQuery query,List parameters,Object results){
  if ((results == null) || (results == InvalidObject.instance())) {
    if (query.getQueryResultsCachePolicy().isNullIgnored()) {
      return;
    }
  }
  Object queryKey=query.getName();
  if ((queryKey == null) || ((String)queryKey).length() == 0) {
    queryKey=query;
  }
  IdentityMap map=this.queryResults.get(queryKey);
  if (map == null) {
synchronized (this.queryResults) {
      map=this.queryResults.get(queryKey);
      if (map == null) {
        map=buildNewIdentityMap(query.getQueryResultsCachePolicy().getCacheType(),query.getQueryResultsCachePolicy().getMaximumCachedResults(),null);
        this.queryResults.put(queryKey,map);
      }
    }
  }
  Object lookupParameters;
  if (parameters == null) {
    lookupParameters=new CacheId(new Object[0]);
  }
 else {
    lookupParameters=new CacheId(parameters.toArray());
  }
  long queryTime=0;
  if (query.isObjectLevelReadQuery()) {
    queryTime=((ObjectLevelReadQuery)query).getExecutionTime();
  }
  if (queryTime == 0) {
    queryTime=System.currentTimeMillis();
  }
  if (results == null) {
    results=InvalidObject.instance();
  }
  map.put(lookupParameters,results,null,queryTime);
}
Program: 66581
Project: 66581
Buggy source:
/** 
 * Get the cached results associated with a query.  Results are cached by the values of the parameters to the query so different parameters will have different cached results.
 */
public Object getQueryResult(ReadQuery query,Vector parameters,boolean shouldCheckExpiry){
  if (query.getQueryResultsCachePolicy() == null) {
    return null;
  }
  Object queryKey=query.getName();
  if ((queryKey == null) || ((String)queryKey).length() == 0) {
    queryKey=query;
  }
  IdentityMap map=this.queryResults.get(queryKey);
  if (map == null) {
    return null;
  }
  Object lookupParameters;
  if (parameters == null) {
    lookupParameters=new CacheId(new Object[0]);
  }
 else {
    lookupParameters=new CacheId(parameters.toArray());
  }
  CacheKey key=map.getCacheKey(lookupParameters);
  if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) {
    return null;
  }
  return key.getObject();
}

Fixed version (ground truth):
/** 
 * Get the cached results associated with a query.  Results are cached by the values of the parameters to the query so different parameters will have different cached results.
 */
public Object getQueryResult(ReadQuery query,List parameters,boolean shouldCheckExpiry){
  if (query.getQueryResultsCachePolicy() == null) {
    return null;
  }
  Object queryKey=query.getName();
  if ((queryKey == null) || ((String)queryKey).length() == 0) {
    queryKey=query;
  }
  IdentityMap map=this.queryResults.get(queryKey);
  if (map == null) {
    return null;
  }
  Object lookupParameters;
  if (parameters == null) {
    lookupParameters=new CacheId(new Object[0]);
  }
 else {
    lookupParameters=new CacheId(parameters.toArray());
  }
  CacheKey key=map.getCacheKey(lookupParameters);
  if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) {
    return null;
  }
  return key.getObject();
}
Program: 66582
Project: 66582
Buggy source:
/** 
 * INTERNAL: Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches.
 */
public void putQueryResult(ReadQuery query,Vector parameters,Object results){
  getIdentityMapManager().putQueryResult(query,parameters,results);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches.
 */
public void putQueryResult(ReadQuery query,List parameters,Object results){
  getIdentityMapManager().putQueryResult(query,parameters,results);
}
Program: 66583
Project: 66583
Buggy source:
/** 
 * INTERNAL: Get the identity map for the given class from the IdentityMapManager
 */
public IdentityMap getIdentityMap(ClassDescriptor descriptor){
  return getIdentityMapManager().getIdentityMap(descriptor);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Get the identity map for the given class from the IdentityMapManager
 */
public IdentityMap getIdentityMap(ClassDescriptor descriptor,boolean returnNullIfMissing){
  return getIdentityMapManager().getIdentityMap(descriptor,returnNullIfMissing);
}
Program: 66584
Project: 66584
Buggy source:
/** 
 * INTERNAL: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state.
 */
public void validateCache(){
  getSession().log(SessionLog.FINER,SessionLog.CACHE,"String_Node_Str");
  DescriptorIterator iterator=new DescriptorIterator(){
    public void iterate(    Object object){
      if (!containsObjectInIdentityMap(IdentityMapAccessor.this.session.getDescriptor(object.getClass()).getObjectBuilder().extractPrimaryKeyFromObject(object,IdentityMapAccessor.this.getSession()),object.getClass())) {
        IdentityMapAccessor.this.session.log(SessionLog.FINEST,SessionLog.CACHE,"String_Node_Str",getVisitedStack());
        IdentityMapAccessor.this.session.log(SessionLog.FINER,SessionLog.CACHE,"String_Node_Str",getCurrentMapping());
        IdentityMapAccessor.this.session.log(SessionLog.FINER,SessionLog.CACHE,"String_Node_Str",object);
      }
    }
  }
;
  iterator.setSession(getSession());
  Iterator descriptors=getSession().getDescriptors().values().iterator();
  while (descriptors.hasNext()) {
    ClassDescriptor descriptor=(ClassDescriptor)descriptors.next();
    for (Enumeration mapEnum=getIdentityMap(descriptor).elements(); mapEnum.hasMoreElements(); ) {
      iterator.startIterationOn(mapEnum.nextElement());
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state.
 */
public void validateCache(){
  getSession().log(SessionLog.FINER,SessionLog.CACHE,"String_Node_Str");
  DescriptorIterator iterator=new DescriptorIterator(){
    public void iterate(    Object object){
      if (!containsObjectInIdentityMap(IdentityMapAccessor.this.session.getDescriptor(object.getClass()).getObjectBuilder().extractPrimaryKeyFromObject(object,IdentityMapAccessor.this.getSession()),object.getClass())) {
        IdentityMapAccessor.this.session.log(SessionLog.FINEST,SessionLog.CACHE,"String_Node_Str",getVisitedStack());
        IdentityMapAccessor.this.session.log(SessionLog.FINER,SessionLog.CACHE,"String_Node_Str",getCurrentMapping());
        IdentityMapAccessor.this.session.log(SessionLog.FINER,SessionLog.CACHE,"String_Node_Str",object);
      }
    }
  }
;
  iterator.setSession(getSession());
  Iterator descriptors=getSession().getDescriptors().values().iterator();
  while (descriptors.hasNext()) {
    ClassDescriptor descriptor=(ClassDescriptor)descriptors.next();
    IdentityMap cache=getIdentityMap(descriptor,true);
    if (cache != null) {
      for (Enumeration mapEnum=cache.elements(); mapEnum.hasMoreElements(); ) {
        iterator.startIterationOn(mapEnum.nextElement());
      }
    }
  }
}
Program: 66585
Project: 66585
Buggy source:
/** 
 * INTERNAL: Get the cached results associated with a query.  Results are cached by the values of the parameters to the query so different parameters will have different cached results.
 */
public Object getQueryResult(ReadQuery query,Vector parameters,boolean checkExpiry){
  return getIdentityMapManager().getQueryResult(query,parameters,checkExpiry);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Get the cached results associated with a query.  Results are cached by the values of the parameters to the query so different parameters will have different cached results.
 */
public Object getQueryResult(ReadQuery query,List parameters,boolean checkExpiry){
  return getIdentityMapManager().getQueryResult(query,parameters,checkExpiry);
}
Program: 66586
Project: 66586
Buggy source:
/** 
 * INTERNAL: Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches.
 */
@Override public void putQueryResult(ReadQuery query,Vector parameters,Object results){
  if (((IsolatedClientSession)session).isIsolatedQuery(query)) {
    getIdentityMapManager().putQueryResult(query,parameters,results);
  }
 else {
    ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().putQueryResult(query,parameters,results);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches.
 */
@Override public void putQueryResult(ReadQuery query,List parameters,Object results){
  if (((IsolatedClientSession)session).isIsolatedQuery(query)) {
    getIdentityMapManager().putQueryResult(query,parameters,results);
  }
 else {
    ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().putQueryResult(query,parameters,results);
  }
}
Program: 66587
Project: 66587
Buggy source:
/** 
 * INTERNAL: Get the identity map for the given class from the IdentityMapManager
 */
@Override public IdentityMap getIdentityMap(ClassDescriptor descriptor){
  if (descriptor.isIsolated()) {
    return getIdentityMapManager().getIdentityMap(descriptor);
  }
 else {
    return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getIdentityMap(descriptor);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Get the identity map for the given class from the IdentityMapManager
 */
@Override public IdentityMap getIdentityMap(ClassDescriptor descriptor,boolean returnNullIfMissing){
  if (descriptor.isIsolated()) {
    return getIdentityMapManager().getIdentityMap(descriptor,returnNullIfMissing);
  }
 else {
    return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getIdentityMap(descriptor,returnNullIfMissing);
  }
}
Program: 66588
Project: 66588
Buggy source:
/** 
 * INTERNAL: Get the cached results associated with a query.  Results are cached by the values of the parameters to the query so different parameters will have different cached results.
 */
@Override public Object getQueryResult(ReadQuery query,Vector parameters,boolean checkExpiry){
  if (((IsolatedClientSession)session).isIsolatedQuery(query)) {
    return getIdentityMapManager().getQueryResult(query,parameters,checkExpiry);
  }
 else {
    return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getQueryResult(query,parameters,checkExpiry);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Get the cached results associated with a query.  Results are cached by the values of the parameters to the query so different parameters will have different cached results.
 */
@Override public Object getQueryResult(ReadQuery query,List parameters,boolean checkExpiry){
  if (((IsolatedClientSession)session).isIsolatedQuery(query)) {
    return getIdentityMapManager().getQueryResult(query,parameters,checkExpiry);
  }
 else {
    return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getQueryResult(query,parameters,checkExpiry);
  }
}
Program: 66589
Project: 66589
Buggy source:
public JAXBUnmarshaller(XMLUnmarshaller newXMLUnmarshaller){
  super();
  validationEventHandler=new DefaultValidationEventHandler();
  xmlUnmarshaller=newXMLUnmarshaller;
  xmlUnmarshaller.setValidationMode(XMLUnmarshaller.NONVALIDATING);
  xmlUnmarshaller.setUnmarshalListener(new JAXBUnmarshalListener(this));
}

Fixed version (ground truth):
public JAXBUnmarshaller(XMLUnmarshaller newXMLUnmarshaller){
  super();
  validationEventHandler=new DefaultValidationEventHandler();
  xmlUnmarshaller=newXMLUnmarshaller;
  xmlUnmarshaller.setValidationMode(XMLUnmarshaller.NONVALIDATING);
  xmlUnmarshaller.setUnmarshalListener(new JAXBUnmarshalListener(this));
  try {
    xmlInputFactory=XMLInputFactory.newInstance();
  }
 catch (  FactoryConfigurationError e) {
  }
}
Program: 66591
Project: 66591
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        outputStream.write(CR);
      }
      for (int x=0; x < numberOfTabs; x++) {
        outputStream.write(TAB);
      }
    }
    isStartElementOpen=true;
    outputStream.write(OPEN_START_ELEMENT);
    outputStream.write(xPathFragment.getShortNameBytes());
    numberOfTabs++;
    isLastEventText=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(CR);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(xPathFragment.getShortNameBytes());
  numberOfTabs++;
  isLastEventText=false;
}
Program: 66592
Project: 66592
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    isLastEventText=false;
    numberOfTabs--;
    if (isStartElementOpen) {
      outputStream.write(CLOSE_EMPTY_ELEMENT);
      isStartElementOpen=false;
      complexType=true;
      return;
    }
    if (complexType) {
      outputStream.write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        outputStream.write(TAB);
      }
    }
 else {
      complexType=true;
    }
    super.endElement(namespaceURI,localName,qName);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  isLastEventText=false;
  numberOfTabs--;
  if (isStartElementOpen) {
    outputStreamWrite((byte)'/');
    outputStreamWrite((byte)'>');
    isStartElementOpen=false;
    complexType=true;
    return;
  }
  if (complexType) {
    outputStreamWrite(CR);
    outputStreamWriteTab();
  }
 else {
    complexType=true;
  }
  super.endElement(namespaceURI,localName,qName);
}
Program: 66593
Project: 66593
Buggy source:
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      outputStream.write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        outputStream.write(TAB);
      }
    }
    outputStream.write(OPEN_START_ELEMENT);
    outputStream.write(qName.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStreamWrite(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      outputStreamWrite(CR);
      outputStreamWriteTab();
    }
    outputStreamWrite(OPEN_START_ELEMENT);
    outputStreamWrite(qName.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  UnsupportedEncodingException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66594
Project: 66594
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      outputStream.write(CR);
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
    complexType=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void comment(char[] ch,int start,int length) throws SAXException {
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    outputStreamWrite(CR);
    isStartElementOpen=false;
  }
  writeComment(ch,start,length);
  complexType=false;
}
Program: 66595
Project: 66595
Buggy source:
/** 
 * INTERNAL:
 */
public void endDocument(){
  try {
    outputStream.write(CR);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endDocument(){
  outputStreamWrite(CR);
}
Program: 66596
Project: 66596
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  try {
    isLastEventText=false;
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    outputStream.write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      outputStream.write(TAB);
    }
    super.element(frag);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  isLastEventText=false;
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    isStartElementOpen=false;
  }
  outputStreamWrite(CR);
  outputStreamWriteTab();
  super.element(frag);
}
Program: 66597
Project: 66597
Buggy source:
/** 
 * INTERNAL:
 */
public void cdata(String value){
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    outputStream.write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      outputStream.write(TAB);
    }
    super.cdata(value);
    complexType=true;
  }
 catch (  IOException ex) {
    throw XMLMarshalException.marshalException(ex);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void cdata(String value){
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    isStartElementOpen=false;
  }
  outputStreamWrite(CR);
  outputStreamWriteTab();
  super.cdata(value);
  complexType=true;
}
Program: 66602
Project: 66602
Buggy source:
public void startDocument(XMLMapping selfRecordMapping) throws SAXException {
  try {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)treeObjectBuilder.getDescriptor();
    if (xmlDescriptor.isSequencedObject()) {
      unmarshalContext=new SequencedUnmarshalContext();
    }
 else {
      unmarshalContext=ObjectUnmarshalContext.getInstance();
    }
    Object object=this.xmlReader.getCurrentObject(session,selfRecordMapping);
    if (object == null) {
      object=treeObjectBuilder.buildNewInstance();
    }
    this.setCurrentObject(object);
    XMLUnmarshalListener xmlUnmarshalListener=unmarshaller.getUnmarshalListener();
    if (null != xmlUnmarshalListener) {
      if (null == this.parentRecord) {
        xmlUnmarshalListener.beforeUnmarshal(object,null);
      }
 else {
        xmlUnmarshalListener.beforeUnmarshal(object,parentRecord.getCurrentObject());
      }
    }
    if (null == parentRecord) {
      this.xmlReader.newObjectEvent(object,null,selfRecordMapping);
    }
 else {
      this.xmlReader.newObjectEvent(object,parentRecord.getCurrentObject(),selfRecordMapping);
    }
    List containerValues=treeObjectBuilder.getContainerValues();
    if (null != containerValues) {
      containersMap=new HashMap(containerValues.size());
      for (int x=0, containerValuesSize=containerValues.size(); x < containerValuesSize; x++) {
        ContainerValue containerValue=(ContainerValue)containerValues.get(x);
        Object containerInstance=null;
        if (containerValue.getReuseContainer()) {
          containerInstance=containerValue.getMapping().getAttributeAccessor().getAttributeValueFromObject(object);
        }
        if (null == containerInstance) {
          containerInstance=containerValue.getContainerInstance();
        }
        containersMap.put(containerValue,containerInstance);
      }
    }
    if (null != xPathNode.getSelfChildren()) {
      int selfChildrenSize=xPathNode.getSelfChildren().size();
      selfRecords=new ArrayList<UnmarshalRecord>(selfChildrenSize);
      for (int x=0; x < selfChildrenSize; x++) {
        XPathNode selfNode=xPathNode.getSelfChildren().get(x);
        if (null != selfNode.getNodeValue()) {
          selfRecords.add(selfNode.getNodeValue().buildSelfRecord(this,attributes));
        }
      }
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}

Fixed version (ground truth):
public void startDocument() throws SAXException {
}
Program: 66603
Project: 66603
Buggy source:
public void endCDATA() throws SAXException {
  lexicalHandler.endCDATA();
}

Fixed version (ground truth):
public void endCDATA() throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.endCDATA();
  }
}
Program: 66604
Project: 66604
Buggy source:
public void startCDATA() throws SAXException {
  lexicalHandler.startCDATA();
}

Fixed version (ground truth):
public void startCDATA() throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.startCDATA();
  }
}
Program: 66605
Project: 66605
Buggy source:
public void startEntity(String name) throws SAXException {
  lexicalHandler.startEntity(name);
}

Fixed version (ground truth):
public void startEntity(String name) throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.startEntity(name);
  }
}
Program: 66606
Project: 66606
Buggy source:
public void endEntity(String name) throws SAXException {
  lexicalHandler.endEntity(name);
}

Fixed version (ground truth):
public void endEntity(String name) throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.endEntity(name);
  }
}
Program: 66607
Project: 66607
Buggy source:
public void startDTD(String name,String publicId,String systemId) throws SAXException {
  lexicalHandler.startCDATA();
}

Fixed version (ground truth):
public void startDTD(String name,String publicId,String systemId) throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.startCDATA();
  }
}
Program: 66608
Project: 66608
Buggy source:
public void endDTD() throws SAXException {
  lexicalHandler.endDTD();
}

Fixed version (ground truth):
public void endDTD() throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.endDTD();
  }
}
Program: 66609
Project: 66609
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  lexicalHandler.comment(ch,start,length);
}

Fixed version (ground truth):
public void comment(char[] ch,int start,int length) throws SAXException {
  if (null != lexicalHandler) {
    lexicalHandler.comment(ch,start,length);
  }
}
Program: 66610
Project: 66610
Buggy source:
public void setTypes(Type[] newTypes) throws Exception {
  this.classLoader=new JaxbClassLoader(Thread.currentThread().getContextClassLoader());
  generator=new Generator(new JavaModelInputImpl(newTypes,new JavaModelImpl(this.classLoader)));
  Project proj=generator.generateProject();
  proj.convertClassNamesToClasses(classLoader);
  setProject(proj);
  xmlContext=getXMLContext(proj);
  ConversionManager manager=new ConversionManager();
  manager.setLoader(classLoader);
  for (Iterator<ClassDescriptor> descriptorIt=proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext(); ) {
    ClassDescriptor descriptor=descriptorIt.next();
    if (descriptor.getJavaClass() == null) {
      descriptor.setJavaClass(manager.convertClassNameToClass(descriptor.getJavaClassName()));
    }
  }
  setProject(proj);
  jaxbContext=new org.eclipse.persistence.jaxb.JAXBContext(xmlContext,generator,newTypes);
  jaxbMarshaller=jaxbContext.createMarshaller();
  jaxbUnmarshaller=jaxbContext.createUnmarshaller();
}

Fixed version (ground truth):
public void setTypes(Type[] newTypes) throws Exception {
  classLoader=Thread.currentThread().getContextClassLoader();
  jaxbContext=JAXBContextFactory.createContext(newTypes,getProperties(),classLoader);
  xmlContext=((org.eclipse.persistence.jaxb.JAXBContext)jaxbContext).getXMLContext();
  setProject(xmlContext.getSession(0).getProject());
  jaxbMarshaller=jaxbContext.createMarshaller();
  jaxbUnmarshaller=jaxbContext.createUnmarshaller();
}
Program: 66611
Project: 66611
Buggy source:
public void setClasses(Class[] newClasses) throws Exception {
  this.classes=newClasses;
  this.classLoader=new JaxbClassLoader(Thread.currentThread().getContextClassLoader());
  generator=new Generator(new JavaModelInputImpl(classes,new JavaModelImpl(this.classLoader)));
  Project proj=generator.generateProject();
  proj.convertClassNamesToClasses(classLoader);
  XMLPlatform platform=new SAXPlatform();
  platform.getConversionManager().setLoader(classLoader);
  XMLLogin login=new XMLLogin(platform);
  login.setEqualNamespaceResolvers(false);
  proj.setLogin(login);
  setProject(proj);
  xmlContext=getXMLContext(proj);
  ConversionManager manager=new ConversionManager();
  manager.setLoader(classLoader);
  for (Iterator<ClassDescriptor> descriptorIt=proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext(); ) {
    ClassDescriptor descriptor=descriptorIt.next();
    if (descriptor.getJavaClass() == null) {
      descriptor.setJavaClass(manager.convertClassNameToClass(descriptor.getJavaClassName()));
    }
  }
  setProject(proj);
  jaxbContext=new org.eclipse.persistence.jaxb.JAXBContext(xmlContext,generator,newClasses);
  jaxbMarshaller=jaxbContext.createMarshaller();
  jaxbUnmarshaller=jaxbContext.createUnmarshaller();
}

Fixed version (ground truth):
public void setClasses(Class[] newClasses) throws Exception {
  classLoader=Thread.currentThread().getContextClassLoader();
  jaxbContext=JAXBContextFactory.createContext(newClasses,null,classLoader);
  xmlContext=((org.eclipse.persistence.jaxb.JAXBContext)jaxbContext).getXMLContext();
  setProject(xmlContext.getSession(0).getProject());
  jaxbMarshaller=jaxbContext.createMarshaller();
  jaxbUnmarshaller=jaxbContext.createUnmarshaller();
}
Program: 66612
Project: 66612
Buggy source:
public EmployeeCollectionTestCases(String name) throws Exception {
  super(name);
  setControlDocument(XML_RESOURCE);
  Class[] classes=new Class[1];
  classes[0]=ObjectFactory.class;
  setClasses(classes);
}

Fixed version (ground truth):
public EmployeeCollectionTestCases(String name) throws Exception {
  super(name);
  setControlDocument(XML_RESOURCE);
  Class[] classes=new Class[1];
  classes[0]=TestObjectFactory.class;
  setClasses(classes);
}
Program: 66613
Project: 66613
Buggy source:
public EmployeeSingleTestCases(String name) throws Exception {
  super(name);
  setControlDocument(XML_RESOURCE);
  Class[] classes=new Class[1];
  classes[0]=ObjectFactory.class;
  setClasses(classes);
}

Fixed version (ground truth):
public EmployeeSingleTestCases(String name) throws Exception {
  super(name);
  setControlDocument(XML_RESOURCE);
  Class[] classes=new Class[1];
  classes[0]=TestObjectFactory.class;
  setClasses(classes);
}
Program: 66614
Project: 66614
Buggy source:
/** 
 * Return if the tests were run using weaving, agent or static.
 */
public static boolean isWeavingEnabled(){
  if ("String_Node_Str".equals(JUnitTestCase.getServerSession().getProperty("String_Node_Str"))) {
    return false;
  }
  return System.getProperty("String_Node_Str") == null;
}

Fixed version (ground truth):
/** 
 * Return if the tests were run using weaving, agent or static.
 */
public static boolean isWeavingEnabled(String persistenceUnitName){
  if ("String_Node_Str".equals(JUnitTestCase.getServerSession(persistenceUnitName).getProperty("String_Node_Str"))) {
    return false;
  }
  return System.getProperty("String_Node_Str") == null;
}
Program: 66615
Project: 66615
Buggy source:
public void testVerifyFetchGroups(){
  ClassDescriptor hockeyGearDescriptor=getServerSession().getDescriptor(HockeyGear.class);
  FetchGroupManager hockeyGearFetchGroupManager=hockeyGearDescriptor.getFetchGroupManager();
  assertTrue("String_Node_Str",hockeyGearFetchGroupManager.getFetchGroups().size() == 1);
  assertNotNull("String_Node_Str",hockeyGearFetchGroupManager.getFetchGroup("String_Node_Str"));
  ClassDescriptor padsDescriptor=getServerSession().getDescriptor(Pads.class);
  FetchGroupManager padsFetchGroupManager=padsDescriptor.getFetchGroupManager();
  assertTrue("String_Node_Str",padsFetchGroupManager.getFetchGroups().size() == 3);
  assertNotNull("String_Node_Str",padsFetchGroupManager.getFetchGroup("String_Node_Str"));
  assertNotNull("String_Node_Str",padsFetchGroupManager.getFetchGroup("String_Node_Str"));
  assertNotNull("String_Node_Str",padsFetchGroupManager.getFetchGroup("String_Node_Str"));
  ClassDescriptor chestProtectorDescriptor=getServerSession().getDescriptor(ChestProtector.class);
  FetchGroupManager chestProtectorFetchGroupManager=chestProtectorDescriptor.getFetchGroupManager();
  assertTrue("String_Node_Str",chestProtectorFetchGroupManager.getFetchGroups().size() == 1);
  assertNotNull("String_Node_Str",chestProtectorFetchGroupManager.getFetchGroup("String_Node_Str"));
}

Fixed version (ground truth):
public void testVerifyFetchGroups(){
  if (isWeavingEnabled()) {
    ClassDescriptor hockeyGearDescriptor=getServerSession().getDescriptor(HockeyGear.class);
    FetchGroupManager hockeyGearFetchGroupManager=hockeyGearDescriptor.getFetchGroupManager();
    assertTrue("String_Node_Str",hockeyGearFetchGroupManager.getFetchGroups().size() == 1);
    assertNotNull("String_Node_Str",hockeyGearFetchGroupManager.getFetchGroup("String_Node_Str"));
    ClassDescriptor padsDescriptor=getServerSession().getDescriptor(Pads.class);
    FetchGroupManager padsFetchGroupManager=padsDescriptor.getFetchGroupManager();
    assertTrue("String_Node_Str",padsFetchGroupManager.getFetchGroups().size() == 3);
    assertNotNull("String_Node_Str",padsFetchGroupManager.getFetchGroup("String_Node_Str"));
    assertNotNull("String_Node_Str",padsFetchGroupManager.getFetchGroup("String_Node_Str"));
    assertNotNull("String_Node_Str",padsFetchGroupManager.getFetchGroup("String_Node_Str"));
    ClassDescriptor chestProtectorDescriptor=getServerSession().getDescriptor(ChestProtector.class);
    FetchGroupManager chestProtectorFetchGroupManager=chestProtectorDescriptor.getFetchGroupManager();
    assertTrue("String_Node_Str",chestProtectorFetchGroupManager.getFetchGroups().size() == 1);
    assertNotNull("String_Node_Str",chestProtectorFetchGroupManager.getFetchGroup("String_Node_Str"));
  }
}
Program: 66616
Project: 66616
Buggy source:
public void testFetchGroupOnPadsFromInheritanceParent(){
  EntityManager em=createEntityManager();
  Map properties=new HashMap();
  properties.put(QueryHints.FETCH_GROUP_NAME,"String_Node_Str");
  Class PadsClass=Pads.class;
  Pads pads=(Pads)em.find(PadsClass,padsId,properties);
  try {
    verifyFetchedField(PadsClass.getField("String_Node_Str"),pads,999.99);
    verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.getMessage());
  }
 finally {
    closeEntityManager(em);
  }
}

Fixed version (ground truth):
public void testFetchGroupOnPadsFromInheritanceParent(){
  if (isWeavingEnabled()) {
    EntityManager em=createEntityManager();
    Map properties=new HashMap();
    properties.put(QueryHints.FETCH_GROUP_NAME,"String_Node_Str");
    Class PadsClass=Pads.class;
    Pads pads=(Pads)em.find(PadsClass,padsId,properties);
    try {
      verifyFetchedField(PadsClass.getField("String_Node_Str"),pads,999.99);
      verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
    }
 catch (    Exception e) {
      fail("String_Node_Str" + e.getMessage());
    }
 finally {
      closeEntityManager(em);
    }
  }
}
Program: 66617
Project: 66617
Buggy source:
public void testCreateHockeyGear(){
  EntityManager em=createEntityManager();
  beginTransaction(em);
  try {
    Pads pads=new Pads();
    pads.setAgeGroup(AgeGroup.SENIOR);
    pads.setDescription("String_Node_Str");
    pads.setHeight(35.5);
    pads.setMsrp(999.99);
    pads.setWeight(4.9);
    pads.setWidth(11.0);
    em.persist(pads);
    ChestProtector chestProtector=new ChestProtector();
    chestProtector.setAgeGroup(AgeGroup.INTERMEDIATE);
    chestProtector.setDescription("String_Node_Str");
    chestProtector.setMsrp(599.99);
    chestProtector.setSize("String_Node_Str");
    em.persist(chestProtector);
    commitTransaction(em);
    padsId=pads.getSerialNumber();
    chestProtectorId=chestProtector.getSerialNumber();
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
}

Fixed version (ground truth):
public void testCreateHockeyGear(){
  if (isWeavingEnabled()) {
    EntityManager em=createEntityManager();
    beginTransaction(em);
    try {
      Pads pads=new Pads();
      pads.setAgeGroup(AgeGroup.SENIOR);
      pads.setDescription("String_Node_Str");
      pads.setHeight(35.5);
      pads.setMsrp(999.99);
      pads.setWeight(4.9);
      pads.setWidth(11.0);
      em.persist(pads);
      ChestProtector chestProtector=new ChestProtector();
      chestProtector.setAgeGroup(AgeGroup.INTERMEDIATE);
      chestProtector.setDescription("String_Node_Str");
      chestProtector.setMsrp(599.99);
      chestProtector.setSize("String_Node_Str");
      em.persist(chestProtector);
      commitTransaction(em);
      padsId=pads.getSerialNumber();
      chestProtectorId=chestProtector.getSerialNumber();
    }
 catch (    RuntimeException e) {
      if (isTransactionActive(em)) {
        rollbackTransaction(em);
      }
      closeEntityManager(em);
      throw e;
    }
  }
}
Program: 66618
Project: 66618
Buggy source:
public void testFetchGroupOnPads(){
  EntityManager em=createEntityManager();
  Map properties=new HashMap();
  properties.put(QueryHints.FETCH_GROUP_NAME,"String_Node_Str");
  Class PadsClass=Pads.class;
  Pads pads=(Pads)em.find(PadsClass,padsId,properties);
  try {
    verifyFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads,35.5);
    verifyFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads,11.0);
    verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
    verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.getMessage());
  }
 finally {
    closeEntityManager(em);
  }
}

Fixed version (ground truth):
public void testFetchGroupOnPads(){
  if (isWeavingEnabled()) {
    EntityManager em=createEntityManager();
    Map properties=new HashMap();
    properties.put(QueryHints.FETCH_GROUP_NAME,"String_Node_Str");
    Class PadsClass=Pads.class;
    Pads pads=(Pads)em.find(PadsClass,padsId,properties);
    try {
      verifyFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads,35.5);
      verifyFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads,11.0);
      verifyNonFetchedField(PadsClass.getDeclaredField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
      verifyNonFetchedField(PadsClass.getField("String_Node_Str"),pads);
    }
 catch (    Exception e) {
      fail("String_Node_Str" + e.getMessage());
    }
 finally {
      closeEntityManager(em);
    }
  }
}
Program: 66619
Project: 66619
Buggy source:
public void testFetchGroupOnChestProtector(){
  EntityManager em=createEntityManager();
  Map properties=new HashMap();
  properties.put(QueryHints.FETCH_GROUP_NAME,"String_Node_Str");
  Class chestProtectorClass=ChestProtector.class;
  ChestProtector chestProtector=(ChestProtector)em.find(chestProtectorClass,chestProtectorId,properties);
  try {
    verifyFetchedField(chestProtectorClass.getField("String_Node_Str"),chestProtector,AgeGroup.INTERMEDIATE);
    verifyNonFetchedField(chestProtectorClass.getField("String_Node_Str"),chestProtector);
    verifyNonFetchedField(chestProtectorClass.getField("String_Node_Str"),chestProtector);
    verifyNonFetchedField(chestProtectorClass.getDeclaredField("String_Node_Str"),chestProtector);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.getMessage());
  }
 finally {
    closeEntityManager(em);
  }
}

Fixed version (ground truth):
public void testFetchGroupOnChestProtector(){
  if (isWeavingEnabled()) {
    EntityManager em=createEntityManager();
    Map properties=new HashMap();
    properties.put(QueryHints.FETCH_GROUP_NAME,"String_Node_Str");
    Class chestProtectorClass=ChestProtector.class;
    ChestProtector chestProtector=(ChestProtector)em.find(chestProtectorClass,chestProtectorId,properties);
    try {
      verifyFetchedField(chestProtectorClass.getField("String_Node_Str"),chestProtector,AgeGroup.INTERMEDIATE);
      verifyNonFetchedField(chestProtectorClass.getField("String_Node_Str"),chestProtector);
      verifyNonFetchedField(chestProtectorClass.getField("String_Node_Str"),chestProtector);
      verifyNonFetchedField(chestProtectorClass.getDeclaredField("String_Node_Str"),chestProtector);
    }
 catch (    Exception e) {
      fail("String_Node_Str" + e.getMessage());
    }
 finally {
      closeEntityManager(em);
    }
  }
}
Program: 66620
Project: 66620
Buggy source:
public void addTests(){
  super.addTests();
  TestSuite unicodeSuite=new TestSuite();
  unicodeSuite.setName("String_Node_Str");
  unicodeSuite.setDescription("String_Node_Str");
  unicodeSuite.addTest(new ProjectClassGeneratorUnicodeTest());
  addTest(unicodeSuite);
  addTest(new ProjectClassGeneratorOrderByQueryKeysTest());
}

Fixed version (ground truth):
public void addTests(){
  super.addTests();
  TestSuite unicodeSuite=new TestSuite();
  unicodeSuite.setName("String_Node_Str");
  unicodeSuite.setDescription("String_Node_Str");
  unicodeSuite.addTest(new ProjectClassGeneratorUnicodeTest());
  addTest(unicodeSuite);
  addTest(new ProjectClassGeneratorOrderByQueryKeysTest());
  addTest(new ProjectClassGeneratorInheritanceMappingTest());
}
Program: 66621
Project: 66621
Buggy source:
/** 
 * Return the printed version of the primitive value object. This must determine the class and use the correct constrcutor arguments.
 */
protected String printString(Object value){
  if ((value == null) || (value == Helper.getNullWrapper())) {
    return "String_Node_Str";
  }
  if (value instanceof String) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (value instanceof Character) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (value instanceof java.util.Date) {
    java.util.Date date=(java.util.Date)value;
    return "String_Node_Str" + value.getClass().getName() + "String_Node_Str"+ date.getTime()+ "String_Node_Str";
  }
  return "String_Node_Str" + value.getClass().getName() + "String_Node_Str"+ value+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Return the printed version of the primitive value object. This must determine the class and use the correct constrcutor arguments.
 */
protected String printString(Object value){
  if ((value == null) || (value == Helper.getNullWrapper())) {
    return "String_Node_Str";
  }
  if (value instanceof String) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (value instanceof Character) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (value instanceof java.util.Date) {
    java.util.Date date=(java.util.Date)value;
    return "String_Node_Str" + value.getClass().getName() + "String_Node_Str"+ date.getTime()+ "String_Node_Str";
  }
  return "String_Node_Str" + value.getClass().getName() + "String_Node_Str"+ String.valueOf(value)+ "String_Node_Str";
}
Program: 66623
Project: 66623
Buggy source:
public void testDatahandlerTypes() throws Exception {
  TypeMappingInfo tmi=new TypeMappingInfo();
  tmi.setType(DataHandler.class);
  tmi.setElementScope(TypeMappingInfo.ElementScope.Local);
  tmi.setXmlTagName(new QName("String_Node_Str","String_Node_Str"));
  Annotation[] annotations=getClass().getField("String_Node_Str").getAnnotations();
  tmi.setAnnotations(annotations);
  TypeMappingInfo tmi2=new TypeMappingInfo();
  tmi2.setElementScope(TypeMappingInfo.ElementScope.Local);
  tmi2.setXmlTagName(new QName("String_Node_Str","String_Node_Str"));
  tmi2.setType(DataHandler.class);
  TypeMappingInfo[] tmis=new TypeMappingInfo[]{tmi,tmi2};
  JAXBContext ctx=(JAXBContext)JAXBContextFactory.createContext(tmis,null,Thread.currentThread().getContextClassLoader());
  Map<Type,QName> typeMap=ctx.getTypeToSchemaType();
  assertEquals(0,typeMap.size());
  Map<TypeMappingInfo,QName> tmiMap=ctx.getTypeMappingInfoToSchemaType();
  assertEquals(2,tmiMap.size());
  assertNotNull(tmiMap.get(tmi2));
  assertEquals(XMLConstants.BASE_64_BINARY_QNAME,tmiMap.get(tmi2));
  assertNotNull(tmiMap.get(tmi));
}

Fixed version (ground truth):
public void testDatahandlerTypes() throws Exception {
  TypeMappingInfo tmi=new TypeMappingInfo();
  tmi.setType(DataHandler.class);
  tmi.setElementScope(TypeMappingInfo.ElementScope.Local);
  tmi.setXmlTagName(new QName("String_Node_Str","String_Node_Str"));
  Annotation[] annotations=getClass().getField("String_Node_Str").getAnnotations();
  tmi.setAnnotations(annotations);
  TypeMappingInfo tmi2=new TypeMappingInfo();
  tmi2.setElementScope(TypeMappingInfo.ElementScope.Local);
  tmi2.setXmlTagName(new QName("String_Node_Str","String_Node_Str"));
  tmi2.setType(DataHandler.class);
  TypeMappingInfo[] tmis=new TypeMappingInfo[]{tmi,tmi2};
  JAXBContext ctx=(JAXBContext)JAXBContextFactory.createContext(tmis,null,Thread.currentThread().getContextClassLoader());
  Map<Type,QName> typeMap=ctx.getTypeToSchemaType();
  assertEquals(0,typeMap.size());
  Map<TypeMappingInfo,QName> tmiMap=ctx.getTypeMappingInfoToSchemaType();
  assertEquals(2,tmiMap.size());
  assertNotNull(tmiMap.get(tmi2));
  assertEquals(XMLConstants.BASE_64_BINARY_QNAME,tmiMap.get(tmi2));
  assertNotNull(tmiMap.get(tmi));
  assertEquals(XMLConstants.SWA_REF_QNAME,tmiMap.get(tmi));
}