nus-yam/ex-repair huggingface dataset:
Program: 65627
Project: 65627
Buggy source:
/** 
 * Set an XmlAdapter on this Property.  The type, generic type and  original type will be set as required based on the XmlAdapter's marshal method return type and input parameters.
 * @param adapterCls
 */
public void setAdapterClass(JavaClass adapterCls){
  adapterClass=adapterCls;
  JavaClass newType=helper.getJavaClass(Object.class);
  ArrayList<JavaMethod> marshalMethods=new ArrayList<JavaMethod>();
  for (Iterator<JavaMethod> methodIt=adapterClass.getDeclaredMethods().iterator(); methodIt.hasNext(); ) {
    JavaMethod method=methodIt.next();
    if (method.getName().equals(MARSHAL_METHOD_NAME)) {
      JavaClass returnType=method.getReturnType();
      if (!returnType.getQualifiedName().equals(newType.getQualifiedName())) {
        newType=(JavaClass)method.getReturnType();
        setTypeFromAdapterClass(newType,method.getParameterTypes()[0]);
        return;
      }
      marshalMethods.add(method);
    }
  }
  if (marshalMethods.size() == 0) {
    setTypeFromAdapterClass(newType,null);
    return;
  }
  for (  JavaMethod method : marshalMethods) {
    JavaClass paramType=method.getParameterTypes()[0];
    if (!paramType.equals(newType)) {
      setTypeFromAdapterClass(newType,paramType);
      return;
    }
  }
  setTypeFromAdapterClass(newType,marshalMethods.get(0).getParameterTypes()[0]);
}

Fixed version (ground truth):
/** 
 * Set an XmlAdapter on this Property.  The type, generic type and  original type will be set as required based on the XmlAdapter's marshal method return type and input parameters.
 * @param adapterCls
 */
public void setAdapterClass(JavaClass adapterCls){
  adapterClass=adapterCls;
  JavaClass newType=helper.getJavaClass(Object.class);
  ArrayList<JavaMethod> marshalMethods=new ArrayList<JavaMethod>();
  for (Iterator<JavaMethod> methodIt=adapterClass.getDeclaredMethods().iterator(); methodIt.hasNext(); ) {
    JavaMethod method=methodIt.next();
    if (method.getName().equals(MARSHAL_METHOD_NAME)) {
      JavaClass returnType=method.getReturnType();
      if (!returnType.getQualifiedName().equals(newType.getQualifiedName())) {
        newType=(JavaClass)method.getReturnType();
        setTypeFromAdapterClass(newType,method.getParameterTypes()[0]);
        return;
      }
      marshalMethods.add(method);
    }
  }
  if (marshalMethods.size() == 0) {
    setTypeFromAdapterClass(newType,null);
    return;
  }
  for (  JavaMethod method : marshalMethods) {
    JavaClass paramType=method.getParameterTypes()[0];
    if (!paramType.getQualifiedName().equals(newType.getQualifiedName())) {
      setTypeFromAdapterClass(newType,paramType);
      return;
    }
  }
  setTypeFromAdapterClass(newType,marshalMethods.get(0).getParameterTypes()[0]);
}
Program: 65628
Project: 65628
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlCompositeCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object collection=xmlCompositeCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  marshalRecord.startCollection();
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.endCollection();
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlCompositeCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object collection=xmlCompositeCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (null != iterator && cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  marshalRecord.startCollection();
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.endCollection();
  return true;
}
Program: 65630
Project: 65630
Buggy source:
public Object getAttributeValueFromObject(Object object) throws DescriptorException {
  Object value=nestedAccessor.getAttributeValueFromObject(object);
  if (null == value) {
    return null;
  }
  Object results=containerPolicy.containerInstance(((Map)value).size());
  Iterator iter=((Map)value).keySet().iterator();
  while (iter.hasNext()) {
    Object nextKey=iter.next();
    Object nextValue=((Map)value).get(nextKey);
    MapEntry nextEntry;
    try {
      nextEntry=(MapEntry)generatedEntryClass.newInstance();
    }
 catch (    Exception e) {
      return null;
    }
    nextEntry.setKey(nextKey);
    nextEntry.setValue(nextValue);
    containerPolicy.addInto(nextEntry,results,null);
  }
  return results;
}

Fixed version (ground truth):
public Object getAttributeValueFromObject(Object object) throws DescriptorException {
  Object value=nestedAccessor.getAttributeValueFromObject(object);
  if (null == value) {
    return null;
  }
  Object results=containerPolicy.containerInstance(((Map)value).size());
  Set<Entry> entrySet=((Map)value).entrySet();
  if (null == entrySet) {
    return results;
  }
  for (  Entry entry : entrySet) {
    MapEntry nextEntry;
    try {
      nextEntry=(MapEntry)generatedEntryClass.newInstance();
    }
 catch (    Exception e) {
      return null;
    }
    nextEntry.setKey(entry.getKey());
    nextEntry.setValue(entry.getValue());
    containerPolicy.addInto(nextEntry,results,null);
  }
  return results;
}
Program: 65631
Project: 65631
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlAnyCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=xmlAnyCollectionMapping.getContainerPolicy();
  Object collection=xmlAnyCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  Object objectValue;
  while (cp.hasNext(iterator)) {
    objectValue=cp.next(iterator,session);
    if (xmlAnyCollectionMapping.getConverter() != null) {
      objectValue=xmlAnyCollectionMapping.getConverter().convertObjectValueToDataValue(objectValue,session,marshalRecord.getMarshaller());
    }
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlAnyCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=xmlAnyCollectionMapping.getContainerPolicy();
  Object collection=xmlAnyCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (null != iterator && cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  Object objectValue;
  while (cp.hasNext(iterator)) {
    objectValue=cp.next(iterator,session);
    if (xmlAnyCollectionMapping.getConverter() != null) {
      objectValue=xmlAnyCollectionMapping.getConverter().convertObjectValueToDataValue(objectValue,session,marshalRecord.getMarshaller());
    }
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}
Program: 65636
Project: 65636
Buggy source:
@Override public DynamicEntity unmarshal(Object v) throws Exception {
  DynamicEntity link=(DynamicEntity)v;
  DynamicEntity address=jc.newDynamicEntity("String_Node_Str");
  StringTokenizer tokenizer=new StringTokenizer(link.get("String_Node_Str").toString(),"String_Node_Str",false);
  String street=tokenizer.nextToken();
  street=street.substring(street.lastIndexOf("String_Node_Str") + 1);
  street=street.replace('_',' ');
  String city=tokenizer.nextToken();
  city=city.substring(city.lastIndexOf("String_Node_Str") + 1);
  String state=tokenizer.nextToken();
  state=state.substring(state.lastIndexOf("String_Node_Str") + 1);
  String zip=tokenizer.nextToken();
  zip=zip.substring(zip.lastIndexOf("String_Node_Str") + 1);
  address.set("String_Node_Str",street);
  address.set("String_Node_Str",city);
  address.set("String_Node_Str",state);
  address.set("String_Node_Str",zip);
  return address;
}

Fixed version (ground truth):
@Override public DynamicEntity unmarshal(Object v) throws Exception {
  DynamicEntity link=(DynamicEntity)v;
  DynamicEntity address=jc.newDynamicEntity("String_Node_Str");
  StringTokenizer tokenizer=new StringTokenizer(((Object)link.get("String_Node_Str")).toString(),"String_Node_Str",false);
  String street=tokenizer.nextToken();
  street=street.substring(street.lastIndexOf("String_Node_Str") + 1);
  street=street.replace('_',' ');
  String city=tokenizer.nextToken();
  city=city.substring(city.lastIndexOf("String_Node_Str") + 1);
  String state=tokenizer.nextToken();
  state=state.substring(state.lastIndexOf("String_Node_Str") + 1);
  String zip=tokenizer.nextToken();
  zip=zip.substring(zip.lastIndexOf("String_Node_Str") + 1);
  address.set("String_Node_Str",street);
  address.set("String_Node_Str",city);
  address.set("String_Node_Str",state);
  address.set("String_Node_Str",zip);
  return address;
}
Program: 65638
Project: 65638
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected void toParsedText(StringBuilder writer,boolean actual){
  if (hasExpression()) {
    expression.toParsedText(writer,actual);
  }
  if (hasExpression()) {
    writer.append(SPACE);
  }
  if (hasNot) {
    writer.append(actual ? notIdentifier : NOT);
    writer.append(SPACE);
  }
  writer.append(actual ? inIdentifier : IN);
  if (hasLeftParenthesis) {
    writer.append(LEFT_PARENTHESIS);
  }
 else   if (hasSpaceAfterIn) {
    writer.append(SPACE);
  }
  if (hasInItems()) {
    inItems.toParsedText(writer,actual);
  }
  if (hasRightParenthesis) {
    writer.append(RIGHT_PARENTHESIS);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void toParsedText(StringBuilder writer,boolean actual){
  if (hasExpression()) {
    expression.toParsedText(writer,actual);
    writer.append(SPACE);
  }
  if (hasNot) {
    writer.append(actual ? notIdentifier : NOT);
    writer.append(SPACE);
  }
  writer.append(actual ? inIdentifier : IN);
  if (hasLeftParenthesis) {
    writer.append(LEFT_PARENTHESIS);
  }
 else   if (hasSpaceAfterIn) {
    writer.append(SPACE);
  }
  if (hasInItems()) {
    inItems.toParsedText(writer,actual);
  }
  if (hasRightParenthesis) {
    writer.append(RIGHT_PARENTHESIS);
  }
}
Program: 65639
Project: 65639
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected void parse(WordParser wordParser,boolean tolerant){
  hasNot=wordParser.startsWithIgnoreCase('N');
  if (hasNot) {
    notIdentifier=wordParser.moveForward(NOT);
    wordParser.skipLeadingWhitespace();
  }
  inIdentifier=wordParser.moveForward(IN);
  int count=wordParser.skipLeadingWhitespace();
  hasSpaceAfterIn=(count > 0);
  hasLeftParenthesis=wordParser.startsWith(LEFT_PARENTHESIS);
  if (hasLeftParenthesis) {
    wordParser.moveForward(1);
    count=wordParser.skipLeadingWhitespace();
  }
  inItems=parse(wordParser,getQueryBNF(InItemBNF.ID),tolerant);
  if (hasInItems()) {
    count=wordParser.skipLeadingWhitespace();
  }
  hasRightParenthesis=wordParser.startsWith(RIGHT_PARENTHESIS);
  if (hasRightParenthesis) {
    wordParser.moveForward(1);
  }
 else {
    wordParser.moveBackward(count);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void parse(WordParser wordParser,boolean tolerant){
  hasNot=wordParser.startsWithIgnoreCase('N');
  if (hasNot) {
    notIdentifier=wordParser.moveForward(NOT);
    wordParser.skipLeadingWhitespace();
  }
  inIdentifier=wordParser.moveForward(IN);
  int count=wordParser.skipLeadingWhitespace();
  hasSpaceAfterIn=(count > 0);
  hasLeftParenthesis=wordParser.startsWith(LEFT_PARENTHESIS);
  if (hasLeftParenthesis) {
    wordParser.moveForward(1);
    count=wordParser.skipLeadingWhitespace();
  }
  inItems=parse(wordParser,getQueryBNF(InItemBNF.ID),tolerant);
  if (hasInItems()) {
    count=wordParser.skipLeadingWhitespace();
  }
  hasRightParenthesis=wordParser.startsWith(RIGHT_PARENTHESIS);
  if (hasRightParenthesis) {
    wordParser.moveForward(1);
  }
}
Program: 65640
Project: 65640
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected void addOrderedChildrenTo(List<StringExpression> children){
  if (expression != null) {
    children.add(expression);
  }
  if (hasNot) {
    children.add(buildStringExpression(SPACE));
    children.add(buildStringExpression(NOT));
  }
 else   if (hasExpression()) {
    children.add(buildStringExpression(SPACE));
  }
  children.add(buildStringExpression(IN));
  if (hasLeftParenthesis) {
    children.add(buildStringExpression(LEFT_PARENTHESIS));
  }
 else   if (hasInItems()) {
    children.add(buildStringExpression(SPACE));
  }
  if (inItems != null) {
    children.add(inItems);
  }
  if (hasRightParenthesis) {
    children.add(buildStringExpression(RIGHT_PARENTHESIS));
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void addOrderedChildrenTo(List<StringExpression> children){
  if (hasExpression()) {
    children.add(expression);
    children.add(buildStringExpression(SPACE));
  }
  if (hasNot) {
    children.add(buildStringExpression(NOT));
  }
  children.add(buildStringExpression(IN));
  if (hasLeftParenthesis) {
    children.add(buildStringExpression(LEFT_PARENTHESIS));
  }
 else   if (hasSpaceAfterIn) {
    children.add(buildStringExpression(SPACE));
  }
  if (hasInItems()) {
    children.add(inItems);
  }
  if (hasRightParenthesis) {
    children.add(buildStringExpression(RIGHT_PARENTHESIS));
  }
}
Program: 65641
Project: 65641
Buggy source:
/** 
 * Determines whether the declaration contains <b>JOIN</b> expressions. This can be <code>true</code> only when   {@link #isRange()} returns <code>true</code>. A collectionmember declaration does not have <b>JOIN</b> expressions.
 * @return <code>true</code> if at least one <b>JOIN</b> expression was parsed; otherwise<code>false</code>
 */
boolean hasJoins(){
  return joins != null;
}

Fixed version (ground truth):
/** 
 * Determines whether the declaration contains <b>JOIN</b> expressions.
 * @return <code>true</code> if at least one <b>JOIN</b> expression was parsed; otherwise<code>false</code>
 */
boolean hasJoins(){
  return joins != null;
}
Program: 65642
Project: 65642
Buggy source:
private void visitAbstractSelectStatement(AbstractSelectStatement expression){
  expression.getFromClause().accept(this);
  expression.getSelectClause().accept(this);
  if (expression.hasWhereClause()) {
    expression.getWhereClause().accept(this);
  }
  if (expression.hasGroupByClause()) {
    expression.getGroupByClause().accept(this);
  }
  if (expression.hasHavingClause()) {
    expression.getHavingClause().accept(this);
  }
}

Fixed version (ground truth):
void visitAbstractSelectStatement(AbstractSelectStatement expression){
  expression.getFromClause().accept(this);
  expression.getSelectClause().accept(this);
  if (expression.hasWhereClause()) {
    expression.getWhereClause().accept(this);
  }
  if (expression.hasGroupByClause()) {
    expression.getGroupByClause().accept(this);
  }
  if (expression.hasHavingClause()) {
    expression.getHavingClause().accept(this);
  }
}
Program: 65643
Project: 65643
Buggy source:
private void visitAbstractSelectClause(AbstractSelectClause expression){
  ObjectLevelReadQuery query=queryContext.getDatabaseQuery();
  if (expression.hasDistinct() && !hasNotCountFunction(expression)) {
    query.useDistinct();
  }
  boolean buildNullForNullPK=hasOneToOneSelected(expression);
  query.setShouldBuildNullForNullPk(buildNullForNullPK);
}

Fixed version (ground truth):
void visitAbstractSelectClause(AbstractSelectClause expression){
  if (expression.hasDistinct() && !hasNotCountFunction(expression)) {
    query.useDistinct();
  }
  boolean buildNullForNullPK=hasOneToOneSelected(expression);
  query.setShouldBuildNullForNullPk(buildNullForNullPK);
}
Program: 65644
Project: 65644
Buggy source:
private void visitAbstractFromClause(AbstractFromClause expression){
  ObjectLevelReadQuery query=queryContext.getDatabaseQuery();
  Expression baseExpression=queryContext.getBaseExpression();
  ExpressionBuilder expressionBuilder=baseExpression.getBuilder();
  query.setExpressionBuilder(expressionBuilder);
  if (query.getReferenceClass() == null) {
    query.setReferenceClass(expressionBuilder.getQueryClass());
    query.changeDescriptor(queryContext.getSession());
  }
}

Fixed version (ground truth):
void visitAbstractFromClause(AbstractFromClause expression){
  Expression baseExpression=queryContext.getBaseExpression();
  ExpressionBuilder expressionBuilder=baseExpression.getBuilder();
  query.setExpressionBuilder(expressionBuilder);
  if (query.getReferenceClass() == null) {
    query.setReferenceClass(expressionBuilder.getQueryClass());
    query.changeDescriptor(queryContext.getSession());
  }
}
Program: 65645
Project: 65645
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void visit(OrderByItem expression){
  Expression queryExpression=null;
  queryExpression=queryContext.buildExpression(expression.getExpression());
  if (expression.getOrdering() == Ordering.DESC) {
    getDatabaseQuery().addOrdering(queryExpression.descending());
  }
 else {
    getDatabaseQuery().addOrdering(queryExpression.ascending());
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void visit(OrderByItem expression){
  Expression queryExpression=queryContext.buildExpression(expression.getExpression());
  if (expression.getOrdering() == Ordering.DESC) {
    query.addOrdering(queryExpression.descending());
  }
 else {
    query.addOrdering(queryExpression.ascending());
  }
}
Program: 65646
Project: 65646
Buggy source:
public RootWithCompositeObjectTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{Employee.class,Address.class,PhoneNumber.class});
  setControlDocument("String_Node_Str");
  setControlJSON("String_Node_Str");
  expectedMarshalEvents=new ArrayList();
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_BEFORE_MARSHAL);
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.ADDRESS_BEFORE_MARSHAL);
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.ADDRESS_AFTER_MARSHAL);
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_AFTER_MARSHAL);
  expectedUnmarshalEvents=new ArrayList();
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_BEFORE_UNMARSHAL);
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.ADDRESS_BEFORE_UNMARSHAL);
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.ADDRESS_AFTER_UNMARSHAL);
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_AFTER_UNMARSHAL);
  expectedClassBasedUnmarshalEvents=new ArrayList();
  expectedClassBasedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_BEFORE_UNMARSHAL);
  expectedClassBasedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_AFTER_UNMARSHAL);
  expectedClassBasedMarshalEvents=new ArrayList();
  expectedClassBasedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_BEFORE_MARSHAL);
  expectedClassBasedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_AFTER_MARSHAL);
}

Fixed version (ground truth):
public RootWithCompositeObjectTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{Employee.class});
  setControlDocument("String_Node_Str");
  setControlJSON("String_Node_Str");
  expectedMarshalEvents=new ArrayList();
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_BEFORE_MARSHAL);
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.ADDRESS_BEFORE_MARSHAL);
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.ADDRESS_AFTER_MARSHAL);
  expectedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_AFTER_MARSHAL);
  expectedUnmarshalEvents=new ArrayList();
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_BEFORE_UNMARSHAL);
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.ADDRESS_BEFORE_UNMARSHAL);
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.ADDRESS_AFTER_UNMARSHAL);
  expectedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_AFTER_UNMARSHAL);
  expectedClassBasedUnmarshalEvents=new ArrayList();
  expectedClassBasedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_BEFORE_UNMARSHAL);
  expectedClassBasedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.ADDRESS_BEFORE_UNMARSHAL);
  expectedClassBasedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.ADDRESS_AFTER_UNMARSHAL);
  expectedClassBasedUnmarshalEvents.add(JAXBUnmarshalListenerImpl.EMPLOYEE_AFTER_UNMARSHAL);
  expectedClassBasedMarshalEvents=new ArrayList();
  expectedClassBasedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_BEFORE_MARSHAL);
  expectedClassBasedMarshalEvents.add(JAXBMarshalListenerImpl.EMPLOYEE_AFTER_MARSHAL);
}
Program: 65649
Project: 65649
Buggy source:
/** 
 * Build a valid instance of BigDecimal from the given sourceObject
 * @param sourceObject    Valid instance of String, BigInteger, any Number
 */
protected BigDecimal convertObjectToBigDecimal(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String) {
    String sourceString=(String)sourceObject;
    if (sourceString.length() == 0) {
      return null;
    }
 else     if (sourceString.charAt(0) == PLUS) {
      return super.convertObjectToBigDecimal(sourceString.substring(1));
    }
  }
  return super.convertObjectToBigDecimal(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid instance of BigDecimal from the given sourceObject
 * @param sourceObject    Valid instance of String, BigInteger, any Number
 */
protected BigDecimal convertObjectToBigDecimal(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String) {
    String sourceString=(String)sourceObject;
    if (sourceString.length() == 0) {
      return null;
    }
  }
  return super.convertObjectToBigDecimal(sourceObject);
}
Program: 65650
Project: 65650
Buggy source:
public Map<String,String> getPrefixesToNamespaces(){
  return prefixesToNamespaces;
}

Fixed version (ground truth):
public Map<String,String> getPrefixesToNamespaces(){
  if (null == prefixesToNamespaces) {
    prefixesToNamespaces=new HashMap<String,String>();
  }
  return prefixesToNamespaces;
}
Program: 65651
Project: 65651
Buggy source:
/** 
 * INTERNAL: Returns a Vector of of Namespace objects in the current Namespace Resolver Used for deployment XML
 * @return  A Vector containing the namespace URIs in the namespace resolver
 */
public Vector getNamespaces(){
  Vector names=new Vector(prefixesToNamespaces.size());
  for (  Entry<String,String> entry : prefixesToNamespaces.entrySet()) {
    Namespace namespace=new Namespace(entry.getKey(),entry.getValue());
    names.addElement(namespace);
  }
  return names;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Returns a Vector of of Namespace objects in the current Namespace Resolver Used for deployment XML
 * @return  A Vector containing the namespace URIs in the namespace resolver
 */
public Vector getNamespaces(){
  if (!hasPrefixesToNamespaces()) {
    return new Vector(0);
  }
  Vector names=new Vector(prefixesToNamespaces.size());
  for (  Entry<String,String> entry : prefixesToNamespaces.entrySet()) {
    Namespace namespace=new Namespace(entry.getKey(),entry.getValue());
    names.addElement(namespace);
  }
  return names;
}
Program: 65652
Project: 65652
Buggy source:
public void removeNamespace(String prefix){
  prefixesToNamespaces.remove(prefix);
}

Fixed version (ground truth):
public void removeNamespace(String prefix){
  if (null != prefixesToNamespaces) {
    prefixesToNamespaces.remove(prefix);
  }
}
Program: 65653
Project: 65653
Buggy source:
/** 
 * Adds a namespace to the collection of namespaces on the NamespaceResolver
 * @param prefix  The prefix for a namespace
 * @param namespaceURI  The namespace URI associated with the specified prefix
 */
public void put(String prefix,String namespaceURI){
  if (null == prefix || 0 == prefix.length()) {
    defaultNamespaceURI=namespaceURI;
  }
 else {
    prefixesToNamespaces.put(prefix,namespaceURI.intern());
  }
}

Fixed version (ground truth):
/** 
 * Adds a namespace to the collection of namespaces on the NamespaceResolver
 * @param prefix  The prefix for a namespace
 * @param namespaceURI  The namespace URI associated with the specified prefix
 */
public void put(String prefix,String namespaceURI){
  if (null == prefix || 0 == prefix.length()) {
    defaultNamespaceURI=namespaceURI;
  }
 else {
    getPrefixesToNamespaces().put(prefix,namespaceURI.intern());
  }
}
Program: 65654
Project: 65654
Buggy source:
/** 
 * Returns the namespace URI associated with a specified namespace prefix
 * @param prefix The prefix to lookup a namespace URI for
 * @return The namespace URI associated with the specified prefix
 */
public String resolveNamespacePrefix(String prefix){
  if (null == prefix || prefix.length() == 0) {
    return defaultNamespaceURI;
  }
  String uri=prefixesToNamespaces.get(prefix);
  if (null != uri) {
    return uri;
  }
 else   if (XMLConstants.XML_NAMESPACE_PREFIX.equals(prefix)) {
    return XMLConstants.XML_NAMESPACE_URL;
  }
 else   if (XMLConstants.XMLNS.equals(prefix)) {
    return XMLConstants.XMLNS_URL;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the namespace URI associated with a specified namespace prefix
 * @param prefix The prefix to lookup a namespace URI for
 * @return The namespace URI associated with the specified prefix
 */
public String resolveNamespacePrefix(String prefix){
  if (null == prefix || prefix.length() == 0) {
    return defaultNamespaceURI;
  }
  String uri=null;
  if (null != prefixesToNamespaces) {
    uri=prefixesToNamespaces.get(prefix);
  }
  if (null != uri) {
    return uri;
  }
 else   if (XMLConstants.XML_NAMESPACE_PREFIX.equals(prefix)) {
    return XMLConstants.XML_NAMESPACE_URL;
  }
 else   if (XMLConstants.XMLNS.equals(prefix)) {
    return XMLConstants.XMLNS_URL;
  }
  return null;
}
Program: 65655
Project: 65655
Buggy source:
public boolean hasMoreElements(){
  return iterator.hasNext();
}

Fixed version (ground truth):
public boolean hasMoreElements(){
  if (null == iterator) {
    return false;
  }
  return iterator.hasNext();
}
Program: 65656
Project: 65656
Buggy source:
/** 
 * Default constructor, creates a new NamespaceResolver.
 */
public NamespaceResolver(){
  super();
  prefixesToNamespaces=new HashMap<String,String>();
}

Fixed version (ground truth):
/** 
 * Default constructor, creates a new NamespaceResolver.
 */
public NamespaceResolver(){
  super();
}
Program: 65657
Project: 65657
Buggy source:
/** 
 * Returns the list of prefixes in the NamespaceResolver
 * @return An Enumeration containing the prefixes in the NamespaceResolver
 */
public Enumeration getPrefixes(){
  return new IteratorEnumeration(prefixesToNamespaces.keySet().iterator());
}

Fixed version (ground truth):
/** 
 * Returns the list of prefixes in the NamespaceResolver
 * @return An Enumeration containing the prefixes in the NamespaceResolver
 */
public Enumeration getPrefixes(){
  if (hasPrefixesToNamespaces()) {
    return new IteratorEnumeration(getPrefixesToNamespaces().keySet().iterator());
  }
 else {
    return new IteratorEnumeration(null);
  }
}
Program: 65658
Project: 65658
Buggy source:
/** 
 * INTERNAL: Add the namespace declarations to the XML document.
 * @param namespaceResolver The NamespaceResolver contains the namespaceprefix and URI pairings that need to be declared.
 */
public void namespaceDeclarations(NamespaceResolver namespaceResolver){
  if (namespaceResolver == null) {
    return;
  }
  String namespaceURI=namespaceResolver.getDefaultNamespaceURI();
  if (null != namespaceURI) {
    attribute(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,XMLConstants.XMLNS,namespaceURI);
  }
  for (  Entry<String,String> entry : namespaceResolver.getPrefixesToNamespaces().entrySet()) {
    String namespacePrefix=entry.getKey();
    attribute(XMLConstants.XMLNS_URL,namespacePrefix,XMLConstants.XMLNS + XMLConstants.COLON + namespacePrefix,entry.getValue());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Add the namespace declarations to the XML document.
 * @param namespaceResolver The NamespaceResolver contains the namespaceprefix and URI pairings that need to be declared.
 */
public void namespaceDeclarations(NamespaceResolver namespaceResolver){
  if (namespaceResolver == null) {
    return;
  }
  String namespaceURI=namespaceResolver.getDefaultNamespaceURI();
  if (null != namespaceURI) {
    attribute(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,XMLConstants.XMLNS,namespaceURI);
  }
  if (namespaceResolver.hasPrefixesToNamespaces()) {
    for (    Entry<String,String> entry : namespaceResolver.getPrefixesToNamespaces().entrySet()) {
      String namespacePrefix=entry.getKey();
      attribute(XMLConstants.XMLNS_URL,namespacePrefix,XMLConstants.XMLNS + XMLConstants.COLON + namespacePrefix,entry.getValue());
    }
  }
}
Program: 65659
Project: 65659
Buggy source:
/** 
 * Retrieves the width taken by the check box icon including the gap between the icon and the text.
 * @return The size of the icon and the gap
 */
public static int checkBoxIconWidth(){
  if (checkBoxIconWidth == -1) {
    Icon icon=(Icon)UIManager.get("String_Node_Str");
    checkBoxIconWidth=(icon != null) ? icon.getIconWidth() : 0;
    Integer gap=(Integer)UIManager.get("String_Node_Str");
    checkBoxIconWidth+=(gap != null) ? gap.intValue() + 4 : 4;
  }
  return checkBoxIconWidth;
}

Fixed version (ground truth):
/** 
 * Retrieves the width taken by the check box icon including the gap between the icon and the text.
 * @return The size of the icon and the gap
 */
public static int checkBoxIconWidth(){
  if (checkBoxIconWidth == -1) {
    Icon icon=checkBoxIcon();
    checkBoxIconWidth=(icon != null) ? icon.getIconWidth() : 0;
    checkBoxIconWidth+=checkBoxTextIconGap();
    checkBoxIconWidth+=new JCheckBox().getInsets().left;
  }
  return checkBoxIconWidth;
}
Program: 65660
Project: 65660
Buggy source:
@Override protected Object getControlObject(){
  boolean includeSysId=false;
  if (this.getName().endsWith("String_Node_Str")) {
    includeSysId=true;
  }
  Data d=new Data();
  d.key="String_Node_Str";
  d.data1="String_Node_Str";
  d.data2="String_Node_Str";
  d.data3="String_Node_Str";
  d.locator=new TestLocator(15,89,includeSysId);
  SubData sd1=new DetailData();
  sd1.info="String_Node_Str";
  sd1.setLoc(new TestLocator(20,35,includeSysId));
  d.subData.add(sd1);
  SubData sd2=new SubData();
  sd2.info="String_Node_Str";
  sd2.setLoc(new TestLocator(30,26,includeSysId));
  d.subData.add(sd2);
  SubData sd3=new LeafData();
  sd3.info="String_Node_Str";
  sd3.setLoc(new TestLocator(32,33,includeSysId));
  d.subData.add(sd3);
  if (this.getName().endsWith("String_Node_Str") || this.getName().endsWith("String_Node_Str")) {
    TestLocator noLoc=new TestLocator(0,0,false);
    d.locator=noLoc;
    sd1.setLoc(noLoc);
    sd2.setLoc(noLoc);
    sd3.setLoc(noLoc);
  }
  return d;
}

Fixed version (ground truth):
@Override protected Object getControlObject(){
  boolean includeSysId=false;
  if (this.getName().endsWith("String_Node_Str")) {
    includeSysId=true;
  }
  Data d=new Data();
  d.key="String_Node_Str";
  d.data1="String_Node_Str";
  d.data2="String_Node_Str";
  d.data3="String_Node_Str";
  d.locator=new TestLocator(15,89,29,includeSysId);
  SubData sd1=new DetailData();
  sd1.info="String_Node_Str";
  sd1.setLoc(new TestLocator(20,35,4,includeSysId));
  d.subData.add(sd1);
  SubData sd2=new SubData();
  sd2.info="String_Node_Str";
  sd2.setLoc(new TestLocator(30,26,17,includeSysId));
  d.subData.add(sd2);
  SubData sd3=new LeafData();
  sd3.info="String_Node_Str";
  sd3.setLoc(new TestLocator(32,33,4,includeSysId));
  d.subData.add(sd3);
  if (this.getName().endsWith("String_Node_Str") || this.getName().endsWith("String_Node_Str")) {
    TestLocator noLoc=new TestLocator(0,0,0,false);
    d.locator=noLoc;
    sd1.setLoc(noLoc);
    sd2.setLoc(noLoc);
    sd3.setLoc(noLoc);
  }
  return d;
}
Program: 65661
Project: 65661
Buggy source:
public TestLocator(int l,int c,boolean sysId){
  this.includeSysId=sysId;
  URL url=ClassLoader.getSystemClassLoader().getResource(XML_RESOURCE);
  this.controlSysId=url.toExternalForm();
  this.line=l;
  this.column=c;
}

Fixed version (ground truth):
public TestLocator(int l,int c,int alt,boolean sysId){
  this.includeSysId=sysId;
  URL url=ClassLoader.getSystemClassLoader().getResource(XML_RESOURCE);
  this.controlSysId=url.toExternalForm();
  this.line=l;
  this.column=c;
  this.alternateColumn=alt;
}
Program: 65662
Project: 65662
Buggy source:
public Object convertObjectToSource(Object obj){
  if (obj instanceof Source) {
    return obj;
  }
  if (obj instanceof DataHandler) {
    try {
      Source source=(Source)((DataHandler)obj).getContent();
      return source;
    }
 catch (    Exception ex) {
    }
  }
 else   if (obj instanceof byte[]) {
    ByteArrayInputStream stream=new ByteArrayInputStream((byte[])obj);
    return new StreamSource(stream);
  }
 else   if (obj instanceof Byte[]) {
    Byte[] objectBytes=(Byte[])obj;
    byte[] bytes=new byte[objectBytes.length];
    for (int i=0; i < objectBytes.length; i++) {
      bytes[i]=objectBytes[i].byteValue();
    }
    ByteArrayInputStream stream=new ByteArrayInputStream(bytes);
    return new StreamSource(stream);
  }
  return null;
}

Fixed version (ground truth):
public Object convertObjectToSource(Object obj){
  if (obj == null) {
    return null;
  }
  if (obj instanceof Source) {
    return obj;
  }
  if (obj.getClass() == ClassConstants.STRING) {
    return new StreamSource(new StringReader((String)obj));
  }
  if (obj instanceof DataHandler) {
    try {
      InputStream object=((DataHandler)obj).getInputStream();
      return new StreamSource(object);
    }
 catch (    Exception ex) {
      try {
        Object object=((DataHandler)obj).getContent();
        convertObjectToSource(object);
      }
 catch (      Exception ioException) {
        throw ConversionException.couldNotBeConverted(obj,Source.class);
      }
    }
  }
 else   if (obj instanceof byte[]) {
    ByteArrayInputStream stream=new ByteArrayInputStream((byte[])obj);
    return new StreamSource(stream);
  }
 else   if (obj instanceof Byte[]) {
    Byte[] objectBytes=(Byte[])obj;
    byte[] bytes=new byte[objectBytes.length];
    for (int i=0; i < objectBytes.length; i++) {
      bytes[i]=objectBytes[i].byteValue();
    }
    ByteArrayInputStream stream=new ByteArrayInputStream(bytes);
    return new StreamSource(stream);
  }
 else   if (obj instanceof InputStream) {
    return new StreamSource((InputStream)obj);
  }
  return null;
}
Program: 65663
Project: 65663
Buggy source:
protected void reportElementEvents(Element elem) throws SAXException {
  this.currentNode=elem;
  IndexedAttributeList attributes=buildAttributeList(elem);
  String qname;
  String lname=elem.getLocalName();
  if (lname == null) {
    lname=elem.getNodeName();
    qname=lname;
    handlePrefixedAttribute(elem);
  }
 else {
    qname=getQName(elem);
  }
  contentHandler.startElement(elem.getNamespaceURI(),lname,qname,attributes);
  handleChildNodes(elem.getChildNodes());
  contentHandler.endElement(elem.getNamespaceURI(),lname,qname);
  endPrefixMappings(elem);
}

Fixed version (ground truth):
protected void reportElementEvents(Element elem) throws SAXException {
  this.currentNode=elem;
  IndexedAttributeList attributes=buildAttributeList(elem);
  String qname;
  String lname=elem.getLocalName();
  if (lname == null) {
    lname=elem.getNodeName();
    qname=lname;
    handlePrefixedAttribute(elem);
  }
 else {
    qname=getQName(elem);
  }
  String namespaceUri=elem.getNamespaceURI();
  if (namespaceUri == null) {
    namespaceUri="String_Node_Str";
  }
  contentHandler.startElement(namespaceUri,lname,qname,attributes);
  handleChildNodes(elem.getChildNodes());
  contentHandler.endElement(namespaceUri,lname,qname);
  endPrefixMappings(elem);
}
Program: 65677
Project: 65677
Buggy source:
/** 
 * Update the string value for the xsi:type attribute to use the prefix from the current record if possible
 */
private String updateTypeValue(String schemaContext,NamespaceResolver oldNsResolver,XMLRecord record,boolean addToNamespaceResolver){
  if (schemaContext == null) {
    return null;
  }
  NamespaceResolver newNsResolver=record.getNamespaceResolver();
  int idx=schemaContext.lastIndexOf("String_Node_Str");
  if (idx > -1) {
    schemaContext=schemaContext.substring(idx + 1);
  }
  idx=schemaContext.indexOf(XMLConstants.COLON);
  String localPart=null;
  if (idx != -1) {
    String prefix=schemaContext.substring(0,idx);
    localPart=schemaContext.substring(idx + 1);
    String uri=oldNsResolver.resolveNamespacePrefix(prefix);
    String newUri=newNsResolver.resolveNamespacePrefix(prefix);
    if (uri != null && (newUri == null || !(newUri.equals(uri)))) {
      prefix=newNsResolver.resolveNamespaceURI(uri);
      if (prefix == null) {
        String defaultUri=record.getNamespaceResolver().getDefaultNamespaceURI();
        if (defaultUri != null && defaultUri.equals(uri)) {
          return localPart;
        }
        prefix=newNsResolver.generatePrefix();
        writeNamespace(record,prefix,uri,addToNamespaceResolver);
      }
    }
    return prefix + XMLConstants.COLON + localPart;
  }
 else {
    return schemaContext;
  }
}

Fixed version (ground truth):
/** 
 * Update the string value for the xsi:type attribute to use the prefix from the current record if possible
 */
private String updateTypeValue(String schemaContext,NamespaceResolver oldNsResolver,XMLRecord record,boolean addToNamespaceResolver){
  if (schemaContext == null) {
    return null;
  }
  NamespaceResolver newNsResolver=record.getNamespaceResolver();
  int idx=schemaContext.lastIndexOf("String_Node_Str");
  if (idx > -1) {
    schemaContext=schemaContext.substring(idx + 1);
  }
  idx=schemaContext.indexOf(XMLConstants.COLON);
  String localPart=null;
  if (idx != -1) {
    String prefix=schemaContext.substring(0,idx);
    localPart=schemaContext.substring(idx + 1);
    String uri=oldNsResolver.resolveNamespacePrefix(prefix);
    String newUri=newNsResolver.resolveNamespacePrefix(prefix);
    if (!record.isNamespaceAware()) {
      return localPart;
    }
    if (uri != null && (newUri == null || !(newUri.equals(uri)))) {
      prefix=newNsResolver.resolveNamespaceURI(uri);
      if (prefix == null) {
        String defaultUri=record.getNamespaceResolver().getDefaultNamespaceURI();
        if (defaultUri != null && defaultUri.equals(uri)) {
          return localPart;
        }
        prefix=newNsResolver.generatePrefix();
        writeNamespace(record,prefix,uri,addToNamespaceResolver);
      }
    }
    return prefix + record.getNamespaceSeparator() + localPart;
  }
 else {
    return schemaContext;
  }
}
Program: 65681
Project: 65681
Buggy source:
public void setNamespaceAware(boolean isNamespaceAware){
  this.isNamespaceAware=isNamespaceAware;
}

Fixed version (ground truth):
public void setNamespaceAware(boolean isNamespaceAware){
  this.namespaceAware=isNamespaceAware;
}
Program: 65682
Project: 65682
Buggy source:
public XPathFragment(){
  super();
  setNamespaceAware(true);
}

Fixed version (ground truth):
public XPathFragment(String xpathString,char namespaceSeparator,boolean namespaceAware){
  this.namespaceSeparator=namespaceSeparator;
  setNamespaceAware(namespaceAware);
  setXPath(xpathString);
}
Program: 65683
Project: 65683
Buggy source:
private void setupNamespaceInformation(String xpathString){
  int nsindex=xpathString.indexOf(XMLConstants.COLON);
  if (nsindex != -1) {
    hasNamespace=true;
    localName=xpathString.substring(nsindex + 1).intern();
    prefix=xpathString.substring(0,nsindex).intern();
  }
 else {
    localName=xpathString.intern();
  }
}

Fixed version (ground truth):
private void setupNamespaceInformation(String xpathString){
  int nsindex=xpathString.indexOf(namespaceSeparator);
  if (nsindex != -1) {
    hasNamespace=true;
    localName=xpathString.substring(nsindex + 1).intern();
    prefix=xpathString.substring(0,nsindex).intern();
  }
 else {
    localName=xpathString.intern();
  }
}
Program: 65684
Project: 65684
Buggy source:
public boolean isNamespaceAware(){
  return isNamespaceAware;
}

Fixed version (ground truth):
public boolean isNamespaceAware(){
  return namespaceAware;
}
Program: 65685
Project: 65685
Buggy source:
public boolean equals(Object object){
  try {
    if (null == object) {
      return false;
    }
 else     if (this == object) {
      return true;
    }
    XPathFragment xPathFragment=(XPathFragment)object;
    if (null == predicate && null != xPathFragment.getPredicate()) {
      return false;
    }
    if (null != predicate && !predicate.equals(xPathFragment.getPredicate())) {
      return false;
    }
    if (isNamespaceAware && xPathFragment.isNamespaceAware) {
      if (namespaceURI == null) {
        if (xPathFragment.getNamespaceURI() != null) {
          return false;
        }
      }
 else {
        if (xPathFragment.getNamespaceURI() == null) {
          return false;
        }
 else         if (namespaceURI != xPathFragment.getNamespaceURI() && !(namespaceURI.equals(xPathFragment.getNamespaceURI()))) {
          return false;
        }
      }
    }
    return ((nameIsText && xPathFragment.nameIsText()) || (getLocalName() == xPathFragment.getLocalName()) || ((getLocalName() != null) && getLocalName().equals(xPathFragment.getLocalName()))) && (this.indexValue == xPathFragment.getIndexValue()) && (nameIsText == xPathFragment.nameIsText());
  }
 catch (  ClassCastException e) {
    return false;
  }
}

Fixed version (ground truth):
public boolean equals(Object object){
  try {
    if (null == object) {
      return false;
    }
 else     if (this == object) {
      return true;
    }
    XPathFragment xPathFragment=(XPathFragment)object;
    if (null == predicate && null != xPathFragment.getPredicate()) {
      return false;
    }
    if (null != predicate && !predicate.equals(xPathFragment.getPredicate())) {
      return false;
    }
    if (namespaceAware && xPathFragment.isNamespaceAware()) {
      if (namespaceURI == null) {
        if (xPathFragment.getNamespaceURI() != null) {
          return false;
        }
      }
 else {
        if (xPathFragment.getNamespaceURI() == null) {
          return false;
        }
 else         if (namespaceURI != xPathFragment.getNamespaceURI() && !(namespaceURI.equals(xPathFragment.getNamespaceURI()))) {
          return false;
        }
      }
    }
    return ((nameIsText && xPathFragment.nameIsText()) || (getLocalName() == xPathFragment.getLocalName()) || ((getLocalName() != null) && getLocalName().equals(xPathFragment.getLocalName()))) && (this.indexValue == xPathFragment.getIndexValue()) && (nameIsText == xPathFragment.nameIsText());
  }
 catch (  ClassCastException e) {
    return false;
  }
}
Program: 65686
Project: 65686
Buggy source:
/** 
 * Create a new XPathQName with the specified local name and namespace
 * @param namespaceUri The namespace to associate with this XPathQName
 * @param localName The local name to associate with this XPathQName
 * @param namespaceAware set if namespaces should be processed or ignored
 */
public XPathQName(String namespaceUri,String localName,boolean namespaceAware){
  if (namespaceUri == null) {
    this.namespaceUri=XMLConstants.EMPTY_STRING;
  }
 else {
    this.namespaceUri=namespaceUri;
  }
  this.localName=localName;
  isNamespaceAware=namespaceAware;
}

Fixed version (ground truth):
/** 
 * Create a new XPathQName with the specified QName
 * @param QName The QName to build this XPathQName from 
 * @param namespaceAware set if namespaces should be processed or ignored
 */
public XPathQName(QName qname,boolean namespaceAware){
  this(qname.getNamespaceURI(),qname.getLocalPart(),namespaceAware);
}
Program: 65688
Project: 65688
Buggy source:
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (null != getField()) {
    setField(getDescriptor().buildField(getField()));
  }
  ContainerPolicy cp=getContainerPolicy();
  if (cp != null) {
    if (cp.getContainerClass() == null) {
      Class cls=session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
      cp.setContainerClass(cls);
    }
  }
  XMLDescriptor descriptor=(XMLDescriptor)this.getDescriptor();
  XMLDescriptor targetDescriptor=(XMLDescriptor)getReferenceDescriptor();
  for (int index=0; index < sourceToTargetKeys.size(); index++) {
    XMLField sourceField=(XMLField)sourceToTargetKeys.get(index);
    XMLField targetField=(XMLField)sourceToTargetKeyFieldAssociations.remove(sourceField);
    sourceField=(XMLField)descriptor.buildField(sourceField);
    sourceToTargetKeys.set(index,sourceField);
    if (null != targetField) {
      targetField=(XMLField)targetDescriptor.buildField(targetField);
    }
    sourceToTargetKeyFieldAssociations.put(sourceField,targetField);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (null != getField()) {
    setField(getDescriptor().buildField(getField()));
  }
  ContainerPolicy cp=getContainerPolicy();
  if (cp != null) {
    if (cp.getContainerClass() == null) {
      Class cls=session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
      cp.setContainerClass(cls);
    }
  }
}
Program: 65690
Project: 65690
Buggy source:
/** 
 * Handle prefixed attribute - may need to declare the namespace  URI locally.
 */
protected void handlePrefixedAttribute(Element elem) throws SAXException {
  String prefix=elem.getPrefix();
  String uri=resolveNamespacePrefix(prefix);
  if (prefix == null && uri == null) {
    return;
  }
  if (uri == null || !uri.equals(elem.getNamespaceURI())) {
    NamespaceResolver tmpresolver=getTempResolver(elem);
    tmpresolver.put(prefix,elem.getNamespaceURI());
    if (!nsresolverList.contains(tmpresolver)) {
      nsresolverList.add(tmpresolver);
    }
    getContentHandler().startPrefixMapping(prefix,elem.getNamespaceURI());
  }
}

Fixed version (ground truth):
/** 
 * Handle prefixed attribute - may need to declare the namespace  URI locally.
 */
protected void handlePrefixedAttribute(Element elem) throws SAXException {
  String prefix=elem.getPrefix();
  if (prefix == null) {
    prefix=XMLConstants.EMPTY_STRING;
  }
  String uri=resolveNamespacePrefix(prefix);
  if (prefix == XMLConstants.EMPTY_STRING && uri == null) {
    return;
  }
  if (uri == null || !uri.equals(elem.getNamespaceURI())) {
    NamespaceResolver tmpresolver=getTempResolver(elem);
    tmpresolver.put(prefix,elem.getNamespaceURI());
    if (!nsresolverList.contains(tmpresolver)) {
      nsresolverList.add(tmpresolver);
    }
    getContentHandler().startPrefixMapping(prefix,elem.getNamespaceURI());
  }
}