nus-yam/ex-repair huggingface dataset:
Program: 65923
Project: 65923
Buggy source:
/** 
 * INTERNAL:
 */
public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    contentHandler.endElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName());
    List<String> currentLevelPrefixMappings=prefixMappingsDeque.pop();
    if (null != currentLevelPrefixMappings && Collections.EMPTY_LIST != currentLevelPrefixMappings) {
      for (      String prefix : currentLevelPrefixMappings) {
        contentHandler.endPrefixMapping(prefix);
      }
    }
    isStartElementOpen=false;
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    contentHandler.endElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName());
    List<String> currentLevelPrefixMappings=prefixMappings.remove(prefixMappings.size() - 1);
    if (null != currentLevelPrefixMappings) {
      for (      String prefix : currentLevelPrefixMappings) {
        contentHandler.endPrefixMapping(prefix);
      }
    }
    isStartElementOpen=false;
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 65924
Project: 65924
Buggy source:
public ContentHandlerRecord(){
  prefixMappingsDeque=new ArrayDeque<List<String>>();
  currentLevelPrefixMappings=Collections.EMPTY_LIST;
  attributes=new AttributesImpl();
}

Fixed version (ground truth):
public ContentHandlerRecord(){
  prefixMappings=new ArrayList<List<String>>();
  currentLevelPrefixMappings=null;
  attributes=new AttributesImpl();
}
Program: 65925
Project: 65925
Buggy source:
@BeforeClass public static void setUp() throws WSDLException {
  builder.setProjectName(PROC8_TEST);
  builder.setTargetNamespace(PROC8_NAMESPACE);
  PLSQLProcedureOperationModel p1Model=new PLSQLProcedureOperationModel();
  p1Model.setName(PROC8_TEST);
  p1Model.setReturnType("String_Node_Str");
  p1Model.setOverload(2);
  p1Model.setSchemaPattern("String_Node_Str");
  p1Model.setCatalogPattern(PACKAGE_NAME);
  p1Model.setProcedurePattern(PROC8);
  builder.getOperations().add(p1Model);
  serviceSetup(ENDPOINT_ADDRESS,new OverloadedPLSQLStoredProcedureSimpleArgsTestSuite());
}

Fixed version (ground truth):
@BeforeClass public static void setUp() throws WSDLException {
  builder.setProjectName(PROC8_TEST);
  builder.setTargetNamespace(PROC8_NAMESPACE);
  PLSQLProcedureOperationModel p1Model=new PLSQLProcedureOperationModel();
  p1Model.setName(PROC8_TEST);
  p1Model.setReturnType("String_Node_Str");
  p1Model.setOverload(2);
  p1Model.setCatalogPattern(PACKAGE_NAME);
  p1Model.setProcedurePattern(PROC8);
  builder.getOperations().add(p1Model);
  serviceSetup(ENDPOINT_ADDRESS,new OverloadedPLSQLStoredProcedureSimpleArgsTestSuite());
}
Program: 65926
Project: 65926
Buggy source:
@BeforeClass public static void setUp() throws WSDLException {
  builder.setProjectName(PROC7_TEST);
  builder.setTargetNamespace(PROC7_NAMESPACE);
  PLSQLProcedureOperationModel p1Model=new PLSQLProcedureOperationModel();
  p1Model.setName(PROC7_TEST);
  p1Model.setReturnType("String_Node_Str");
  p1Model.setOverload(2);
  p1Model.setSchemaPattern("String_Node_Str");
  p1Model.setCatalogPattern(PACKAGE_NAME);
  p1Model.setProcedurePattern(PROC7);
  builder.getOperations().add(p1Model);
  serviceSetup(ENDPOINT_ADDRESS,new OverloadedPLSQLStoredProcedureTestSuite());
}

Fixed version (ground truth):
@BeforeClass public static void setUp() throws WSDLException {
  builder.setProjectName(PROC7_TEST);
  builder.setTargetNamespace(PROC7_NAMESPACE);
  PLSQLProcedureOperationModel p1Model=new PLSQLProcedureOperationModel();
  p1Model.setName(PROC7_TEST);
  p1Model.setReturnType("String_Node_Str");
  p1Model.setOverload(2);
  p1Model.setCatalogPattern(PACKAGE_NAME);
  p1Model.setProcedurePattern(PROC7);
  builder.getOperations().add(p1Model);
  serviceSetup(ENDPOINT_ADDRESS,new OverloadedPLSQLStoredProcedureTestSuite());
}
Program: 65936
Project: 65936
Buggy source:
public void testDefaultNamespaceOverride() throws Exception {
  if (System.getProperty("String_Node_Str").contains("String_Node_Str")) {
    JAXBContext ctx=JAXBContextFactory.createContext(new Class[]{Employee.class},null);
    StringWriter writer=new StringWriter();
    XMLStreamWriter streamWriter=XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
    streamWriter.writeStartElement("String_Node_Str","String_Node_Str","String_Node_Str");
    streamWriter.writeDefaultNamespace("String_Node_Str");
    Marshaller marshaller=ctx.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FRAGMENT,new Boolean(true));
    marshaller.marshal(new JAXBElement(new QName("String_Node_Str"),Employee.class,new Employee()),streamWriter);
    streamWriter.writeEndElement();
    streamWriter.writeEndDocument();
    streamWriter.flush();
    String xml="String_Node_Str";
    assertTrue("String_Node_Str" + writer.toString(),writer.toString().equals(xml));
  }
}

Fixed version (ground truth):
public void testDefaultNamespaceOverride() throws Exception {
  if (System.getProperty("String_Node_Str").contains("String_Node_Str")) {
    JAXBContext ctx=JAXBContextFactory.createContext(new Class[]{Employee.class},null);
    StringWriter writer=new StringWriter();
    XMLStreamWriter streamWriter=XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
    streamWriter.writeStartElement("String_Node_Str","String_Node_Str","String_Node_Str");
    streamWriter.writeDefaultNamespace("String_Node_Str");
    Marshaller marshaller=ctx.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FRAGMENT,new Boolean(true));
    marshaller.marshal(new JAXBElement(new QName("String_Node_Str"),Employee.class,new Employee()),streamWriter);
    streamWriter.writeEndElement();
    streamWriter.writeEndDocument();
    streamWriter.flush();
    String xml="String_Node_Str";
    String xml2="String_Node_Str";
    String writerString=writer.toString();
    assertTrue("String_Node_Str" + writerString,writerString.equals(xml) || writerString.equals(xml2));
  }
}
Program: 65940
Project: 65940
Buggy source:
private int hasIndex(String xpathString){
  int index;
  int startindex=xpathString.lastIndexOf('[');
  if ((startindex != -1) && (xpathString.lastIndexOf(']') != -1)) {
    setContainsIndex(true);
    StringTokenizer st=new StringTokenizer(xpathString,"String_Node_Str");
    String element=st.nextToken();
    String indexString=st.nextToken();
    try {
      index=Integer.valueOf(indexString).intValue();
    }
 catch (    NumberFormatException e) {
      setShouldExecuteSelectNodes(true);
      index=-1;
    }
    shortName=element;
  }
 else {
    index=-1;
  }
  return index;
}

Fixed version (ground truth):
private int hasIndex(String xpathString){
  int index=-1;
  int startindex=xpathString.lastIndexOf('[');
  if ((startindex != -1) && (xpathString.lastIndexOf(']') != -1)) {
    StringTokenizer st=new StringTokenizer(xpathString,"String_Node_Str");
    String element=st.nextToken();
    while (st.hasMoreTokens()) {
      String indexString=st.nextToken();
      try {
        index=Integer.valueOf(indexString).intValue();
        setContainsIndex(true);
      }
 catch (      NumberFormatException e) {
        StringTokenizer st2=new StringTokenizer(indexString,"String_Node_Str");
        if (2 == st2.countTokens()) {
          XPathFragment xPathFragment=new XPathFragment(st2.nextToken());
          String value=st2.nextToken();
          value=value.substring(1,value.length() - 1);
          predicate=new XPathPredicate(xPathFragment,value);
        }
 else {
          setContainsIndex(true);
        }
        setShouldExecuteSelectNodes(true);
      }
    }
    shortName=element;
  }
 else {
    index=-1;
  }
  return index;
}
Program: 65941
Project: 65941
Buggy source:
public boolean equals(Object object){
  try {
    if (null == object) {
      return false;
    }
 else     if (this == object) {
      return true;
    }
    XPathFragment xPathFragment=(XPathFragment)object;
    return ((nameIsText && xPathFragment.nameIsText()) || (localName == xPathFragment.getLocalName()) || ((localName != null) && localName.equals(xPathFragment.getLocalName()))) && ((namespaceURI == xPathFragment.getNamespaceURI()) || ((namespaceURI != null) && namespaceURI.equals(xPathFragment.getNamespaceURI()))) && (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;
    }
    return ((nameIsText && xPathFragment.nameIsText()) || (localName == xPathFragment.getLocalName()) || ((localName != null) && localName.equals(xPathFragment.getLocalName()))) && ((namespaceURI == xPathFragment.getNamespaceURI()) || ((namespaceURI != null) && namespaceURI.equals(xPathFragment.getNamespaceURI()))) && (this.indexValue == xPathFragment.getIndexValue())&& (nameIsText == xPathFragment.nameIsText());
  }
 catch (  ClassCastException e) {
    return false;
  }
}
Program: 65942
Project: 65942
Buggy source:
public boolean startElement(MarshalRecord marshalRecord,XPathFragment anXPathFragment,Object object,AbstractSession session,NamespaceResolver namespaceResolver,TreeObjectBuilder compositeObjectBuilder,Object compositeObject){
  if (null == anXPathFragment) {
    return false;
  }
  marshalRecord.openStartElement(anXPathFragment,namespaceResolver);
  boolean hasValue=false;
  if (null != attributeChildren) {
    for (int x=0, size=attributeChildren.size(); x < size; x++) {
      XPathNode attributeNode=attributeChildren.get(x);
      hasValue=attributeNode.marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance(),null) || hasValue;
    }
  }
  if (anyAttributeNode != null) {
    hasValue=anyAttributeNode.marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance(),null) || hasValue;
  }
  if (null != compositeObjectBuilder) {
    hasValue=compositeObjectBuilder.marshalAttributes(marshalRecord,compositeObject,session) || hasValue;
  }
  marshalRecord.closeStartElement();
  return hasValue;
}

Fixed version (ground truth):
public boolean startElement(MarshalRecord marshalRecord,XPathFragment anXPathFragment,Object object,AbstractSession session,NamespaceResolver namespaceResolver,TreeObjectBuilder compositeObjectBuilder,Object compositeObject){
  if (null == anXPathFragment) {
    return false;
  }
  marshalRecord.openStartElement(anXPathFragment,namespaceResolver);
  boolean hasValue=false;
  marshalRecord.predicateAttribute(anXPathFragment,namespaceResolver);
  if (null != attributeChildren) {
    for (int x=0, size=attributeChildren.size(); x < size; x++) {
      XPathNode attributeNode=attributeChildren.get(x);
      hasValue=attributeNode.marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance(),null) || hasValue;
    }
  }
  if (anyAttributeNode != null) {
    hasValue=anyAttributeNode.marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance(),null) || hasValue;
  }
  if (null != compositeObjectBuilder) {
    hasValue=compositeObjectBuilder.marshalAttributes(marshalRecord,compositeObject,session) || hasValue;
  }
  marshalRecord.closeStartElement();
  return hasValue;
}
Program: 65943
Project: 65943
Buggy source:
private void initializeXPathFragment(XPathFragment xPathFragment){
  String localName=xPathFragment.getLocalName();
  if (localName != null && !localName.equals(XMLConstants.EMPTY_STRING)) {
    if (null == xPathFragment.getNamespaceURI()) {
      if (xPathFragment.hasNamespace()) {
        if (null == namespaceResolver) {
          throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
        }
 else {
          String uri=namespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
          if (null == uri && null != xPathFragment.getPrefix()) {
            throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
          }
          xPathFragment.setNamespaceURI(uri);
        }
      }
 else       if (!xPathFragment.isAttribute() && null != namespaceResolver) {
        xPathFragment.setNamespaceURI(namespaceResolver.getDefaultNamespaceURI());
      }
    }
  }
  XPathFragment nextXPathFragment=xPathFragment.getNextFragment();
  if (null != nextXPathFragment) {
    initializeXPathFragment(nextXPathFragment);
  }
}

Fixed version (ground truth):
private void initializeXPathFragment(XPathFragment xPathFragment){
  XPathPredicate predicate=xPathFragment.getPredicate();
  if (null != predicate) {
    initializeXPathFragment(predicate.getXPathFragment());
  }
  String localName=xPathFragment.getLocalName();
  if (localName != null && !localName.equals(XMLConstants.EMPTY_STRING)) {
    if (null == xPathFragment.getNamespaceURI()) {
      if (xPathFragment.hasNamespace()) {
        if (null == namespaceResolver) {
          throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
        }
 else {
          String uri=namespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
          if (null == uri && null != xPathFragment.getPrefix()) {
            throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
          }
          xPathFragment.setNamespaceURI(uri);
        }
      }
 else       if (!xPathFragment.isAttribute() && null != namespaceResolver) {
        xPathFragment.setNamespaceURI(namespaceResolver.getDefaultNamespaceURI());
      }
    }
  }
  XPathFragment nextXPathFragment=xPathFragment.getNextFragment();
  if (null != nextXPathFragment) {
    initializeXPathFragment(nextXPathFragment);
  }
}
Program: 65944
Project: 65944
Buggy source:
/** 
 * INTERNAL: Trigger that the grouping elements should be written.  This is normally done when something like a mapping has a non-null value that is marshalled.
 * @param namespaceResolver The NamespaceResolver can be used to resolve thenamespace URI for the namespace prefix held by the XPathFragment (if required).
 */
public XPathFragment openStartGroupingElements(NamespaceResolver namespaceResolver){
  if (null == groupingElements) {
    return null;
  }
  XPathFragment xPathFragment=null;
  for (int x=0, groupingElementsSize=groupingElements.size(); x < groupingElementsSize; x++) {
    XPathNode xPathNode=groupingElements.get(x);
    xPathFragment=xPathNode.getXPathFragment();
    openStartElement(xPathFragment,namespaceResolver);
    if (x != (groupingElementsSize - 1)) {
      closeStartElement();
    }
  }
  groupingElements=null;
  return xPathFragment;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Trigger that the grouping elements should be written.  This is normally done when something like a mapping has a non-null value that is marshalled.
 * @param namespaceResolver The NamespaceResolver can be used to resolve thenamespace URI for the namespace prefix held by the XPathFragment (if required).
 */
public XPathFragment openStartGroupingElements(NamespaceResolver namespaceResolver){
  if (null == groupingElements) {
    return null;
  }
  XPathFragment xPathFragment=null;
  for (int x=0, groupingElementsSize=groupingElements.size(); x < groupingElementsSize; x++) {
    XPathNode xPathNode=groupingElements.get(x);
    xPathFragment=xPathNode.getXPathFragment();
    openStartElement(xPathFragment,namespaceResolver);
    predicateAttribute(xPathFragment,namespaceResolver);
    if (x != (groupingElementsSize - 1)) {
      closeStartElement();
    }
  }
  groupingElements=null;
  return xPathFragment;
}
Program: 65947
Project: 65947
Buggy source:
/** 
 * Returns true if the field or method passed in is annotated with JAXB annotations.
 */
private boolean hasJAXBAnnotations(JavaHasAnnotations elem){
  return (helper.isAnnotationPresent(elem,XmlElement.class) || helper.isAnnotationPresent(elem,XmlAttribute.class) || helper.isAnnotationPresent(elem,XmlAnyElement.class)|| helper.isAnnotationPresent(elem,XmlAnyAttribute.class)|| helper.isAnnotationPresent(elem,XmlValue.class)|| helper.isAnnotationPresent(elem,XmlElements.class)|| helper.isAnnotationPresent(elem,XmlElementRef.class)|| helper.isAnnotationPresent(elem,XmlElementRefs.class)|| helper.isAnnotationPresent(elem,XmlID.class)|| helper.isAnnotationPresent(elem,XmlSchemaType.class)|| helper.isAnnotationPresent(elem,XmlElementWrapper.class)|| helper.isAnnotationPresent(elem,XmlList.class)|| helper.isAnnotationPresent(elem,XmlMimeType.class)|| helper.isAnnotationPresent(elem,XmlIDREF.class)|| helper.isAnnotationPresent(elem,XmlPath.class)|| helper.isAnnotationPresent(elem,XmlPaths.class)|| helper.isAnnotationPresent(elem,XmlInverseReference.class)|| helper.isAnnotationPresent(elem,XmlReadOnly.class)|| helper.isAnnotationPresent(elem,XmlWriteOnly.class)|| helper.isAnnotationPresent(elem,XmlCDATA.class)|| helper.isAnnotationPresent(elem,XmlAccessMethods.class)|| helper.isAnnotationPresent(elem,XmlNullPolicy.class));
}

Fixed version (ground truth):
/** 
 * Returns true if the field or method passed in is annotated with JAXB annotations.
 */
private boolean hasJAXBAnnotations(JavaHasAnnotations elem){
  return (helper.isAnnotationPresent(elem,XmlElement.class) || helper.isAnnotationPresent(elem,XmlAttribute.class) || helper.isAnnotationPresent(elem,XmlAnyElement.class)|| helper.isAnnotationPresent(elem,XmlAnyAttribute.class)|| helper.isAnnotationPresent(elem,XmlValue.class)|| helper.isAnnotationPresent(elem,XmlElements.class)|| helper.isAnnotationPresent(elem,XmlElementRef.class)|| helper.isAnnotationPresent(elem,XmlElementRefs.class)|| helper.isAnnotationPresent(elem,XmlID.class)|| helper.isAnnotationPresent(elem,XmlSchemaType.class)|| helper.isAnnotationPresent(elem,XmlElementWrapper.class)|| helper.isAnnotationPresent(elem,XmlList.class)|| helper.isAnnotationPresent(elem,XmlMimeType.class)|| helper.isAnnotationPresent(elem,XmlIDREF.class)|| helper.isAnnotationPresent(elem,XmlPath.class)|| helper.isAnnotationPresent(elem,XmlPaths.class)|| helper.isAnnotationPresent(elem,XmlInverseReference.class)|| helper.isAnnotationPresent(elem,XmlReadOnly.class)|| helper.isAnnotationPresent(elem,XmlWriteOnly.class)|| helper.isAnnotationPresent(elem,XmlCDATA.class)|| helper.isAnnotationPresent(elem,XmlAccessMethods.class)|| helper.isAnnotationPresent(elem,XmlNullPolicy.class)|| helper.isAnnotationPresent(elem,XmlJavaTypeAdapter.class));
}
Program: 65948
Project: 65948
Buggy source:
public JavaClass getClass(String className){
  JavaClass cachedClass=this.javaModelClasses.get(className);
  if (cachedClass != null) {
    return cachedClass;
  }
  String componentName=className;
  boolean isArray=className.contains("String_Node_Str");
  if (isArray) {
    componentName=className.replace("String_Node_Str","String_Node_Str");
  }
  boolean isPrimitive=XMLConversionManager.getPrimitiveClass(componentName) != null;
  try {
    JavaClass jc=new XJCJavaClassImpl(jCodeModel._class(componentName),jCodeModel,dynamicClassLoader,isArray,isPrimitive);
    this.javaModelClasses.put(className,jc);
    return jc;
  }
 catch (  JClassAlreadyExistsException ex) {
    JavaClass jc=new XJCJavaClassImpl(jCodeModel._getClass(componentName),jCodeModel,dynamicClassLoader,isArray,isPrimitive);
    this.javaModelClasses.put(className,jc);
    return jc;
  }
}

Fixed version (ground truth):
public JavaClass getClass(String className){
  JavaClass cachedClass=this.javaModelClasses.get(className);
  if (cachedClass != null) {
    return cachedClass;
  }
  String componentName=className;
  boolean isArray=className.contains("String_Node_Str");
  if (isArray) {
    componentName=className.replace("String_Node_Str","String_Node_Str");
  }
  boolean isTyped=className.contains("String_Node_Str");
  if (isTyped) {
    componentName=componentName.substring(0,className.indexOf('<'));
  }
  boolean isPrimitive=XMLConversionManager.getPrimitiveClass(componentName) != null;
  try {
    JavaClass jc=new XJCJavaClassImpl(jCodeModel._class(componentName),jCodeModel,dynamicClassLoader,isArray,isPrimitive);
    this.javaModelClasses.put(className,jc);
    return jc;
  }
 catch (  JClassAlreadyExistsException ex) {
    JavaClass jc=new XJCJavaClassImpl(jCodeModel._getClass(componentName),jCodeModel,dynamicClassLoader,isArray,isPrimitive);
    this.javaModelClasses.put(className,jc);
    return jc;
  }
}
Program: 65949
Project: 65949
Buggy source:
public void setType(JavaClass cls){
  if (cls == null) {
    return;
  }
  if (type != null && type == cls) {
    return;
  }
  String clsName=cls.getRawName();
  if (isCollectionType(cls)) {
    if (cls.hasActualTypeArguments()) {
      ArrayList typeArgs=(ArrayList)cls.getActualTypeArguments();
      genericType=(JavaClass)typeArgs.get(0);
    }
 else {
      genericType=helper.getJavaClass(Object.class);
    }
    type=cls;
  }
 else   if (cls.isArray() && !clsName.equals("String_Node_Str") && !clsName.equals("String_Node_Str")) {
    type=cls;
    genericType=cls.getComponentType();
  }
 else {
    type=cls;
    genericType=null;
  }
  boolean isNewTypeMap=helper.getJavaClass(java.util.Map.class).isAssignableFrom(type);
  setIsMap(isNewTypeMap);
  if (isMap()) {
    Object[] types=type.getActualTypeArguments().toArray();
    if (types.length >= 2) {
      keyType=(JavaClass)types[0];
      valueType=(JavaClass)types[1];
    }
 else {
      keyType=helper.getJavaClass(Object.class);
      valueType=helper.getJavaClass(Object.class);
    }
  }
}

Fixed version (ground truth):
public void setType(JavaClass cls){
  if (cls == null) {
    return;
  }
  if (type != null && type == cls) {
    return;
  }
  String clsName=cls.getRawName();
  if (isCollectionType(cls)) {
    if (cls.hasActualTypeArguments()) {
      ArrayList typeArgs=(ArrayList)cls.getActualTypeArguments();
      if (typeArgs.size() > 0) {
        genericType=(JavaClass)typeArgs.get(0);
      }
 else {
        genericType=helper.getJavaClass(Object.class);
      }
    }
 else {
      genericType=helper.getJavaClass(Object.class);
    }
    type=cls;
  }
 else   if (cls.isArray() && !clsName.equals("String_Node_Str") && !clsName.equals("String_Node_Str")) {
    type=cls;
    genericType=cls.getComponentType();
  }
 else {
    type=cls;
    genericType=null;
  }
  boolean isNewTypeMap=helper.getJavaClass(java.util.Map.class).isAssignableFrom(type);
  setIsMap(isNewTypeMap);
  if (isMap()) {
    Object[] types=type.getActualTypeArguments().toArray();
    if (types.length >= 2) {
      keyType=(JavaClass)types[0];
      valueType=(JavaClass)types[1];
    }
 else {
      keyType=helper.getJavaClass(Object.class);
      valueType=helper.getJavaClass(Object.class);
    }
  }
}
Program: 65950
Project: 65950
Buggy source:
private String decapitalize(String javaName){
  char[] name=javaName.toCharArray();
  int i=0;
  while (i < name.length && Character.isUpperCase(name[i])) {
    i++;
  }
  if (i > 0) {
    name[0]=Character.toLowerCase(name[0]);
    for (int j=1; j < i - 1; j++) {
      name[j]=Character.toLowerCase(name[j]);
    }
    return new String(name);
  }
 else {
    return javaName;
  }
}

Fixed version (ground truth):
private String decapitalize(String javaName){
  char[] name=javaName.toCharArray();
  int i=0;
  while (i < name.length && (Character.isUpperCase(name[i]) || !Character.isLetter(name[i]))) {
    i++;
  }
  if (i > 0) {
    name[0]=Character.toLowerCase(name[0]);
    for (int j=1; j < i - 1; j++) {
      name[j]=Character.toLowerCase(name[j]);
    }
    return new String(name);
  }
 else {
    return javaName;
  }
}
Program: 65952
Project: 65952
Buggy source:
/** 
 * If a Schema was set on the unmarshaller then wrap the ContentHandler in a ValidatorHandler. 
 */
private void setContentHandler(XMLReader xmlReader,ContentHandler contentHandler){
  Schema schema=saxParserFactory.getSchema();
  if (null == schema) {
    xmlReader.setContentHandler(contentHandler);
  }
 else {
    ValidatorHandler validatorHandler=schema.newValidatorHandler();
    validatorHandler.setContentHandler(contentHandler);
    xmlReader.setContentHandler(validatorHandler);
  }
}

Fixed version (ground truth):
/** 
 * If a Schema was set on the unmarshaller then wrap the ContentHandler in a ValidatorHandler.
 */
private void setContentHandler(XMLReader xmlReader,ContentHandler contentHandler){
  Schema schema=null;
  try {
    schema=saxParserFactory.getSchema();
  }
 catch (  UnsupportedOperationException e) {
  }
  if (null == schema) {
    xmlReader.setContentHandler(contentHandler);
  }
 else {
    ValidatorHandler validatorHandler=schema.newValidatorHandler();
    validatorHandler.setContentHandler(contentHandler);
    xmlReader.setContentHandler(validatorHandler);
  }
}
Program: 65953
Project: 65953
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 BigDecimal.ZERO;
    }
 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;
    }
 else     if (sourceString.charAt(0) == PLUS) {
      return super.convertObjectToBigDecimal(sourceString.substring(1));
    }
  }
  return super.convertObjectToBigDecimal(sourceObject);
}
Program: 65954
Project: 65954
Buggy source:
/** 
 * Build a valid instance of BigInteger from the provided sourceObject.
 * @param sourceObject    Valid instance of String, BigDecimal, or any Number
 */
protected BigInteger convertObjectToBigInteger(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String) {
    String sourceString=(String)sourceObject;
    if (sourceString.length() == 0) {
      return BigInteger.ZERO;
    }
 else     if (sourceString.charAt(0) == PLUS) {
      return super.convertObjectToBigInteger(sourceString.substring(1));
    }
  }
  return super.convertObjectToBigInteger(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid instance of BigInteger from the provided sourceObject.
 * @param sourceObject    Valid instance of String, BigDecimal, or any Number
 */
protected BigInteger convertObjectToBigInteger(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.convertObjectToBigInteger(sourceString.substring(1));
    }
  }
  return super.convertObjectToBigInteger(sourceObject);
}
Program: 65955
Project: 65955
Buggy source:
public void testConvertEmptyStringTo_BigDecimal(){
  BigDecimal test=(BigDecimal)xmlConversionManager.convertObject(XMLConstants.EMPTY_STRING,BigDecimal.class);
  assertEquals(BigDecimal.ZERO,test);
}

Fixed version (ground truth):
public void testConvertEmptyStringTo_BigDecimal(){
  BigDecimal test=(BigDecimal)xmlConversionManager.convertObject(XMLConstants.EMPTY_STRING,BigDecimal.class);
  assertNull(test);
}
Program: 65956
Project: 65956
Buggy source:
public void testConvertEmptyStringTo_BigInteger(){
  BigInteger test=(BigInteger)xmlConversionManager.convertObject(XMLConstants.EMPTY_STRING,BigInteger.class);
  assertEquals(BigInteger.ZERO,test);
}

Fixed version (ground truth):
public void testConvertEmptyStringTo_BigInteger(){
  BigInteger test=(BigInteger)xmlConversionManager.convertObject(XMLConstants.EMPTY_STRING,BigInteger.class);
  assertNull(test);
}
Program: 65957
Project: 65957
Buggy source:
protected void endElementProcessText(UnmarshalRecord unmarshalRecord,Converter converter,XPathFragment xPathFragment,Object collection){
  Object value=unmarshalRecord.getStringBuffer().toString();
  unmarshalRecord.resetStringBuffer();
  if (!XMLConstants.EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
      if (theClass != null) {
        value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertObject(value,theClass,qname);
      }
    }
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,unmarshalRecord.getSession());
      }
    }
    setOrAddAttributeValue(unmarshalRecord,value,xPathFragment,collection);
  }
}

Fixed version (ground truth):
protected void endElementProcessText(UnmarshalRecord unmarshalRecord,Converter converter,XPathFragment xPathFragment,Object collection){
  Object value=unmarshalRecord.getStringBuffer().toString();
  unmarshalRecord.resetStringBuffer();
  if (!XMLConstants.EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      if (qname.equals(XMLConstants.QNAME_QNAME)) {
        value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).buildQNameFromString((String)value,unmarshalRecord);
      }
 else {
        Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
        if (theClass != null) {
          value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertObject(value,theClass,qname);
        }
      }
    }
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,unmarshalRecord.getSession());
      }
    }
    setOrAddAttributeValue(unmarshalRecord,value,xPathFragment,collection);
  }
}
Program: 65958
Project: 65958
Buggy source:
/** 
 * INTERNAL:
 */
public Object convertValueBasedOnSchemaType(Object value,XMLConversionManager xmlConversionManager,XMLRecord record){
  if (getSchemaType() != null) {
    if (XMLConstants.QNAME_QNAME.equals(getSchemaType())) {
      return buildQNameFromString((String)value,record);
    }
 else {
      Class fieldType=getType();
      if (fieldType == null) {
        fieldType=getJavaClass(getSchemaType());
      }
      return xmlConversionManager.convertObject(value,fieldType,getSchemaType());
    }
  }
  return value;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public Object convertValueBasedOnSchemaType(Object value,XMLConversionManager xmlConversionManager,XMLRecord record){
  if (getSchemaType() != null) {
    if (XMLConstants.QNAME_QNAME.equals(getSchemaType())) {
      return xmlConversionManager.buildQNameFromString((String)value,record);
    }
 else {
      Class fieldType=getType();
      if (fieldType == null) {
        fieldType=getJavaClass(getSchemaType());
      }
      return xmlConversionManager.convertObject(value,fieldType,getSchemaType());
    }
  }
  return value;
}
Program: 65959
Project: 65959
Buggy source:
/** 
 * INTERNAL:
 */
public Object convertValueBasedOnSchemaType(Object value,XMLConversionManager xmlConversionManager,XMLRecord record){
  Object convertedValue=value;
  for (int i=0; i < schemaTypes.size(); i++) {
    QName nextQName=(QName)schemaTypes.get(i);
    try {
      if (nextQName != null) {
        if (XMLConstants.QNAME_QNAME.equals(nextQName)) {
          buildQNameFromString((String)value,record);
          break;
        }
 else {
          Class javaClass=getJavaClass(nextQName);
          convertedValue=xmlConversionManager.convertObject(value,javaClass,nextQName);
          break;
        }
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        throw ce;
      }
    }
  }
  return convertedValue;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public Object convertValueBasedOnSchemaType(Object value,XMLConversionManager xmlConversionManager,XMLRecord record){
  Object convertedValue=value;
  for (int i=0; i < schemaTypes.size(); i++) {
    QName nextQName=(QName)schemaTypes.get(i);
    try {
      if (nextQName != null) {
        if (XMLConstants.QNAME_QNAME.equals(nextQName)) {
          xmlConversionManager.buildQNameFromString((String)value,record);
          break;
        }
 else {
          Class javaClass=getJavaClass(nextQName);
          convertedValue=xmlConversionManager.convertObject(value,javaClass,nextQName);
          break;
        }
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        throw ce;
      }
    }
  }
  return convertedValue;
}
Program: 65960
Project: 65960
Buggy source:
protected void endElementProcessText(UnmarshalRecord unmarshalRecord,Converter converter,XPathFragment xPathFragment,Object collection){
  Object value=unmarshalRecord.getStringBuffer().toString();
  if (converter != null) {
    if (converter instanceof XMLConverter) {
      value=((XMLConverter)converter).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      value=converter.convertDataValueToObjectValue(value,unmarshalRecord.getSession());
    }
  }
  unmarshalRecord.resetStringBuffer();
  if (!XMLConstants.EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
      if (theClass != null) {
        value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertObject(value,theClass,qname);
      }
    }
    setOrAddAttributeValue(unmarshalRecord,value,xPathFragment,collection);
  }
}

Fixed version (ground truth):
protected void endElementProcessText(UnmarshalRecord unmarshalRecord,Converter converter,XPathFragment xPathFragment,Object collection){
  Object value=unmarshalRecord.getStringBuffer().toString();
  unmarshalRecord.resetStringBuffer();
  if (!XMLConstants.EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
      if (theClass != null) {
        value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertObject(value,theClass,qname);
      }
    }
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,unmarshalRecord.getSession());
      }
    }
    setOrAddAttributeValue(unmarshalRecord,value,xPathFragment,collection);
  }
}
Program: 65962
Project: 65962
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;
  }
 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);
  }
  contentHandler.startElement(elem.getNamespaceURI(),lname,qname,attributes);
  handleChildNodes(elem.getChildNodes());
  contentHandler.endElement(elem.getNamespaceURI(),lname,qname);
  endPrefixMappings(elem);
}
Program: 65963
Project: 65963
Buggy source:
/** 
 * Create a JAXBElement instance.  If the object is an instance of XMLRoot, we will use its field values to create the JAXBElement.  If the object is not an XMLRoot instance, we will have to determine the 'name' value.  This will be done using the object's descriptor default root element - any prefix will be resolved, and a QName created.
 * @param obj
 * @return
 */
private JAXBElement buildJAXBElementFromObject(Object obj,Class declaredClass){
  if (obj instanceof XMLRoot) {
    JAXBElement jaxbElement=createJAXBElementFromXMLRoot(((XMLRoot)obj),declaredClass);
    jaxbElement.setNil(((XMLRoot)obj).isNil());
    return jaxbElement;
  }
  if (obj instanceof JAXBElement) {
    return (JAXBElement)obj;
  }
  org.eclipse.persistence.sessions.Session sess=xmlUnmarshaller.getXMLContext().getSession(obj);
  XMLDescriptor desc=(XMLDescriptor)sess.getClassDescriptor(obj);
  String rootName=desc.getDefaultRootElement();
  if (rootName == null) {
    return createJAXBElement(new QName("String_Node_Str"),obj.getClass(),obj);
  }
  String rootNamespaceUri=null;
  int idx=rootName.indexOf("String_Node_Str");
  if (idx != -1) {
    rootNamespaceUri=desc.getNamespaceResolver().resolveNamespacePrefix(rootName.substring(0,idx));
    rootName=rootName.substring(idx + 1);
  }
  QName qname;
  if (rootNamespaceUri == null) {
    qname=new QName(rootName);
  }
 else {
    qname=new QName(rootNamespaceUri,rootName);
  }
  return createJAXBElement(qname,obj.getClass(),obj);
}

Fixed version (ground truth):
/** 
 * Create a JAXBElement instance.  If the object is an instance of XMLRoot, we will use its field values to create the JAXBElement.  If the object is not an XMLRoot instance, we will have to determine the 'name' value.  This will be done using the object's descriptor default root element - any prefix will be resolved, and a QName created.
 * @param obj
 * @return
 */
private JAXBElement buildJAXBElementFromObject(Object obj,Class declaredClass){
  if (obj instanceof XMLRoot) {
    JAXBElement jaxbElement=createJAXBElementFromXMLRoot(((XMLRoot)obj),declaredClass);
    if (((XMLRoot)obj).isNil()) {
      jaxbElement.setNil(((XMLRoot)obj).isNil());
      jaxbElement.setValue(null);
    }
    return jaxbElement;
  }
  if (obj instanceof JAXBElement) {
    return (JAXBElement)obj;
  }
  org.eclipse.persistence.sessions.Session sess=xmlUnmarshaller.getXMLContext().getSession(obj);
  XMLDescriptor desc=(XMLDescriptor)sess.getClassDescriptor(obj);
  String rootName=desc.getDefaultRootElement();
  if (rootName == null) {
    return createJAXBElement(new QName("String_Node_Str"),obj.getClass(),obj);
  }
  String rootNamespaceUri=null;
  int idx=rootName.indexOf("String_Node_Str");
  if (idx != -1) {
    rootNamespaceUri=desc.getNamespaceResolver().resolveNamespacePrefix(rootName.substring(0,idx));
    rootName=rootName.substring(idx + 1);
  }
  QName qname;
  if (rootNamespaceUri == null) {
    qname=new QName(rootName);
  }
 else {
    qname=new QName(rootNamespaceUri,rootName);
  }
  return createJAXBElement(qname,obj.getClass(),obj);
}
Program: 65964
Project: 65964
Buggy source:
/** 
 * PUBLIC: Return a new XMLDescriptor.
 */
public XMLDescriptor(){
  this.tables=NonSynchronizedVector.newInstance(3);
  this.mappings=NonSynchronizedVector.newInstance();
  this.primaryKeyFields=new ArrayList(2);
  this.fields=NonSynchronizedVector.newInstance();
  this.allFields=NonSynchronizedVector.newInstance();
  this.constraintDependencies=NonSynchronizedVector.newInstance(2);
  this.multipleTableForeignKeys=new HashMap(5);
  this.queryKeys=new HashMap(5);
  this.initializationStage=UNINITIALIZED;
  this.interfaceInitializationStage=UNINITIALIZED;
  this.shouldAlwaysRefreshCache=false;
  this.shouldOnlyRefreshCacheIfNewerVersion=false;
  this.shouldDisableCacheHits=false;
  this.identityMapSize=100;
  this.remoteIdentityMapSize=-1;
  this.identityMapClass=AbstractIdentityMap.getDefaultIdentityMapClass();
  this.remoteIdentityMapClass=null;
  this.descriptorType=NORMAL;
  this.shouldAlwaysRefreshCacheOnRemote=false;
  this.shouldDisableCacheHitsOnRemote=false;
  this.shouldOrderMappings=true;
  this.shouldBeReadOnly=false;
  this.shouldAlwaysConformResultsInUnitOfWork=false;
  this.shouldAcquireCascadedLocks=false;
  this.hasSimplePrimaryKey=false;
  this.cacheIsolation=null;
  this.objectBuilder=new TreeObjectBuilder(this);
  this.cascadeLockingPolicies=NonSynchronizedVector.newInstance();
  this.shouldOrderMappings=false;
  this.descriptorIsAggregate();
}

Fixed version (ground truth):
/** 
 * PUBLIC: Return a new XMLDescriptor.
 */
public XMLDescriptor(){
  this.tables=NonSynchronizedVector.newInstance(3);
  this.mappings=NonSynchronizedVector.newInstance();
  this.primaryKeyFields=new ArrayList(1);
  this.fields=NonSynchronizedVector.newInstance();
  this.allFields=NonSynchronizedVector.newInstance();
  this.constraintDependencies=EMPTY_VECTOR;
  this.multipleTableForeignKeys=Collections.EMPTY_MAP;
  this.queryKeys=Collections.EMPTY_MAP;
  this.initializationStage=UNINITIALIZED;
  this.interfaceInitializationStage=UNINITIALIZED;
  this.shouldAlwaysRefreshCache=false;
  this.shouldOnlyRefreshCacheIfNewerVersion=false;
  this.shouldDisableCacheHits=false;
  this.identityMapSize=100;
  this.remoteIdentityMapSize=-1;
  this.identityMapClass=AbstractIdentityMap.getDefaultIdentityMapClass();
  this.remoteIdentityMapClass=null;
  this.descriptorType=NORMAL;
  this.shouldAlwaysRefreshCacheOnRemote=false;
  this.shouldDisableCacheHitsOnRemote=false;
  this.shouldOrderMappings=true;
  this.shouldBeReadOnly=false;
  this.shouldAlwaysConformResultsInUnitOfWork=false;
  this.shouldAcquireCascadedLocks=false;
  this.hasSimplePrimaryKey=false;
  this.cacheIsolation=null;
  this.idValidation=null;
  this.derivesIdMappings=Collections.EMPTY_MAP;
  this.additionalWritableMapKeyFields=Collections.EMPTY_LIST;
  this.objectBuilder=new TreeObjectBuilder(this);
  this.cascadeLockingPolicies=null;
  this.shouldOrderMappings=false;
  this.descriptorIsAggregate();
}
Program: 65965
Project: 65965
Buggy source:
private XMLRoot wrapObjectInXMLRoot(JAXBElement wrapperElement,Object value){
  XMLRoot xmlroot=new XMLRoot();
  Object objectValue=value;
  xmlroot.setObject(objectValue);
  QName qname=wrapperElement.getName();
  xmlroot.setLocalName(qname.getLocalPart());
  xmlroot.setNamespaceURI(qname.getNamespaceURI());
  xmlroot.setDeclaredType(wrapperElement.getDeclaredType());
  if (value.getClass() == ClassConstants.ABYTE || value.getClass() == ClassConstants.APBYTE || value.getClass().getCanonicalName().equals("String_Node_Str")) {
    xmlroot.setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
  }
  return xmlroot;
}

Fixed version (ground truth):
private XMLRoot wrapObjectInXMLRoot(JAXBElement wrapperElement,Object value){
  XMLRoot xmlroot=new XMLRoot();
  Object objectValue=value;
  xmlroot.setObject(objectValue);
  QName qname=wrapperElement.getName();
  xmlroot.setLocalName(qname.getLocalPart());
  xmlroot.setNamespaceURI(qname.getNamespaceURI());
  xmlroot.setDeclaredType(wrapperElement.getDeclaredType());
  if (value != null) {
    if (value.getClass() == ClassConstants.ABYTE || value.getClass() == ClassConstants.APBYTE || value.getClass().getCanonicalName().equals("String_Node_Str")) {
      xmlroot.setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
    }
  }
  return xmlroot;
}
Program: 65966
Project: 65966
Buggy source:
private void setupNamespaceInformation(String xpathString){
  int nsindex=xpathString.indexOf(XMLConstants.COLON);
  if (nsindex != -1) {
    hasNamespace=true;
    localName=xpathString.substring(nsindex + 1);
    prefix=xpathString.substring(0,nsindex);
  }
 else {
    localName=xpathString;
  }
}

Fixed version (ground truth):
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();
  }
}
Program: 65967
Project: 65967
Buggy source:
public void setXPath(String xpathString){
  xpath=xpathString;
  shortName=xpathString;
  if (xpathString.length() > 0) {
    if ((xpath.indexOf('[') != -1) && (xpath.indexOf(']') == -1)) {
      setShouldExecuteSelectNodes(true);
      return;
    }
    if (xpath.indexOf("String_Node_Str") != -1) {
      setShouldExecuteSelectNodes(true);
      return;
    }
    if (xpathString.charAt(0) == '@') {
      hasAttribute=true;
      shortName=xpathString.substring(1);
      indexValue=hasIndex(xpathString);
      setupNamespaceInformation(shortName);
      return;
    }
    if (xpathString.charAt(0) == '/') {
      setShouldExecuteSelectNodes(true);
      shortName=xpathString.substring(xpathString.lastIndexOf('/') + 1);
      indexValue=hasIndex(xpathString);
      setupNamespaceInformation(shortName);
      return;
    }
  }
  if (xpathString.equals(XMLConstants.TEXT)) {
    nameIsText=true;
    shortName=xpathString;
    return;
  }
 else {
    nameIsText=false;
  }
  if (xpathString.equals(SELF_XPATH)) {
    isSelfFragment=true;
    shortName=xpathString;
    return;
  }
  indexValue=hasIndex(xpathString);
  setupNamespaceInformation(shortName);
  try {
    shortNameBytes=shortName.getBytes(XMLConstants.DEFAULT_XML_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
  }
}

Fixed version (ground truth):
public void setXPath(String xpathString){
  xpath=xpathString;
  shortName=xpathString;
  if (xpathString.length() > 0) {
    if ((xpath.indexOf('[') != -1) && (xpath.indexOf(']') == -1)) {
      setShouldExecuteSelectNodes(true);
      return;
    }
    if (xpath.indexOf("String_Node_Str") != -1) {
      setShouldExecuteSelectNodes(true);
      return;
    }
    if (xpathString.charAt(0) == '@') {
      hasAttribute=true;
      shortName=xpathString.substring(1).intern();
      indexValue=hasIndex(xpathString);
      setupNamespaceInformation(shortName);
      return;
    }
    if (xpathString.charAt(0) == '/') {
      setShouldExecuteSelectNodes(true);
      shortName=xpathString.substring(xpathString.lastIndexOf('/') + 1).intern();
      indexValue=hasIndex(xpathString);
      setupNamespaceInformation(shortName);
      return;
    }
  }
  if (xpathString.equals(XMLConstants.TEXT)) {
    nameIsText=true;
    shortName=xpathString.intern();
    return;
  }
 else {
    nameIsText=false;
  }
  if (xpathString.equals(SELF_XPATH)) {
    isSelfFragment=true;
    shortName=xpathString.intern();
    return;
  }
  indexValue=hasIndex(xpathString);
  setupNamespaceInformation(shortName);
  try {
    shortNameBytes=shortName.getBytes(XMLConstants.DEFAULT_XML_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
  }
}
Program: 65968
Project: 65968
Buggy source:
public void setUri(String uri){
  this.uri=uri;
}

Fixed version (ground truth):
public void setUri(String uri){
  if (null != uri) {
    uri=uri.intern();
  }
  this.uri=uri;
}