nus-yam/ex-repair huggingface dataset:
Program: 66319
Project: 66319
Buggy source:
/** 
 * INTERNAL:
 */
protected void writeValue(String value,boolean escapeChars){
  for (int x=0, length=value.length(); x < length; x++) {
    final char character=value.charAt(x);
    if (character > 0x7F) {
      if (character > 0x7FF) {
        if ((character >= Character.MIN_HIGH_SURROGATE) && (character <= Character.MAX_LOW_SURROGATE)) {
          int uc=(((character & 0x3ff) << 10) | (value.charAt(++x) & 0x3ff)) + 0x10000;
          outputStreamWrite((byte)(0xF0 | ((uc >> 18))));
          outputStreamWrite((byte)(0x80 | ((uc >> 12) & 0x3F)));
          outputStreamWrite((byte)(0x80 | ((uc >> 6) & 0x3F)));
          outputStreamWrite((byte)(0x80 + (uc & 0x3F)));
          continue;
        }
 else {
          outputStreamWrite((byte)(0xE0 + (character >> 12)));
        }
        outputStreamWrite((byte)(0x80 + ((character >> 6) & 0x3F)));
      }
 else {
        outputStreamWrite((byte)(0xC0 + (character >> 6)));
      }
      outputStreamWrite((byte)(0x80 + (character & 0x3F)));
    }
 else {
      if (escapeChars) {
switch (character) {
case '&':
{
            outputStreamWrite(AMP);
            break;
          }
case '<':
{
          outputStreamWrite(LT);
          break;
        }
default :
      outputStreamWrite((byte)character);
  }
}
 else {
  outputStreamWrite((byte)character);
}
}
}
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void writeValue(String value,boolean escapeChars){
  for (int x=0, length=value.length(); x < length; x++) {
    final char character=value.charAt(x);
    if (character > 0x7F) {
      if (character > 0x7FF) {
        if ((character >= Character.MIN_HIGH_SURROGATE) && (character <= Character.MAX_LOW_SURROGATE)) {
          int uc=(((character & 0x3ff) << 10) | (value.charAt(++x) & 0x3ff)) + 0x10000;
          outputStreamWrite((byte)(0xF0 | ((uc >> 18))));
          outputStreamWrite((byte)(0x80 | ((uc >> 12) & 0x3F)));
          outputStreamWrite((byte)(0x80 | ((uc >> 6) & 0x3F)));
          outputStreamWrite((byte)(0x80 + (uc & 0x3F)));
          continue;
        }
 else {
          outputStreamWrite((byte)(0xE0 + (character >> 12)));
        }
        outputStreamWrite((byte)(0x80 + ((character >> 6) & 0x3F)));
      }
 else {
        outputStreamWrite((byte)(0xC0 + (character >> 6)));
      }
      outputStreamWrite((byte)(0x80 + (character & 0x3F)));
    }
 else {
      if (escapeChars) {
switch (character) {
case '&':
{
            outputStreamWrite(AMP);
            break;
          }
case '<':
{
          outputStreamWrite(LT);
          break;
        }
case '"':
{
        outputStreamWrite(QUOT);
        break;
      }
default :
    outputStreamWrite((byte)character);
}
}
 else {
outputStreamWrite((byte)character);
}
}
}
}
Program: 66320
Project: 66320
Buggy source:
/** 
 * INTERNAL:
 */
protected void writeValue(String value){
  try {
    if (value.indexOf('&') > -1 || value.indexOf('<') > -1) {
      char[] chars=value.toCharArray();
      for (int x=0, charsSize=chars.length; x < charsSize; x++) {
        char character=chars[x];
switch (character) {
case '&':
{
            writer.write("String_Node_Str");
            break;
          }
case '<':
{
          writer.write("String_Node_Str");
          break;
        }
default :
      writer.write(character);
  }
}
}
 else {
writer.write(value);
}
}
 catch (IOException e) {
throw XMLMarshalException.marshalException(e);
}
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void writeValue(String value){
  try {
    if (value.indexOf('&') > -1 || value.indexOf('<') > -1) {
      char[] chars=value.toCharArray();
      for (int x=0, charsSize=chars.length; x < charsSize; x++) {
        char character=chars[x];
switch (character) {
case '&':
{
            writer.write("String_Node_Str");
            break;
          }
case '<':
{
          writer.write("String_Node_Str");
          break;
        }
case '"':
{
        writer.write("String_Node_Str");
        break;
      }
default :
    writer.write(character);
}
}
}
 else {
writer.write(value);
}
}
 catch (IOException e) {
throw XMLMarshalException.marshalException(e);
}
}
Program: 66322
Project: 66322
Buggy source:
public SAXUnmarshaller(XMLUnmarshaller xmlUnmarshaller,Map<String,Boolean> parserFeatures) throws XMLMarshalException {
  super();
  try {
    saxParserFactory=SAXParserFactory.newInstance();
    saxParserFactory.setNamespaceAware(true);
    saxParserFactory.setFeature("String_Node_Str",true);
    try {
      saxParserFactory.setFeature("String_Node_Str",true);
    }
 catch (    org.xml.sax.SAXNotRecognizedException ex) {
    }
catch (    org.xml.sax.SAXNotSupportedException ex) {
    }
    if (null != parserFeatures) {
      for (      Map.Entry<String,Boolean> parserFeature : parserFeatures.entrySet()) {
        try {
          saxParserFactory.setFeature(parserFeature.getKey(),parserFeature.getValue());
        }
 catch (        org.xml.sax.SAXNotRecognizedException ex) {
        }
catch (        org.xml.sax.SAXNotSupportedException ex) {
        }
      }
    }
    saxParser=saxParserFactory.newSAXParser();
    xmlReader=new XMLReader(saxParser.getXMLReader());
    xmlReader.setErrorHandler(new DefaultErrorHandler());
    xmlParser=XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
    xmlParser.setNamespaceAware(true);
    xmlParser.setValidationMode(XMLParser.NONVALIDATING);
    this.xmlUnmarshaller=xmlUnmarshaller;
  }
 catch (  Exception e) {
    throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
  }
}

Fixed version (ground truth):
public SAXUnmarshaller(XMLUnmarshaller xmlUnmarshaller,Map<String,Boolean> parserFeatures) throws XMLMarshalException {
  super();
  try {
    saxParserFactory=SAXParserFactory.newInstance();
    saxParserFactory.setNamespaceAware(true);
    saxParserFactory.setFeature(XMLReader.NAMESPACE_PREFIXES_FEATURE,true);
    try {
      saxParserFactory.setFeature(XMLReader.REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATURE,true);
    }
 catch (    org.xml.sax.SAXNotRecognizedException ex) {
    }
catch (    org.xml.sax.SAXNotSupportedException ex) {
    }
    if (null != parserFeatures) {
      for (      Map.Entry<String,Boolean> parserFeature : parserFeatures.entrySet()) {
        try {
          saxParserFactory.setFeature(parserFeature.getKey(),parserFeature.getValue());
        }
 catch (        org.xml.sax.SAXNotRecognizedException ex) {
        }
catch (        org.xml.sax.SAXNotSupportedException ex) {
        }
      }
    }
    saxParser=saxParserFactory.newSAXParser();
    xmlReader=new XMLReader(saxParser.getXMLReader());
    xmlReader.setErrorHandler(new DefaultErrorHandler());
    xmlParser=XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
    xmlParser.setNamespaceAware(true);
    xmlParser.setValidationMode(XMLParser.NONVALIDATING);
    this.xmlUnmarshaller=xmlUnmarshaller;
  }
 catch (  Exception e) {
    throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
  }
}
Program: 66323
Project: 66323
Buggy source:
public void parse(String systemId) throws IOException, SAXException {
  reader.parse(systemId);
}

Fixed version (ground truth):
public void parse(String systemId) throws IOException, SAXException {
  try {
    reader.parse(systemId);
  }
 catch (  SAXNotSupportedException e) {
    String message=e.getMessage();
    if (message != null && message.contains("String_Node_Str")) {
      reader.setFeature(NAMESPACE_PREFIXES_FEATURE,false);
      reader.parse(systemId);
    }
 else {
      throw e;
    }
  }
}
Program: 66325
Project: 66325
Buggy source:
public void endDocument(){
  try {
    xmlStreamWriter.writeEndDocument();
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void endDocument(){
  try {
    xmlStreamWriter.writeEndDocument();
    xmlStreamWriter.flush();
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66326
Project: 66326
Buggy source:
public void startDocument(String encoding,String version){
  try {
    xmlStreamWriter.writeStartDocument(encoding,version);
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void startDocument(String encoding,String version){
  try {
    if (XMLConstants.DEFAULT_XML_ENCODING.equals(encoding)) {
      xmlStreamWriter.writeStartDocument(version);
    }
 else {
      xmlStreamWriter.writeStartDocument(encoding,version);
    }
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66327
Project: 66327
Buggy source:
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  try {
    String namespaceURI=xPathFragment.getNamespaceURI();
    if (namespaceURI == null) {
      xmlStreamWriter.writeStartElement(XMLConstants.EMPTY_STRING,xPathFragment.getLocalName(),XMLConstants.EMPTY_STRING);
      String defaultNamespace=xmlStreamWriter.getNamespaceContext().getNamespaceURI(XMLConstants.EMPTY_STRING);
      if (defaultNamespace != null && defaultNamespace.length() > 0) {
        xmlStreamWriter.writeDefaultNamespace(XMLConstants.EMPTY_STRING);
      }
    }
 else {
      String prefix=xPathFragment.getPrefix();
      if (prefix == null) {
        prefix=XMLConstants.EMPTY_STRING;
      }
      xmlStreamWriter.writeStartElement(prefix,xPathFragment.getLocalName(),namespaceURI);
    }
    writePrefixMappings();
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  try {
    String namespaceURI=xPathFragment.getNamespaceURI();
    if (namespaceURI == null) {
      NamespaceContext namespaceContext=xmlStreamWriter.getNamespaceContext();
      if (null == namespaceContext) {
        xmlStreamWriter.writeStartElement(xPathFragment.getLocalName());
      }
 else {
        xmlStreamWriter.writeStartElement(XMLConstants.EMPTY_STRING,xPathFragment.getLocalName(),XMLConstants.EMPTY_STRING);
        String defaultNamespace=xmlStreamWriter.getNamespaceContext().getNamespaceURI(XMLConstants.EMPTY_STRING);
        if (defaultNamespace != null && defaultNamespace.length() > 0) {
          xmlStreamWriter.writeDefaultNamespace(XMLConstants.EMPTY_STRING);
        }
      }
    }
 else {
      String prefix=xPathFragment.getPrefix();
      if (prefix == null) {
        prefix=XMLConstants.EMPTY_STRING;
      }
      xmlStreamWriter.writeStartElement(prefix,xPathFragment.getLocalName(),namespaceURI);
    }
    writePrefixMappings();
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66330
Project: 66330
Buggy source:
/** 
 * Test should serialize/deserialize successfully/
 */
public void testResolveWithHelperContextSetInUserMap(){
  SDOHelperContext.putHelperContext(Thread.currentThread().getContextClassLoader(),localCtx);
  serialize(localDObj,FILE_NAME);
  SDODataObject dobj=(SDODataObject)deserialize(FILE_NAME);
  String dobjImplClassName=dobj.getType().getInstanceClassName();
  assertTrue("String_Node_Str" + implClassname + "String_Node_Str"+ dobjImplClassName+ "String_Node_Str",dobjImplClassName.equals(implClassname));
  SDOHelperContext.removeHelperContext(Thread.currentThread().getContextClassLoader());
}

Fixed version (ground truth):
/** 
 * Test should serialize/deserialize successfully/
 */
public void testResolveWithHelperContextSetInUserMap(){
  SDOHelperContext.putHelperContext(Thread.currentThread().getContextClassLoader(),new SDOHelperContext());
  String xsdString=getXSDString(CONTEXT1_DATAOBJECT_XSD_PATH);
  localCtx=new SDOHelperContext("String_Node_Str");
  localCtx.getXSDHelper().define(xsdString);
  localDObj=load(CONTEXT1_DATAOBJECT_XML_PATH,localCtx);
  SDOHelperContext.putHelperContext(Thread.currentThread().getContextClassLoader(),localCtx);
  serialize(localDObj,FILE_NAME);
  SDODataObject dobj=(SDODataObject)deserialize(FILE_NAME);
  String dobjImplClassName=dobj.getType().getInstanceClassName();
  assertTrue("String_Node_Str" + implClassname + "String_Node_Str"+ dobjImplClassName+ "String_Node_Str",dobjImplClassName.equals(implClassname));
  SDOHelperContext.removeHelperContext(Thread.currentThread().getContextClassLoader());
}
Program: 66331
Project: 66331
Buggy source:
/** 
 * INTERNAL: Remove a ClassLoader/HelperContext key/value pair from the Thread  HelperContext map.
 * @param key class loader
 */
public static void removeHelperContext(ClassLoader key){
  if (key == null) {
    return;
  }
  userSetHelperContexts.remove(key);
}

Fixed version (ground truth):
/** 
 * INTERNAL
 * @param identifier the specific identifier of the HelperContext to be removed. "" for a Global helper
 * @param key the ClassLoader associated with the HelperContext to be removed
 */
public static void removeHelperContext(String identifier,ClassLoader key){
  if (key == null) {
    return;
  }
  WeakHashMap<String,WeakReference<HelperContext>> currentMap=userSetHelperContexts.get(key);
  if (currentMap != null) {
    currentMap.remove(key);
  }
}
Program: 66333
Project: 66333
Buggy source:
public void testXmlSchemaImport() throws Exception {
  String javaVersion=System.getProperty("String_Node_Str");
  if (!(javaVersion.startsWith("String_Node_Str"))) {
    return;
  }
  InputStream inputStream=ClassLoader.getSystemResourceAsStream(XMLSCHEMA_IMPORT);
  jaxbContext=DynamicJAXBContextFactory.createContextFromXSD(inputStream,new NoExtensionEntityResolver(),null,null);
  DynamicEntity person=jaxbContext.newDynamicEntity(PERSON);
  assertNotNull("String_Node_Str",person);
  DynamicEntity salary=jaxbContext.newDynamicEntity(CDN_CURRENCY);
  assertNotNull("String_Node_Str",salary);
  salary.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str",salary);
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
}

Fixed version (ground truth):
public void testXmlSchemaImport() throws Exception {
  String javaVersion=System.getProperty("String_Node_Str");
  if (!(javaVersion.startsWith("String_Node_Str"))) {
    return;
  }
  DocumentBuilderFactory builderFactory=DocumentBuilderFactory.newInstance();
  if (builderFactory.getClass().getPackage().getName().contains("String_Node_Str")) {
    return;
  }
  InputStream inputStream=ClassLoader.getSystemResourceAsStream(XMLSCHEMA_IMPORT);
  jaxbContext=DynamicJAXBContextFactory.createContextFromXSD(inputStream,new NoExtensionEntityResolver(),null,null);
  DynamicEntity person=jaxbContext.newDynamicEntity(PERSON);
  assertNotNull("String_Node_Str",person);
  DynamicEntity salary=jaxbContext.newDynamicEntity(CDN_CURRENCY);
  assertNotNull("String_Node_Str",salary);
  salary.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str",salary);
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
}
Program: 66334
Project: 66334
Buggy source:
public void testXmlSchemaUnqualified() throws Exception {
  InputStream inputStream=ClassLoader.getSystemResourceAsStream(XMLSCHEMA_UNQUALIFIED);
  jaxbContext=DynamicJAXBContextFactory.createContextFromXSD(inputStream,null,null,null);
  DynamicEntity person=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
  assertNotNull("String_Node_Str",person);
  person.set("String_Node_Str",456);
  person.set("String_Node_Str","String_Node_Str");
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
  Node node=marshalDoc.getChildNodes().item(0);
  assertEquals("String_Node_Str","String_Node_Str",node.getNamespaceURI());
  assertNotNull("String_Node_Str",node.getPrefix());
  Node attr=node.getAttributes().item(0);
  assertNull("String_Node_Str",attr.getPrefix());
  Node childNode=node.getChildNodes().item(0);
  assertNull("String_Node_Str",childNode.getPrefix());
}

Fixed version (ground truth):
public void testXmlSchemaUnqualified() throws Exception {
  InputStream inputStream=ClassLoader.getSystemResourceAsStream(XMLSCHEMA_UNQUALIFIED);
  jaxbContext=DynamicJAXBContextFactory.createContextFromXSD(inputStream,null,null,null);
  DynamicEntity person=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
  assertNotNull("String_Node_Str",person);
  person.set("String_Node_Str",456);
  person.set("String_Node_Str","String_Node_Str");
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
  Node node=marshalDoc.getChildNodes().item(0);
  assertEquals("String_Node_Str","String_Node_Str",node.getNamespaceURI());
  assertNotNull("String_Node_Str",node.getPrefix());
  DocumentBuilderFactory builderFactory=DocumentBuilderFactory.newInstance();
  if (builderFactory.getClass().getPackage().getName().contains("String_Node_Str")) {
    return;
  }
 else {
    Node attr=node.getAttributes().item(0);
    assertNull("String_Node_Str" + attr.getPrefix() + "String_Node_Str",attr.getPrefix());
  }
  Node childNode=node.getChildNodes().item(0);
  assertNull("String_Node_Str",childNode.getPrefix());
}
Program: 66335
Project: 66335
Buggy source:
private void print(Object o) throws Exception {
  Marshaller marshaller=jaxbContext.createMarshaller();
  marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
  marshaller.marshal(o,System.out);
}

Fixed version (ground truth):
private void print(Object o) throws Exception {
  Marshaller marshaller=jaxbContext.createMarshaller();
  marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
  marshaller.marshal(o,System.err);
}
Program: 66336
Project: 66336
Buggy source:
public boolean handleEvent(ValidationEvent event){
  if (event.getSeverity() != ValidationEvent.ERROR) {
    return false;
  }
  errorCount++;
  if (errorCount == 1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean handleEvent(ValidationEvent event){
  if (event.getSeverity() != ValidationEvent.ERROR) {
    return false;
  }
  errorCount++;
  if (errorCount <= ignore) {
    return true;
  }
  return false;
}
Program: 66337
Project: 66337
Buggy source:
public void testIgnoreOneError() throws Exception {
  unmarshaller.setEventHandler(new CustomErrorValidationEventHandler());
  InputStream stream=ClassLoader.getSystemResourceAsStream(SINGLE_ERROR_XML);
  try {
    Object o=unmarshaller.unmarshal(stream);
  }
 catch (  UnmarshalException ex) {
    ex.printStackTrace();
    fail("String_Node_Str");
    return;
  }
  test1passed=true;
  assertTrue("String_Node_Str",true);
}

Fixed version (ground truth):
public void testIgnoreOneError() throws Exception {
  int numberOfErrorsToIgnore=1;
  DocumentBuilderFactory builderFactory=DocumentBuilderFactory.newInstance();
  if (builderFactory.getClass().getPackage().getName().contains("String_Node_Str")) {
    numberOfErrorsToIgnore=2;
  }
  unmarshaller.setEventHandler(new CustomErrorValidationEventHandler(numberOfErrorsToIgnore));
  InputStream stream=ClassLoader.getSystemResourceAsStream(SINGLE_ERROR_XML);
  try {
    Object o=unmarshaller.unmarshal(stream);
  }
 catch (  UnmarshalException ex) {
    ex.printStackTrace();
    fail("String_Node_Str");
    return;
  }
  test1passed=true;
  assertTrue("String_Node_Str",true);
}
Program: 66338
Project: 66338
Buggy source:
public boolean isOwningNode(XPathFragment xPathFragment){
  return xPathFragment.getNextFragment() == null || xPathFragment.getNextFragment().isAttribute();
}

Fixed version (ground truth):
public boolean isOwningNode(XPathFragment xPathFragment){
  return xPathFragment.getNextFragment() == null || xPathFragment.isAttribute();
}
Program: 66339
Project: 66339
Buggy source:
public boolean isOwningNode(XPathFragment xPathFragment){
  return (xPathFragment.getNextFragment() == null) || xPathFragment.getNextFragment().isAttribute();
}

Fixed version (ground truth):
public boolean isOwningNode(XPathFragment xPathFragment){
  return (xPathFragment.getNextFragment() == null) || xPathFragment.isAttribute();
}
Program: 66340
Project: 66340
Buggy source:
protected void buildConfigs(){
  this.addConfig(NO_SERVER_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_9_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_10_ID,"String_Node_Str");
  this.addConfig(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addConfig(JBOSS_ID,"String_Node_Str");
  this.addConfig(SUNAS_ID,"String_Node_Str");
  this.addConfig(CUSTOM_SERVER_ID,"String_Node_Str");
}

Fixed version (ground truth):
protected void buildConfigs(){
  this.addConfig(NO_SERVER_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_9_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_10_ID,"String_Node_Str");
  this.addConfig(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addConfig(WEBSPHERE_7_ID,"String_Node_Str");
  this.addConfig(JBOSS_ID,"String_Node_Str");
  this.addConfig(SUNAS_ID,"String_Node_Str");
  this.addConfig(CUSTOM_SERVER_ID,"String_Node_Str");
}
Program: 66341
Project: 66341
Buggy source:
protected void buidPlatforms(){
  this.addPlatform(NO_SERVER_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_9_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_10_ID,"String_Node_Str");
  this.addPlatform(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addPlatform(JBOSS_ID,"String_Node_Str");
  this.addPlatform(SUNAS_ID,"String_Node_Str");
  this.addPlatform(CUSTOM_SERVER_ID,"String_Node_Str");
}

Fixed version (ground truth):
protected void buidPlatforms(){
  this.addPlatform(NO_SERVER_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_9_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_10_ID,"String_Node_Str");
  this.addPlatform(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addPlatform(WEBSPHERE_7_ID,"String_Node_Str");
  this.addPlatform(JBOSS_ID,"String_Node_Str");
  this.addPlatform(SUNAS_ID,"String_Node_Str");
  this.addPlatform(CUSTOM_SERVER_ID,"String_Node_Str");
}
Program: 66344
Project: 66344
Buggy source:
public void endDocument(){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    XMLEvent endDoc=this.xmlEventFactory.createEndDocument();
    this.xmlEventWriter.add(endDoc);
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void endDocument(){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    xmlEventWriter.add(xmlEventFactory.createEndDocument());
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66345
Project: 66345
Buggy source:
public void startDocument(String encoding,String version){
  try {
    XMLEvent startDoc=this.xmlEventFactory.createStartDocument(encoding,version,false);
    this.xmlEventWriter.add(startDoc);
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void startDocument(String encoding,String version){
  try {
    xmlEventWriter.add(this.xmlEventFactory.createStartDocument(encoding,version,false));
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66346
Project: 66346
Buggy source:
public void cdata(String value){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    XMLEvent cdataEvent=this.xmlEventFactory.createCData(value);
    this.xmlEventWriter.add(cdataEvent);
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void cdata(String value){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    xmlEventWriter.add(xmlEventFactory.createCData(value));
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66347
Project: 66347
Buggy source:
public void characters(String value){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    XMLEvent charactersEvent=this.xmlEventFactory.createCharacters(value);
    this.xmlEventWriter.add(charactersEvent);
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void characters(String value){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    xmlEventWriter.add(xmlEventFactory.createCharacters(value));
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66348
Project: 66348
Buggy source:
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen=true;
  this.namespaceURI=xPathFragment.getNamespaceURI();
  this.xPathFragment=xPathFragment;
  this.attributes=null;
  this.namespaceDeclarations=null;
  writePrefixMappings();
}

Fixed version (ground truth):
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen=true;
  this.xPathFragment=xPathFragment;
  this.attributes=null;
  this.namespaceDeclarations=null;
  writePrefixMappings();
}
Program: 66349
Project: 66349
Buggy source:
public void node(Node node,NamespaceResolver resolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    if (node.getNodeType() == Node.DOCUMENT_NODE) {
      node=((Document)node).getDocumentElement();
    }
    domToXMLEventWriter.writeToEventWriter(node,this.xmlEventWriter);
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void node(Node node,NamespaceResolver resolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    if (node.getNodeType() == Node.DOCUMENT_NODE) {
      node=((Document)node).getDocumentElement();
    }
    domToXMLEventWriter.writeToEventWriter(node,xmlEventWriter);
  }
 catch (  XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66350
Project: 66350
Buggy source:
public void endElement(XPathFragment pathFragment,NamespaceResolver namespaceResolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  String namespaceURI=pathFragment.getNamespaceURI();
  String prefix=pathFragment.getPrefix();
  if (prefix == null) {
    prefix=XMLConstants.EMPTY_STRING;
  }
  try {
    XMLEvent endElement=this.xmlEventFactory.createEndElement(prefix,namespaceURI,pathFragment.getLocalName());
    this.xmlEventWriter.add(endElement);
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void endElement(XPathFragment pathFragment,NamespaceResolver namespaceResolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  String prefix=pathFragment.getPrefix();
  if (null == prefix) {
    prefix=XMLConstants.EMPTY_STRING;
  }
  try {
    xmlEventWriter.add(xmlEventFactory.createEndElement(prefix,xPathFragment.getNamespaceURI(),pathFragment.getLocalName()));
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66351
Project: 66351
Buggy source:
public void attribute(String namespaceURI,String localName,String name,String value){
  XMLEvent event;
  if (namespaceURI != null && namespaceURI.equals(XMLConstants.XMLNS_URL)) {
    try {
      if (localName.equals(XMLConstants.XMLNS)) {
        event=xmlEventFactory.createNamespace(value);
        xmlEventWriter.setDefaultNamespace(value);
      }
 else {
        event=xmlEventFactory.createNamespace(localName,value);
        xmlEventWriter.setPrefix(localName,value);
      }
    }
 catch (    XMLStreamException e) {
      throw XMLMarshalException.marshalException(e);
    }
  }
 else {
    NamespaceContext ctx=xmlEventWriter.getNamespaceContext();
    if (namespaceURI == null || namespaceURI.length() == 0) {
      event=xmlEventFactory.createAttribute(localName,value);
    }
 else {
      int index=name.indexOf(':');
      if (index == -1) {
        event=xmlEventFactory.createAttribute(XMLConstants.EMPTY_STRING,namespaceURI,localName,value);
      }
 else {
        String prefix=name.substring(0,index);
        event=xmlEventFactory.createAttribute(prefix,namespaceURI,localName,value);
      }
    }
  }
  if (event.isNamespace()) {
    if (null == this.namespaceDeclarations) {
      this.namespaceDeclarations=new ArrayList();
    }
    this.namespaceDeclarations.add(event);
  }
 else {
    if (null == this.attributes) {
      this.attributes=new ArrayList();
    }
    this.attributes.add(event);
  }
}

Fixed version (ground truth):
public void attribute(String namespaceURI,String localName,String name,String value){
  XMLEvent event;
  if (XMLConstants.XMLNS_URL.equals(namespaceURI)) {
    try {
      if (XMLConstants.XMLNS.equals(localName)) {
        event=xmlEventFactory.createNamespace(value);
        xmlEventWriter.setDefaultNamespace(value);
      }
 else {
        event=xmlEventFactory.createNamespace(localName,value);
        xmlEventWriter.setPrefix(localName,value);
      }
    }
 catch (    XMLStreamException e) {
      throw XMLMarshalException.marshalException(e);
    }
  }
 else {
    NamespaceContext ctx=xmlEventWriter.getNamespaceContext();
    if (namespaceURI == null || namespaceURI.length() == 0) {
      event=xmlEventFactory.createAttribute(localName,value);
    }
 else {
      int index=name.indexOf(':');
      if (index == -1) {
        event=xmlEventFactory.createAttribute(XMLConstants.EMPTY_STRING,namespaceURI,localName,value);
      }
 else {
        String prefix=name.substring(0,index);
        event=xmlEventFactory.createAttribute(prefix,namespaceURI,localName,value);
      }
    }
  }
  if (event.isNamespace()) {
    if (null == this.namespaceDeclarations) {
      this.namespaceDeclarations=new ArrayList();
    }
    this.namespaceDeclarations.add(event);
  }
 else {
    if (null == this.attributes) {
      this.attributes=new ArrayList();
    }
    this.attributes.add(event);
  }
}
Program: 66352
Project: 66352
Buggy source:
public void element(XPathFragment frag){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    String prefix=frag.getPrefix();
    if (null == prefix) {
      prefix=XMLConstants.EMPTY_STRING;
    }
    XMLEvent startElement=this.xmlEventFactory.createStartElement(prefix,frag.getNamespaceURI(),frag.getLocalName());
    this.xmlEventWriter.add(startElement);
    this.xmlEventWriter.add(this.xmlEventFactory.createEndElement(prefix,frag.getNamespaceURI(),frag.getLocalName()));
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void element(XPathFragment frag){
  try {
    if (isStartElementOpen) {
      openAndCloseStartElement();
      isStartElementOpen=false;
    }
    String namespaceURI=frag.getNamespaceURI();
    String localName=frag.getLocalName();
    String prefix=frag.getPrefix();
    if (null == prefix) {
      prefix=XMLConstants.EMPTY_STRING;
    }
    xmlEventWriter.add(xmlEventFactory.createStartElement(prefix,namespaceURI,localName));
    xmlEventWriter.add(xmlEventFactory.createEndElement(prefix,namespaceURI,localName));
  }
 catch (  Exception e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66353
Project: 66353
Buggy source:
/** 
 * PUBLIC: Get the fetch group manager for the descriptor.  The fetch group manager is responsible for managing the fetch group behaviors and operations. To use the fetch group, the domain object must implement FetchGroupTracker interface. Otherwise, a descriptor validation exception would throw during initialization.
 * @see org.eclipse.persistence.queries.FetchGroupTracker
 */
public FetchGroupManager getFetchGroupManager(){
  return this.fetchGroupManager;
}

Fixed version (ground truth):
/** 
 * PUBLIC: Get the fetch group manager for the descriptor.  The fetch group manager is responsible for managing the fetch group behaviors and operations. To use the fetch group, the domain object must implement FetchGroupTracker interface. Otherwise, a descriptor validation exception would throw during initialization. NOTE: This is currently only supported in CMP2.
 * @see org.eclipse.persistence.queries.FetchGroupTracker
 */
public FetchGroupManager getFetchGroupManager(){
  return fetchGroupManager;
}
Program: 66357
Project: 66357
Buggy source:
/** 
 */
public Source resolveSchema(String systemId){
  if (!addSchemaToList(systemId)) {
    return null;
  }
  try {
    InputSource inputSource=schemaResolver.resolveEntity(null,systemId);
    if (inputSource != null) {
      return new SAXSource(inputSource);
    }
  }
 catch (  Exception ex) {
    throw SDOException.errorResolvingSchema(ex);
  }
  return null;
}

Fixed version (ground truth):
public Source resolveSchema(String publicId,String systemId){
  if (!addSchemaToList(systemId)) {
    return null;
  }
  try {
    InputSource inputSource=schemaResolver.resolveEntity(publicId,systemId);
    if (inputSource != null) {
      return new SAXSource(inputSource);
    }
  }
 catch (  Exception ex) {
    throw SDOException.errorResolvingSchema(ex);
  }
  return null;
}
Program: 66360
Project: 66360
Buggy source:
public EncodedData getBytesFromDataHandler(DataHandler handler){
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  try {
    handler.writeTo(output);
  }
 catch (  IOException ex) {
  }
  return new EncodedData(output.toByteArray(),handler.getContentType());
}

Fixed version (ground truth):
public EncodedData getBytesFromDataHandler(DataHandler handler){
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  try {
    handler.writeTo(output);
  }
 catch (  IOException ex) {
    throw ConversionException.couldNotBeConverted(handler,byte[].class,ex);
  }
  return new EncodedData(output.toByteArray(),handler.getContentType());
}
Program: 66361
Project: 66361
Buggy source:
public Object convertObjectToImage(Object obj){
  if (obj instanceof Image) {
    return obj;
  }
  if (obj instanceof DataHandler) {
    try {
      if (((DataHandler)obj).getContent() instanceof Image) {
        Image image=(Image)((DataHandler)obj).getContent();
        return image;
      }
 else {
        return ImageIO.read(((DataHandler)obj).getInputStream());
      }
    }
 catch (    Exception ex) {
    }
  }
 else   if (obj instanceof byte[]) {
    ByteArrayInputStream stream=new ByteArrayInputStream((byte[])obj);
    try {
      return ImageIO.read(stream);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      return null;
    }
  }
 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);
    try {
      return ImageIO.read(stream);
    }
 catch (    Exception ex) {
      return null;
    }
  }
  return null;
}

Fixed version (ground truth):
public Object convertObjectToImage(Object obj){
  if (obj instanceof Image) {
    return obj;
  }
  if (obj instanceof DataHandler) {
    try {
      if (((DataHandler)obj).getContent() instanceof Image) {
        Image image=(Image)((DataHandler)obj).getContent();
        return image;
      }
 else {
        return ImageIO.read(((DataHandler)obj).getInputStream());
      }
    }
 catch (    Exception ex) {
      throw ConversionException.couldNotBeConverted(obj,IMAGE,ex);
    }
  }
 else   if (obj instanceof byte[]) {
    ByteArrayInputStream stream=new ByteArrayInputStream((byte[])obj);
    try {
      return ImageIO.read(stream);
    }
 catch (    Exception ex) {
      throw ConversionException.couldNotBeConverted(obj,IMAGE,ex);
    }
  }
 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);
    try {
      return ImageIO.read(stream);
    }
 catch (    Exception ex) {
      throw ConversionException.couldNotBeConverted(obj,IMAGE,ex);
    }
  }
  return null;
}
Program: 66362
Project: 66362
Buggy source:
public EncodedData getBytesFromMultipart(MimeMultipart value,XMLMarshaller marshaller){
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  try {
    ContentType contentType=new ContentType(value.getContentType());
    String boundary=contentType.getParameter("String_Node_Str");
    output.write(Helper.cr().getBytes());
    output.write(("String_Node_Str" + contentType.getBaseType() + "String_Node_Str"+ boundary+ "String_Node_Str").getBytes());
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  try {
    value.writeTo(output);
  }
 catch (  Exception ex) {
  }
  return new EncodedData(output.toByteArray(),value.getContentType());
}

Fixed version (ground truth):
public EncodedData getBytesFromMultipart(MimeMultipart value,XMLMarshaller marshaller){
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  try {
    ContentType contentType=new ContentType(value.getContentType());
    String boundary=contentType.getParameter("String_Node_Str");
    output.write(Helper.cr().getBytes());
    output.write(("String_Node_Str" + contentType.getBaseType() + "String_Node_Str"+ boundary+ "String_Node_Str").getBytes());
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(value,byte[].class,ex);
  }
  try {
    value.writeTo(output);
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(value,byte[].class,ex);
  }
  return new EncodedData(output.toByteArray(),value.getContentType());
}
Program: 66363
Project: 66363
Buggy source:
public String stringFromImage(Image image,QName schemaTypeQName,AbstractSession session){
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    String mimeType=null;
    if ((mimeType == null) || mimeType.startsWith("String_Node_Str")) {
      mimeType="String_Node_Str";
    }
    Iterator itr=ImageIO.getImageWritersByMIMEType(mimeType);
    if (itr.hasNext()) {
      ImageWriter w=(ImageWriter)itr.next();
      w.setOutput(ImageIO.createImageOutputStream(outputStream));
      w.write(convertToBufferedImage(image));
      w.dispose();
    }
 else {
      throw new RuntimeException("String_Node_Str" + mimeType);
    }
    return ((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).buildBase64StringFromBytes(outputStream.toByteArray());
  }
 catch (  Exception ex) {
  }
  return null;
}

Fixed version (ground truth):
public String stringFromImage(Image image,QName schemaTypeQName,AbstractSession session){
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    String mimeType=null;
    if ((mimeType == null) || mimeType.startsWith("String_Node_Str")) {
      mimeType="String_Node_Str";
    }
    Iterator itr=ImageIO.getImageWritersByMIMEType(mimeType);
    if (itr.hasNext()) {
      ImageWriter w=(ImageWriter)itr.next();
      w.setOutput(ImageIO.createImageOutputStream(outputStream));
      w.write(convertToBufferedImage(image));
      w.dispose();
    }
 else {
      throw XMLMarshalException.noEncoderForMimeType(mimeType);
    }
    return ((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).buildBase64StringFromBytes(outputStream.toByteArray());
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(image,byte[].class,ex);
  }
}
Program: 66364
Project: 66364
Buggy source:
public Object convertObjectToMultipart(Object obj){
  if (obj instanceof MimeMultipart) {
    return obj;
  }
  if (obj instanceof DataHandler) {
    try {
      if (((DataHandler)obj).getContent() instanceof MimeMultipart) {
        MimeMultipart multipart=(MimeMultipart)((DataHandler)obj).getContent();
        return multipart;
      }
 else {
        return new MimeMultipart(((DataHandler)obj).getDataSource());
      }
    }
 catch (    Exception ex) {
    }
  }
 else   if (obj instanceof byte[]) {
    try {
      byte[] bytes=(byte[])obj;
      java.io.InputStreamReader in=new java.io.InputStreamReader(new ByteArrayInputStream(bytes));
      int i=0;
      while (i != -1) {
        i=in.read();
      }
      return new MimeMultipart(new ByteArrayDataSource((byte[])obj,"String_Node_Str"));
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      return null;
    }
  }
 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();
    }
    try {
      return new MimeMultipart(new ByteArrayDataSource(bytes,"String_Node_Str"));
    }
 catch (    Exception ex) {
      return null;
    }
  }
  return null;
}

Fixed version (ground truth):
public Object convertObjectToMultipart(Object obj){
  if (obj instanceof MimeMultipart) {
    return obj;
  }
  if (obj instanceof DataHandler) {
    try {
      if (((DataHandler)obj).getContent() instanceof MimeMultipart) {
        MimeMultipart multipart=(MimeMultipart)((DataHandler)obj).getContent();
        return multipart;
      }
 else {
        return new MimeMultipart(((DataHandler)obj).getDataSource());
      }
    }
 catch (    Exception ex) {
      throw ConversionException.couldNotBeConverted(obj,MULTIPART,ex);
    }
  }
 else   if (obj instanceof byte[]) {
    try {
      byte[] bytes=(byte[])obj;
      java.io.InputStreamReader in=new java.io.InputStreamReader(new ByteArrayInputStream(bytes));
      int i=0;
      while (i != -1) {
        i=in.read();
      }
      return new MimeMultipart(new ByteArrayDataSource((byte[])obj,"String_Node_Str"));
    }
 catch (    Exception ex) {
      throw ConversionException.couldNotBeConverted(obj,MULTIPART,ex);
    }
  }
 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();
    }
    try {
      return new MimeMultipart(new ByteArrayDataSource(bytes,"String_Node_Str"));
    }
 catch (    Exception ex) {
      throw ConversionException.couldNotBeConverted(obj,MULTIPART,ex);
    }
  }
  return null;
}
Program: 66365
Project: 66365
Buggy source:
public EncodedData getBytesFromImage(Image image,String mimeType){
  if ((mimeType == null) || mimeType.startsWith("String_Node_Str")) {
    mimeType="String_Node_Str";
  }
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    Iterator itr=ImageIO.getImageWritersByMIMEType(mimeType);
    if (itr.hasNext()) {
      ImageWriter w=(ImageWriter)itr.next();
      w.setOutput(ImageIO.createImageOutputStream(outputStream));
      w.write(convertToBufferedImage(image));
      w.dispose();
    }
 else {
      throw XMLMarshalException.noEncoderForMimeType(mimeType);
    }
    return new EncodedData(outputStream.toByteArray(),mimeType);
  }
 catch (  Exception ex) {
  }
  return new EncodedData(new byte[0],null);
}

Fixed version (ground truth):
public EncodedData getBytesFromImage(Image image,String mimeType){
  if ((mimeType == null) || mimeType.startsWith("String_Node_Str")) {
    mimeType="String_Node_Str";
  }
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    Iterator itr=ImageIO.getImageWritersByMIMEType(mimeType);
    if (itr.hasNext()) {
      ImageWriter w=(ImageWriter)itr.next();
      w.setOutput(ImageIO.createImageOutputStream(outputStream));
      w.write(convertToBufferedImage(image));
      w.dispose();
    }
 else {
      throw XMLMarshalException.noEncoderForMimeType(mimeType);
    }
    return new EncodedData(outputStream.toByteArray(),mimeType);
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(image,byte[].class,ex);
  }
}
Program: 66366
Project: 66366
Buggy source:
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (this.fieldToClassMappings.size() == 0) {
    this.convertClassNamesToClasses(((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).getLoader());
  }
  Iterator<XMLMapping> mappings=getChoiceElementMappings().values().iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    Converter converter=null;
    if (fieldsToConverters != null) {
      converter=fieldsToConverters.get(nextMapping.getField());
    }
    if (nextMapping.isAbstractDirectMapping()) {
      if (converter != null) {
        ((AbstractDirectMapping)nextMapping).setConverter(converter);
      }
      XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
      QName schemaType=(QName)xmlConversionManager.getDefaultJavaTypes().get(nextMapping.getAttributeClassification());
      if (schemaType != null && ((XMLField)nextMapping.getField()).getSchemaType() == null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
    }
 else {
      if (converter != null) {
        ((AbstractCompositeObjectMapping)nextMapping).setConverter(converter);
      }
    }
    nextMapping.initialize(session);
  }
}

Fixed version (ground truth):
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (this.fieldToClassMappings.size() == 0) {
    this.convertClassNamesToClasses(((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).getLoader());
  }
  Iterator<XMLMapping> mappings=getChoiceElementMappings().values().iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    Converter converter=null;
    if (fieldsToConverters != null) {
      converter=fieldsToConverters.get(nextMapping.getField());
    }
    if (nextMapping.isAbstractDirectMapping()) {
      ((XMLDirectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
      if (converter != null) {
        ((AbstractDirectMapping)nextMapping).setConverter(converter);
      }
      XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
      QName schemaType=(QName)xmlConversionManager.getDefaultJavaTypes().get(nextMapping.getAttributeClassification());
      if (schemaType != null && ((XMLField)nextMapping.getField()).getSchemaType() == null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
    }
 else {
      ((XMLCompositeObjectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
      if (converter != null) {
        ((AbstractCompositeObjectMapping)nextMapping).setConverter(converter);
      }
    }
    nextMapping.initialize(session);
  }
}