nus-yam/ex-repair huggingface dataset:
Program: 64663
Project: 64663
Buggy source:
public void writeToStream(Node dom,XMLStreamWriter xsw) throws XMLStreamException {
  Node currentNode=dom;
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    Document doc=(Document)dom;
    xsw.writeStartDocument(doc.getXmlEncoding(),doc.getXmlVersion());
    currentNode=doc.getDocumentElement();
  }
  if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
    writeElement((Element)currentNode,xsw);
  }
 else   if (currentNode.getNodeType() == Node.ATTRIBUTE_NODE) {
    Attr attribute=(Attr)currentNode;
    if (attribute.getPrefix() != null && attribute.getPrefix().equals(XMLConstants.XMLNS)) {
      xsw.writeNamespace(attribute.getLocalName(),attribute.getValue());
    }
 else {
      if (attribute.getPrefix() == null) {
        xsw.writeAttribute(attribute.getName(),attribute.getValue());
      }
 else {
        xsw.writeAttribute(attribute.getPrefix(),attribute.getNamespaceURI(),attribute.getLocalName(),attribute.getValue());
      }
    }
  }
 else   if (currentNode.getNodeType() == Node.TEXT_NODE) {
    xsw.writeCharacters(((Text)currentNode).getNodeValue());
  }
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    xsw.writeEndDocument();
  }
}

Fixed version (ground truth):
public void writeToStream(Node dom,String newUri,String newName,XMLStreamWriter xsw) throws XMLStreamException {
  Node currentNode=dom;
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    Document doc=(Document)dom;
    xsw.writeStartDocument(doc.getXmlEncoding(),doc.getXmlVersion());
    currentNode=doc.getDocumentElement();
  }
  if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
    writeElement((Element)currentNode,newUri,newName,xsw);
  }
 else   if (currentNode.getNodeType() == Node.ATTRIBUTE_NODE) {
    Attr attribute=(Attr)currentNode;
    if (attribute.getPrefix() != null && attribute.getPrefix().equals(XMLConstants.XMLNS)) {
      xsw.writeNamespace(attribute.getLocalName(),attribute.getValue());
    }
 else {
      if (attribute.getPrefix() == null) {
        xsw.writeAttribute(attribute.getName(),attribute.getValue());
      }
 else {
        xsw.writeAttribute(attribute.getPrefix(),attribute.getNamespaceURI(),attribute.getLocalName(),attribute.getValue());
      }
    }
  }
 else   if (currentNode.getNodeType() == Node.TEXT_NODE) {
    xsw.writeCharacters(((Text)currentNode).getNodeValue());
  }
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    xsw.writeEndDocument();
  }
}
Program: 64665
Project: 64665
Buggy source:
public void parse(Node node) throws SAXException {
  if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {
    handleChildNodes(node.getChildNodes());
  }
 else {
    super.parse(node);
  }
}

Fixed version (ground truth):
public void parse(Node node,String uri,String name) throws SAXException {
  if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {
    handleChildNodes(node.getChildNodes());
  }
 else {
    super.parse(node,uri,name);
  }
}
Program: 64666
Project: 64666
Buggy source:
private BufferedReader getBufferedReaderForInputSource(InputSource inputSource){
  if (inputSource.getByteStream() != null) {
    return new BufferedReader(new InputStreamReader(inputSource.getByteStream()));
  }
 else   if (inputSource.getCharacterStream() != null) {
    return new BufferedReader(inputSource.getCharacterStream());
  }
 else   if (inputSource.getSystemId() != null) {
    InputStream is=getInputStreamFromString(inputSource.getSystemId());
    return new BufferedReader(new InputStreamReader(is));
  }
  return null;
}

Fixed version (ground truth):
private BufferedReader getBufferedReaderForInputSource(InputSource inputSource){
  if (inputSource.getByteStream() != null) {
    return new BufferedReader(new InputStreamReader(inputSource.getByteStream()));
  }
 else   if (inputSource.getCharacterStream() != null) {
    return new BufferedReader(inputSource.getCharacterStream());
  }
 else   if (inputSource.getSystemId() != null) {
    InputStream is=getInputStreamFromString(inputSource.getSystemId());
    return new BufferedReader(new InputStreamReader(is));
  }
  throw XMLMarshalException.unmarshalException();
}
Program: 64669
Project: 64669
Buggy source:
@Test public void testStaticReportQuery(){
  PersistenceUnitResource resource=new PersistenceUnitResource();
  resource.setPersistenceFactory(factory);
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE,null);
  PersistenceContext context=factory.get("String_Node_Str",BASE_URI,properties);
  Long count=(Long)((List)context.query(null,"String_Node_Str",null)).get(0);
  TestHttpHeaders headers=new TestHttpHeaders();
  headers.getAcceptableMediaTypes().add(MediaType.APPLICATION_JSON_TYPE);
  List<String> mediaTypes=new ArrayList<String>();
  mediaTypes.add(MediaType.APPLICATION_JSON);
  TestURIInfo ui=new TestURIInfo();
  StreamingOutput output=(StreamingOutput)resource.namedQuery("String_Node_Str","String_Node_Str",headers,ui).getEntity();
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    output.write(outputStream);
  }
 catch (  IOException ex) {
    fail(ex.toString());
  }
  String resultString=outputStream.toString();
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str" + count.toString() + "String_Node_Str"));
  clearData();
}

Fixed version (ground truth):
@Test public void testStaticReportQuery(){
  QueryResource resource=new QueryResource();
  resource.setPersistenceFactory(factory);
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE,null);
  PersistenceContext context=factory.get("String_Node_Str",BASE_URI,properties);
  Long count=(Long)((List)context.query(null,"String_Node_Str",null)).get(0);
  TestHttpHeaders headers=new TestHttpHeaders();
  headers.getAcceptableMediaTypes().add(MediaType.APPLICATION_JSON_TYPE);
  List<String> mediaTypes=new ArrayList<String>();
  mediaTypes.add(MediaType.APPLICATION_JSON);
  TestURIInfo ui=new TestURIInfo();
  StreamingOutput output=(StreamingOutput)resource.namedQuery("String_Node_Str","String_Node_Str",headers,ui).getEntity();
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    output.write(outputStream);
  }
 catch (  IOException ex) {
    fail(ex.toString());
  }
  String resultString=outputStream.toString();
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str" + count.toString() + "String_Node_Str"));
  clearData();
}
Program: 64670
Project: 64670
Buggy source:
@Test public void testNamedQuerySingleResult(){
  PersistenceUnitResource resource=new PersistenceUnitResource();
  resource.setPersistenceFactory(factory);
  PersistenceContext context=getAuctionPersistenceContext(null);
  DynamicEntity entity1=(DynamicEntity)context.newEntity("String_Node_Str");
  entity1.set("String_Node_Str","String_Node_Str");
  context.create(null,entity1);
  DynamicEntity entity2=(DynamicEntity)context.newEntity("String_Node_Str");
  entity2.set("String_Node_Str","String_Node_Str");
  context.create(null,entity2);
  TestHttpHeaders headers=new TestHttpHeaders();
  headers.getAcceptableMediaTypes().add(MediaType.APPLICATION_JSON_TYPE);
  List<String> mediaTypes=new ArrayList<String>();
  mediaTypes.add(MediaType.APPLICATION_JSON);
  TestURIInfo ui=new TestURIInfo();
  ui.addMatrixParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  StreamingOutput output=(StreamingOutput)resource.namedQuerySingleResult("String_Node_Str","String_Node_Str",headers,ui).getEntity();
  String resultString=stringifyResults(output);
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str"));
  assertFalse("String_Node_Str",resultString.contains("String_Node_Str"));
  clearData();
}

Fixed version (ground truth):
@Test public void testNamedQuerySingleResult(){
  SingleResultQueryResource resource=new SingleResultQueryResource();
  resource.setPersistenceFactory(factory);
  PersistenceContext context=getAuctionPersistenceContext(null);
  DynamicEntity entity1=(DynamicEntity)context.newEntity("String_Node_Str");
  entity1.set("String_Node_Str","String_Node_Str");
  context.create(null,entity1);
  DynamicEntity entity2=(DynamicEntity)context.newEntity("String_Node_Str");
  entity2.set("String_Node_Str","String_Node_Str");
  context.create(null,entity2);
  TestHttpHeaders headers=new TestHttpHeaders();
  headers.getAcceptableMediaTypes().add(MediaType.APPLICATION_JSON_TYPE);
  List<String> mediaTypes=new ArrayList<String>();
  mediaTypes.add(MediaType.APPLICATION_JSON);
  TestURIInfo ui=new TestURIInfo();
  ui.addMatrixParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  StreamingOutput output=(StreamingOutput)resource.namedQuerySingleResult("String_Node_Str","String_Node_Str",headers,ui).getEntity();
  String resultString=stringifyResults(output);
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str"));
  assertFalse("String_Node_Str",resultString.contains("String_Node_Str"));
  clearData();
}
Program: 64671
Project: 64671
Buggy source:
@Test public void testWriteQuery(){
  PersistenceUnitResource resource=new PersistenceUnitResource();
  resource.setPersistenceFactory(factory);
  PersistenceContext context=getAuctionPersistenceContext(null);
  DynamicEntity entity=(DynamicEntity)context.newEntity("String_Node_Str");
  entity.set("String_Node_Str","String_Node_Str");
  context.create(null,entity);
  TestURIInfo ui=new TestURIInfo();
  ui.addMatrixParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  ui.addMatrixParameter("String_Node_Str","String_Node_Str",entity.get("String_Node_Str").toString());
  resource.namedQueryUpdate("String_Node_Str","String_Node_Str",generateHTTPHeader(MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON),ui);
  entity=(DynamicEntity)context.find("String_Node_Str",entity.get("String_Node_Str"));
  assertTrue("String_Node_Str",entity.get("String_Node_Str").equals("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testWriteQuery(){
  QueryResource resource=new QueryResource();
  resource.setPersistenceFactory(factory);
  PersistenceContext context=getAuctionPersistenceContext(null);
  DynamicEntity entity=(DynamicEntity)context.newEntity("String_Node_Str");
  entity.set("String_Node_Str","String_Node_Str");
  context.create(null,entity);
  TestURIInfo ui=new TestURIInfo();
  ui.addMatrixParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  ui.addMatrixParameter("String_Node_Str","String_Node_Str",entity.get("String_Node_Str").toString());
  resource.namedQueryUpdate("String_Node_Str","String_Node_Str",generateHTTPHeader(MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON),ui);
  entity=(DynamicEntity)context.find("String_Node_Str",entity.get("String_Node_Str"));
  assertTrue("String_Node_Str",entity.get("String_Node_Str").equals("String_Node_Str"));
}
Program: 64672
Project: 64672
Buggy source:
@Test public void testNamedQuery(){
  PersistenceUnitResource resource=new PersistenceUnitResource();
  resource.setPersistenceFactory(factory);
  PersistenceContext context=getAuctionPersistenceContext(null);
  DynamicEntity entity1=(DynamicEntity)context.newEntity("String_Node_Str");
  entity1.set("String_Node_Str","String_Node_Str");
  context.create(null,entity1);
  DynamicEntity entity2=(DynamicEntity)context.newEntity("String_Node_Str");
  entity2.set("String_Node_Str","String_Node_Str");
  context.create(null,entity2);
  TestHttpHeaders headers=new TestHttpHeaders();
  headers.getAcceptableMediaTypes().add(MediaType.APPLICATION_JSON_TYPE);
  List<String> mediaTypes=new ArrayList<String>();
  mediaTypes.add(MediaType.APPLICATION_JSON);
  TestURIInfo ui=new TestURIInfo();
  StreamingOutput output=(StreamingOutput)resource.namedQuery("String_Node_Str","String_Node_Str",headers,ui).getEntity();
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    output.write(outputStream);
  }
 catch (  IOException ex) {
    fail(ex.toString());
  }
  String resultString=outputStream.toString();
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str"));
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str"));
  clearData();
}

Fixed version (ground truth):
@Test public void testNamedQuery(){
  QueryResource resource=new QueryResource();
  resource.setPersistenceFactory(factory);
  PersistenceContext context=getAuctionPersistenceContext(null);
  DynamicEntity entity1=(DynamicEntity)context.newEntity("String_Node_Str");
  entity1.set("String_Node_Str","String_Node_Str");
  context.create(null,entity1);
  DynamicEntity entity2=(DynamicEntity)context.newEntity("String_Node_Str");
  entity2.set("String_Node_Str","String_Node_Str");
  context.create(null,entity2);
  TestHttpHeaders headers=new TestHttpHeaders();
  headers.getAcceptableMediaTypes().add(MediaType.APPLICATION_JSON_TYPE);
  List<String> mediaTypes=new ArrayList<String>();
  mediaTypes.add(MediaType.APPLICATION_JSON);
  TestURIInfo ui=new TestURIInfo();
  StreamingOutput output=(StreamingOutput)resource.namedQuery("String_Node_Str","String_Node_Str",headers,ui).getEntity();
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  try {
    output.write(outputStream);
  }
 catch (  IOException ex) {
    fail(ex.toString());
  }
  String resultString=outputStream.toString();
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str"));
  assertTrue("String_Node_Str",resultString.contains("String_Node_Str"));
  clearData();
}
Program: 64673
Project: 64673
Buggy source:
public JPARSApplication(){
  HashSet<Class<?>> c=new HashSet<Class<?>>();
  c.add(PersistenceResource.class);
  c.add(PersistenceUnitResource.class);
  c.add(EntityResource.class);
  c.add(ClassNotFoundExceptionMapper.class);
  c.add(ConversionExceptionMapper.class);
  c.add(EntityNotFoundExceptionMapper.class);
  c.add(IllegalAccessExceptionMapper.class);
  c.add(IllegalArgumentExceptionMapper.class);
  c.add(IllegalStateExceptionMapper.class);
  c.add(InvocationTargetExceptionMapper.class);
  c.add(IOExceptionMapper.class);
  c.add(JAXBExceptionMapper.class);
  c.add(JPARSExceptionMapper.class);
  c.add(MalformedURLExceptionMapper.class);
  c.add(NamingExceptionMapper.class);
  c.add(NonUniqueResultExceptionExceptionMapper.class);
  c.add(NoResultExceptionMapper.class);
  c.add(NoSuchMethodExceptionMapper.class);
  classes=Collections.unmodifiableSet(c);
}

Fixed version (ground truth):
public JPARSApplication(){
  HashSet<Class<?>> c=new HashSet<Class<?>>();
  c.add(PersistenceResource.class);
  c.add(PersistenceUnitResource.class);
  c.add(EntityResource.class);
  c.add(SingleResultQueryResource.class);
  c.add(QueryResource.class);
  c.add(ClassNotFoundExceptionMapper.class);
  c.add(ConversionExceptionMapper.class);
  c.add(EntityNotFoundExceptionMapper.class);
  c.add(IllegalAccessExceptionMapper.class);
  c.add(IllegalArgumentExceptionMapper.class);
  c.add(IllegalStateExceptionMapper.class);
  c.add(InvocationTargetExceptionMapper.class);
  c.add(IOExceptionMapper.class);
  c.add(JAXBExceptionMapper.class);
  c.add(JPARSExceptionMapper.class);
  c.add(MalformedURLExceptionMapper.class);
  c.add(NamingExceptionMapper.class);
  c.add(NonUniqueResultExceptionExceptionMapper.class);
  c.add(NoResultExceptionMapper.class);
  c.add(NoSuchMethodExceptionMapper.class);
  classes=Collections.unmodifiableSet(c);
}
Program: 64674
Project: 64674
Buggy source:
@Test public void echoLong() throws ParseException {
  Invocation invocation=new Invocation("String_Node_Str");
  byte[] testBytes="String_Node_Str".getBytes();
  invocation.setParameter("String_Node_Str",testBytes);
  Operation op=xrService.getOperation(invocation.getName());
  Object result=op.invoke(xrService,invocation);
  assertNotNull("String_Node_Str",result);
  Document doc=xmlPlatform.createDocument();
  XMLMarshaller marshaller=xrService.getXMLContext().createMarshaller();
  marshaller.marshal(((XMLRoot)result).getObject(),doc);
  Document controlDoc=xmlParser.parse(new StringReader(ECHO_LONG_RESULT));
  assertTrue("String_Node_Str",comparer.isNodeEqual(controlDoc,doc));
}

Fixed version (ground truth):
@Test public void echoLong() throws ParseException {
  Invocation invocation=new Invocation("String_Node_Str");
  invocation.setParameter("String_Node_Str","String_Node_Str");
  Operation op=xrService.getOperation(invocation.getName());
  Object result=op.invoke(xrService,invocation);
  assertNotNull("String_Node_Str",result);
  Document doc=xmlPlatform.createDocument();
  XMLMarshaller marshaller=xrService.getXMLContext().createMarshaller();
  marshaller.marshal(((XMLRoot)result).getObject(),doc);
  Document controlDoc=xmlParser.parse(new StringReader(ECHO_LONG_RESULT));
  assertTrue("String_Node_Str" + documentToString(controlDoc) + "String_Node_Str"+ documentToString(doc),comparer.isNodeEqual(controlDoc,doc));
}
Program: 64677
Project: 64677
Buggy source:
@AfterClass public static void tearDown(){
  String ddlDrop=System.getProperty(DATABASE_DDL_DROP_KEY,DEFAULT_DATABASE_DDL_DROP);
  if ("String_Node_Str".equalsIgnoreCase(ddlDrop)) {
    runDdl(conn,DROP_PACKAGE1_PACKAGE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_MRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_NRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_MTAB1_TYPE,ddlDebug);
    runDdl(conn,DROP_EMP_RECORD_PACKAGE_BODY,ddlDebug);
    runDdl(conn,DROP_EMP_RECORD_PACKAGE,ddlDebug);
    runDdl(conn,DROP_EMPREC_TYPE,ddlDebug);
    runDdl(conn,DROP_EMPTYPE_TABLE,ddlDebug);
  }
}

Fixed version (ground truth):
@AfterClass public static void tearDown(){
  if (ddlDrop) {
    runDdl(conn,DROP_PACKAGE1_PACKAGE_BODY,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_PACKAGE,ddlDebug);
    runDdl(conn,DROP_EMP_RECORD_PACKAGE_BODY,ddlDebug);
    runDdl(conn,DROP_EMP_RECORD_PACKAGE,ddlDebug);
    runDdl(conn,DROP_EMPTYPE_TABLE,ddlDebug);
    for (    String ddl : builder.getTypeDropDDL()) {
      try {
        int lastIdx=ddl.lastIndexOf("String_Node_Str");
        if (lastIdx == (ddl.length() - 1)) {
          ddl=ddl.substring(0,ddl.length() - 1);
        }
      }
 catch (      Exception xxx) {
      }
      runDdl(conn,ddl,ddlDebug);
    }
  }
}
Program: 64678
Project: 64678
Buggy source:
public void endVisit(ROWTYPEType rowTYPEType){
  rowTYPETypes.pop();
  DDLWrapper ddlWrapper=createDDLs.get(rowTYPEType);
  if (ddlWrapper != null && !ddlWrapper.finished) {
    ddlWrapper.ddl+=END_OBJECT;
    ddlWrapper.finished=true;
  }
  ddlWrapper=dropDDLs.get(rowTYPEType);
  if (ddlWrapper == null) {
    ddlWrapper=new DDLWrapper();
    ddlWrapper.ddl=DROP_TYPE + getShadowROWTYPETypeName(rowTYPEType) + FORCE+ SEMICOLON;
    ddlWrapper.finished=true;
    dropDDLs.put(rowTYPEType,ddlWrapper);
  }
}

Fixed version (ground truth):
@Override public void endVisit(ROWTYPEType rowTYPEType){
  rowTYPETypes.pop();
  DDLWrapper ddlWrapper=createDDLs.get(rowTYPEType);
  if (ddlWrapper != null && !ddlWrapper.finished) {
    ddlWrapper.ddl+=END_OBJECT;
    ddlWrapper.finished=true;
  }
  ddlWrapper=dropDDLs.get(rowTYPEType);
  if (ddlWrapper == null) {
    ddlWrapper=new DDLWrapper();
    ddlWrapper.ddl=DROP_TYPE + getShadowROWTYPETypeName(rowTYPEType) + FORCE+ SEMICOLON;
    ddlWrapper.finished=true;
    dropDDLs.put(rowTYPEType,ddlWrapper);
  }
}
Program: 64681
Project: 64681
Buggy source:
/** 
 * Execute the statement.
 */
public Integer executeDirectNoSelect(Statement statement,DatabaseCall call,AbstractSession session) throws DatabaseException {
  int rowCount=0;
  try {
    if (call != null) {
      session.startOperationProfile(SessionProfiler.StatementExecute,call.getQuery(),SessionProfiler.ALL);
    }
 else {
      session.startOperationProfile(SessionProfiler.StatementExecute,null,SessionProfiler.ALL);
    }
    if ((call != null) && call.isDynamicCall(session)) {
      rowCount=statement.executeUpdate(call.getSQLString());
    }
 else {
      rowCount=((PreparedStatement)statement).executeUpdate();
    }
    if ((!getPlatform().supportsAutoCommit()) && (!this.isInTransaction)) {
      getPlatform().autoCommit(this);
    }
  }
 catch (  SQLException exception) {
    if (!getPlatform().shouldIgnoreException(exception)) {
      DatabaseException commException=processExceptionForCommError(session,exception,call);
      if (commException != null)       throw commException;
      throw DatabaseException.sqlException(exception,this,session,false);
    }
  }
 finally {
    if (call != null) {
      session.endOperationProfile(SessionProfiler.StatementExecute,call.getQuery(),SessionProfiler.ALL);
    }
 else {
      session.endOperationProfile(SessionProfiler.StatementExecute,null,SessionProfiler.ALL);
    }
  }
  return Integer.valueOf(rowCount);
}

Fixed version (ground truth):
/** 
 * Execute the statement.
 */
public Integer executeDirectNoSelect(Statement statement,DatabaseCall call,AbstractSession session) throws DatabaseException {
  int rowCount=0;
  try {
    if (call != null) {
      session.startOperationProfile(SessionProfiler.StatementExecute,call.getQuery(),SessionProfiler.ALL);
    }
 else {
      session.startOperationProfile(SessionProfiler.StatementExecute,null,SessionProfiler.ALL);
    }
    if ((call != null) && call.isDynamicCall(session)) {
      rowCount=statement.executeUpdate(call.getSQLString());
    }
 else {
      rowCount=((PreparedStatement)statement).executeUpdate();
    }
    if (call != null && call.getQuery().isUserDefined() && call.isStoredProcedureCall() && call.isNothingReturned() && rowCount != statement.getUpdateCount()) {
      throw new IllegalStateException(ExceptionLocalization.buildMessage("String_Node_Str"));
    }
    if ((!getPlatform().supportsAutoCommit()) && (!this.isInTransaction)) {
      getPlatform().autoCommit(this);
    }
  }
 catch (  SQLException exception) {
    if (!getPlatform().shouldIgnoreException(exception)) {
      DatabaseException commException=processExceptionForCommError(session,exception,call);
      if (commException != null)       throw commException;
      throw DatabaseException.sqlException(exception,this,session,false);
    }
  }
 finally {
    if (call != null) {
      session.endOperationProfile(SessionProfiler.StatementExecute,call.getQuery(),SessionProfiler.ALL);
    }
 else {
      session.endOperationProfile(SessionProfiler.StatementExecute,null,SessionProfiler.ALL);
    }
  }
  return Integer.valueOf(rowCount);
}
Program: 64683
Project: 64683
Buggy source:
/** 
 * INTERNAL: Copy all setting from the query. This is used to morph queries from one type to the other. By default this calls prepareFromQuery, but additional properties may be required to be copied as prepareFromQuery only copies properties that affect the SQL.
 */
public void copyFromQuery(DatabaseQuery query){
  prepareFromQuery(query);
  this.cascadePolicy=query.cascadePolicy;
  this.flushOnExecute=query.flushOnExecute;
  this.arguments=query.arguments;
  this.nullableArguments=query.nullableArguments;
  this.argumentTypes=query.argumentTypes;
  this.argumentTypeNames=query.argumentTypeNames;
  this.argumentValues=query.argumentValues;
  this.queryTimeout=query.queryTimeout;
  this.redirector=query.redirector;
  this.sessionName=query.sessionName;
  this.shouldBindAllParameters=query.shouldBindAllParameters;
  this.shouldCacheStatement=query.shouldCacheStatement;
  this.shouldMaintainCache=query.shouldMaintainCache;
  this.shouldPrepare=query.shouldPrepare;
  this.shouldUseWrapperPolicy=query.shouldUseWrapperPolicy;
  this.properties=query.properties;
  this.doNotRedirect=query.doNotRedirect;
  this.shouldRetrieveBypassCache=query.shouldRetrieveBypassCache;
  this.shouldStoreBypassCache=query.shouldStoreBypassCache;
  this.parameterDelimiter=query.parameterDelimiter;
  this.shouldCloneCall=query.shouldCloneCall;
  this.partitioningPolicy=query.partitioningPolicy;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Copy all setting from the query. This is used to morph queries from one type to the other. By default this calls prepareFromQuery, but additional properties may be required to be copied as prepareFromQuery only copies properties that affect the SQL.
 */
public void copyFromQuery(DatabaseQuery query){
  prepareFromQuery(query);
  this.cascadePolicy=query.cascadePolicy;
  this.flushOnExecute=query.flushOnExecute;
  this.arguments=query.arguments;
  this.nullableArguments=query.nullableArguments;
  this.argumentTypes=query.argumentTypes;
  this.argumentTypeNames=query.argumentTypeNames;
  this.argumentValues=query.argumentValues;
  this.queryTimeout=query.queryTimeout;
  this.redirector=query.redirector;
  this.sessionName=query.sessionName;
  this.shouldBindAllParameters=query.shouldBindAllParameters;
  this.shouldCacheStatement=query.shouldCacheStatement;
  this.shouldMaintainCache=query.shouldMaintainCache;
  this.shouldPrepare=query.shouldPrepare;
  this.shouldUseWrapperPolicy=query.shouldUseWrapperPolicy;
  this.properties=query.properties;
  this.doNotRedirect=query.doNotRedirect;
  this.shouldRetrieveBypassCache=query.shouldRetrieveBypassCache;
  this.shouldStoreBypassCache=query.shouldStoreBypassCache;
  this.parameterDelimiter=query.parameterDelimiter;
  this.shouldCloneCall=query.shouldCloneCall;
  this.partitioningPolicy=query.partitioningPolicy;
  this.isJPAUserDefined=query.isJPAUserDefined;
}
Program: 64684
Project: 64684
Buggy source:
/** 
 * INTERNAL: Return the cached database query for this EJBQueryImpl. If the query is a named query and it has not yet been looked up, the query will be looked up and stored as the cached query.
 */
public DatabaseQuery getDatabaseQueryInternal(){
  if ((this.queryName != null) && (this.databaseQuery == null)) {
    this.databaseQuery=this.entityManager.getAbstractSession().getQuery(this.queryName);
    if (this.databaseQuery != null) {
      if (!this.databaseQuery.isPrepared()) {
        this.databaseQuery.checkPrepare(this.entityManager.getAbstractSession(),new DatabaseRecord());
      }
    }
 else {
      throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str",new Object[]{this.queryName}));
    }
  }
  return this.databaseQuery;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Return the cached database query for this EJBQueryImpl. If the query is a named query and it has not yet been looked up, the query will be looked up and stored as the cached query.
 */
public DatabaseQuery getDatabaseQueryInternal(){
  if ((this.queryName != null) && (this.databaseQuery == null)) {
    this.databaseQuery=this.entityManager.getAbstractSession().getQuery(this.queryName);
    if (this.databaseQuery != null) {
      if (!this.databaseQuery.isPrepared()) {
        this.databaseQuery.checkPrepare(this.entityManager.getAbstractSession(),new DatabaseRecord());
      }
    }
 else {
      throw new IllegalArgumentException(ExceptionLocalization.buildMessage("String_Node_Str",new Object[]{this.queryName}));
    }
  }
  databaseQuery.setIsJPAUserDefined(true);
  return this.databaseQuery;
}
Program: 64687
Project: 64687
Buggy source:
/** 
 * Return the JDBC type name for a given JDBC type code.
 */
public static String getJDBCTypeNameFromType(int jdbcType){
  String typeName=OTHER_STR;
switch (jdbcType) {
case Types.NUMERIC:
    typeName=NUMERIC_STR;
  break;
case Types.VARCHAR:
typeName=VARCHAR_STR;
break;
case Types.DECIMAL:
typeName=DECIMAL_STR;
break;
case Types.CHAR:
typeName=CHAR_STR;
break;
case Types.NCHAR:
typeName=NCHAR_STR;
break;
case Types.FLOAT:
typeName=FLOAT_STR;
break;
case Types.REAL:
typeName=REAL_STR;
break;
case Types.DOUBLE:
typeName=DOUBLE_STR;
break;
case Types.BINARY:
typeName=BINARY_STR;
break;
case Types.BLOB:
typeName=BLOB_STR;
break;
case Types.CLOB:
typeName=CLOB_STR;
break;
case Types.NCLOB:
typeName=NCLOB_STR;
break;
case Types.VARBINARY:
typeName=VARBINARY_STR;
break;
case Types.LONGVARBINARY:
typeName=LONGVARBINARY_STR;
break;
case Types.DATE:
typeName=DATE_STR;
break;
case Types.TIME:
typeName=TIME_STR;
break;
case Types.TIMESTAMP:
typeName=TIMESTAMP_STR;
break;
case Types.BIGINT:
typeName=BIGINT_STR;
break;
case Types.ARRAY:
typeName=ARRAY_STR;
break;
case Types.STRUCT:
typeName=STRUCT_STR;
break;
}
return typeName;
}

Fixed version (ground truth):
/** 
 * Return the JDBC type name for a given JDBC type code.
 */
public static String getJDBCTypeNameFromType(int jdbcType){
  String typeName=OTHER_STR;
switch (jdbcType) {
case Types.NUMERIC:
    typeName=NUMERIC_STR;
  break;
case Types.VARCHAR:
typeName=VARCHAR_STR;
break;
case Types.NVARCHAR:
typeName=NVARCHAR_STR;
break;
case Types.DECIMAL:
typeName=DECIMAL_STR;
break;
case Types.CHAR:
typeName=CHAR_STR;
break;
case Types.NCHAR:
typeName=NCHAR_STR;
break;
case Types.FLOAT:
typeName=FLOAT_STR;
break;
case Types.REAL:
typeName=REAL_STR;
break;
case Types.DOUBLE:
typeName=DOUBLE_STR;
break;
case Types.BINARY:
typeName=BINARY_STR;
break;
case Types.BLOB:
typeName=BLOB_STR;
break;
case Types.CLOB:
typeName=CLOB_STR;
break;
case Types.NCLOB:
typeName=NCLOB_STR;
break;
case Types.VARBINARY:
typeName=VARBINARY_STR;
break;
case Types.LONGVARBINARY:
typeName=LONGVARBINARY_STR;
break;
case Types.DATE:
typeName=DATE_STR;
break;
case Types.TIME:
typeName=TIME_STR;
break;
case Types.TIMESTAMP:
typeName=TIMESTAMP_STR;
break;
case Types.BIGINT:
typeName=BIGINT_STR;
break;
case Types.ARRAY:
typeName=ARRAY_STR;
break;
case Types.STRUCT:
typeName=STRUCT_STR;
break;
}
return typeName;
}
Program: 64688
Project: 64688
Buggy source:
/** 
 * Return the XML type (as a QName) associated with the given JDBC type.
 */
public static QName getXMLTypeFromJDBCType(int jdbcType){
switch (jdbcType) {
case CHAR:
case NCHAR:
case LONGVARCHAR:
case VARCHAR:
case CLOB:
case NCLOB:
    return STRING_QNAME;
case BIGINT:
  return INTEGER_QNAME;
case INTEGER:
case SMALLINT:
case TINYINT:
return INT_QNAME;
case NUMERIC:
case DECIMAL:
return DECIMAL_QNAME;
case DOUBLE:
case FLOAT:
case REAL:
return DOUBLE_QNAME;
case DATE:
return DATE_QNAME;
case TIME:
return TIME_QNAME;
case TIMESTAMP:
return DATE_TIME_QNAME;
default :
return BASE_64_BINARY_QNAME;
}
}

Fixed version (ground truth):
/** 
 * Return the XML type (as a QName) associated with the given JDBC type.
 */
public static QName getXMLTypeFromJDBCType(int jdbcType){
switch (jdbcType) {
case CHAR:
case NCHAR:
case LONGVARCHAR:
case VARCHAR:
case NVARCHAR:
case CLOB:
case NCLOB:
    return STRING_QNAME;
case BIGINT:
  return INTEGER_QNAME;
case INTEGER:
case SMALLINT:
case TINYINT:
return INT_QNAME;
case NUMERIC:
case DECIMAL:
return DECIMAL_QNAME;
case DOUBLE:
case FLOAT:
case REAL:
return DOUBLE_QNAME;
case DATE:
return DATE_QNAME;
case TIME:
return TIME_QNAME;
case TIMESTAMP:
return DATE_TIME_QNAME;
default :
return BASE_64_BINARY_QNAME;
}
}
Program: 64694
Project: 64694
Buggy source:
@AfterClass public static void tearDown(){
  String ddlDrop=System.getProperty(DATABASE_DDL_DROP_KEY,DEFAULT_DATABASE_DDL_DROP);
  if ("String_Node_Str".equalsIgnoreCase(ddlDrop)) {
    runDdl(conn,DROP_PACKAGE1_PACKAGE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_MRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_NRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_MTAB1_TYPE,ddlDebug);
  }
}

Fixed version (ground truth):
@AfterClass public static void tearDown(){
  String ddlDrop=System.getProperty(DATABASE_DDL_DROP_KEY,DEFAULT_DATABASE_DDL_DROP);
  if ("String_Node_Str".equalsIgnoreCase(ddlDrop)) {
    runDdl(conn,DROP_PACKAGE1_PACKAGE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_MRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_NRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_PACKAGE1_MTAB1_TYPE,ddlDebug);
    runDdl(conn,DROP_EMP_RECORD_PACKAGE_BODY,ddlDebug);
    runDdl(conn,DROP_EMP_RECORD_PACKAGE,ddlDebug);
    runDdl(conn,DROP_EMPREC_TYPE,ddlDebug);
    runDdl(conn,DROP_EMPTYPE_TABLE,ddlDebug);
  }
}
Program: 64697
Project: 64697
Buggy source:
public void setFieldToNodeValues(Map<XMLField,NodeValue> fieldToNodeValues){
  this.fieldToNodeValues=fieldToNodeValues;
}

Fixed version (ground truth):
public void setFieldToNodeValues(Map<XMLField,NodeValue> fieldToNodeValues){
  this.fieldToNodeValues=fieldToNodeValues;
  this.classToNodeValues=new HashMap<Class,NodeValue>();
  for (  XMLField nextField : fieldToNodeValues.keySet()) {
    Class associatedClass=this.xmlChoiceCollectionMapping.getFieldToClassMappings().get(nextField);
    this.classToNodeValues.put(associatedClass,fieldToNodeValues.get(nextField));
  }
  Collection classes=this.classToNodeValues.keySet();
  for (  Class nextClass : this.xmlChoiceCollectionMapping.getChoiceElementMappingsByClass().keySet()) {
    if (!(classes.contains(nextClass))) {
      XMLField field=xmlChoiceCollectionMapping.getClassToFieldMappings().get(nextClass);
      NodeValue nodeValue=new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceCollectionMapping,xmlField,xmlChoiceCollectionMapping.getChoiceElementMappingsByClass().get(nextClass));
      this.classToNodeValues.put(nextClass,nodeValue);
      NodeValue nodeValueForField=fieldToNodeValues.get(field);
      nodeValue.setXPathNode(nodeValueForField.getXPathNode());
    }
  }
}
Program: 64699
Project: 64699
Buggy source:
public XMLChoiceCollectionMappingUnmarshalNodeValue(XMLChoiceCollectionMapping mapping,XMLField xmlField){
  this.xmlChoiceCollectionMapping=mapping;
  this.xmlField=xmlField;
  initializeNodeValue();
}

Fixed version (ground truth):
public XMLChoiceCollectionMappingUnmarshalNodeValue(XMLChoiceCollectionMapping mapping,XMLField xmlField,XMLMapping nestedMapping){
  this.xmlChoiceCollectionMapping=mapping;
  this.xmlField=xmlField;
  this.nestedMapping=nestedMapping;
  initializeNodeValue();
}
Program: 64700
Project: 64700
Buggy source:
private void initializeNodeValue(){
  XMLMapping xmlMapping=xmlChoiceCollectionMapping.getChoiceElementMappings().get(xmlField);
  if (xmlMapping instanceof XMLBinaryDataCollectionMapping) {
    choiceElementNodeValue=new XMLBinaryDataCollectionMappingNodeValue((XMLBinaryDataCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof XMLCompositeDirectCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((XMLCompositeDirectCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof XMLCompositeCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeCollectionMappingNodeValue((XMLCompositeCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else {
    choiceElementNodeValue=new XMLCollectionReferenceMappingNodeValue((XMLCollectionReferenceMapping)xmlMapping,xmlField);
    choiceElementMarshalNodeValue=new XMLCollectionReferenceMappingMarshalNodeValue((XMLCollectionReferenceMapping)xmlMapping);
  }
}

Fixed version (ground truth):
private void initializeNodeValue(){
  XMLMapping xmlMapping=this.nestedMapping;
  if (xmlMapping instanceof XMLBinaryDataCollectionMapping) {
    choiceElementNodeValue=new XMLBinaryDataCollectionMappingNodeValue((XMLBinaryDataCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof XMLCompositeDirectCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((XMLCompositeDirectCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof XMLCompositeCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeCollectionMappingNodeValue((XMLCompositeCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else {
    choiceElementNodeValue=new XMLCollectionReferenceMappingNodeValue((XMLCollectionReferenceMapping)xmlMapping,xmlField);
    choiceElementMarshalNodeValue=new XMLCollectionReferenceMappingMarshalNodeValue((XMLCollectionReferenceMapping)xmlMapping);
  }
}
Program: 64701
Project: 64701
Buggy source:
public XMLChoiceCollectionMapping(){
  fieldToClassMappings=new HashMap<XMLField,Class>();
  fieldToClassNameMappings=new HashMap<XMLField,String>();
  classToFieldMappings=new HashMap<Class,XMLField>();
  classNameToFieldMappings=new HashMap<String,XMLField>();
  choiceElementMappings=new LinkedHashMap<XMLField,XMLMapping>();
  fieldsToConverters=new HashMap<XMLField,Converter>();
  this.containerPolicy=ContainerPolicy.buildDefaultPolicy();
}

Fixed version (ground truth):
public XMLChoiceCollectionMapping(){
  fieldToClassMappings=new HashMap<XMLField,Class>();
  fieldToClassNameMappings=new HashMap<XMLField,String>();
  classToFieldMappings=new HashMap<Class,XMLField>();
  classNameToFieldMappings=new HashMap<String,XMLField>();
  choiceElementMappings=new LinkedHashMap<XMLField,XMLMapping>();
  fieldsToConverters=new HashMap<XMLField,Converter>();
  choiceElementMappingsByClassName=new LinkedHashMap<String,XMLMapping>();
  choiceElementMappingsByClass=new LinkedHashMap<Class,XMLMapping>();
  this.containerPolicy=ContainerPolicy.buildDefaultPolicy();
}
Program: 64702
Project: 64702
Buggy source:
private void addChoiceElementMapping(XMLField xmlField,Class theClass){
  if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
    XMLCompositeDirectCollectionMapping xmlMapping=new XMLCompositeDirectCollectionMapping();
    xmlMapping.setAttributeElementClass(theClass);
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField,xmlMapping);
  }
 else {
    if (isBinaryType(theClass)) {
      XMLBinaryDataCollectionMapping xmlMapping=new XMLBinaryDataCollectionMapping();
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeElementClass(theClass);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.fieldsToConverters.put(xmlField,xmlMapping.getValueConverter());
      this.choiceElementMappings.put(xmlField,xmlMapping);
    }
 else {
      XMLCompositeCollectionMapping xmlMapping=new XMLCompositeCollectionMapping();
      if (!theClass.equals(ClassConstants.OBJECT)) {
        xmlMapping.setReferenceClass(theClass);
      }
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.choiceElementMappings.put(xmlField,xmlMapping);
    }
  }
}

Fixed version (ground truth):
private void addChoiceElementMapping(XMLField xmlField,Class theClass){
  if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
    XMLCompositeDirectCollectionMapping xmlMapping=new XMLCompositeDirectCollectionMapping();
    xmlMapping.setAttributeElementClass(theClass);
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField,xmlMapping);
    this.choiceElementMappingsByClass.put(theClass,xmlMapping);
  }
 else {
    if (isBinaryType(theClass)) {
      XMLBinaryDataCollectionMapping xmlMapping=new XMLBinaryDataCollectionMapping();
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeElementClass(theClass);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.fieldsToConverters.put(xmlField,xmlMapping.getValueConverter());
      this.choiceElementMappings.put(xmlField,xmlMapping);
      this.choiceElementMappingsByClass.put(theClass,xmlMapping);
    }
 else {
      XMLCompositeCollectionMapping xmlMapping=new XMLCompositeCollectionMapping();
      if (!theClass.equals(ClassConstants.OBJECT)) {
        xmlMapping.setReferenceClass(theClass);
      }
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.choiceElementMappings.put(xmlField,xmlMapping);
      this.choiceElementMappingsByClass.put(theClass,xmlMapping);
    }
  }
}
Program: 64704
Project: 64704
Buggy source:
public void preInitialize(AbstractSession session) throws DescriptorException {
  getAttributeAccessor().setIsWriteOnly(this.isWriteOnly());
  getAttributeAccessor().setIsReadOnly(this.isReadOnly());
  super.preInitialize(session);
  Iterator<XMLMapping> mappings=getChoiceElementMappings().values().iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setAttributeName(this.getAttributeName());
    if (nextMapping.getAttributeAccessor() == temporaryAccessor) {
      nextMapping.setAttributeAccessor(getAttributeAccessor());
    }
    nextMapping.setIsReadOnly(this.isReadOnly());
    ((XMLMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.preInitialize(session);
  }
}

Fixed version (ground truth):
public void preInitialize(AbstractSession session) throws DescriptorException {
  getAttributeAccessor().setIsWriteOnly(this.isWriteOnly());
  getAttributeAccessor().setIsReadOnly(this.isReadOnly());
  super.preInitialize(session);
  ArrayList<XMLMapping> mappingsList=new ArrayList<XMLMapping>();
  mappingsList.addAll(getChoiceElementMappings().values());
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  Iterator<XMLMapping> mappings=mappingsList.iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setAttributeName(this.getAttributeName());
    if (nextMapping.getAttributeAccessor() == temporaryAccessor) {
      nextMapping.setAttributeAccessor(getAttributeAccessor());
    }
    nextMapping.setIsReadOnly(this.isReadOnly());
    ((XMLMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.preInitialize(session);
  }
}
Program: 64707
Project: 64707
Buggy source:
public Object unmarshalEntity(Class type,MediaType acceptedMedia,InputStream in) throws JAXBException {
  Unmarshaller unmarshaller=getJAXBContext().createUnmarshaller();
  unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT,Boolean.FALSE);
  unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,acceptedMedia.toString());
  unmarshaller.setAdapter(new LinkAdapter(getBaseURI().toString(),this));
  unmarshaller.setEventHandler(new ValidationEventHandler(){
    @Override public boolean handleEvent(    ValidationEvent event){
      if (event.getSeverity() != ValidationEvent.WARNING) {
        return false;
      }
      return true;
    }
  }
);
  try {
    for (    XmlAdapter adapter : getAdapters()) {
      unmarshaller.setAdapter(adapter);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
  JAXBElement<?> element=unmarshaller.unmarshal(new StreamSource(in),type);
  if (element.getValue() instanceof List<?>) {
    for (    Object object : (List<?>)element.getValue()) {
      wrap(object);
    }
    return element.getValue();
  }
 else {
    wrap(element.getValue());
  }
  return element.getValue();
}

Fixed version (ground truth):
public Object unmarshalEntity(Class type,MediaType acceptedMedia,InputStream in) throws JAXBException {
  Unmarshaller unmarshaller=getJAXBContext().createUnmarshaller();
  unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT,Boolean.FALSE);
  unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,acceptedMedia.toString());
  unmarshaller.setAdapter(new LinkAdapter(getBaseURI().toString(),this));
  unmarshaller.setEventHandler(new ValidationEventHandler(){
    @Override public boolean handleEvent(    ValidationEvent event){
      if (event.getSeverity() != ValidationEvent.WARNING) {
        return false;
      }
      return true;
    }
  }
);
  for (  XmlAdapter adapter : getAdapters()) {
    unmarshaller.setAdapter(adapter);
  }
  JAXBElement<?> element=unmarshaller.unmarshal(new StreamSource(in),type);
  if (element.getValue() instanceof List<?>) {
    for (    Object object : (List<?>)element.getValue()) {
      wrap(object);
    }
    return element.getValue();
  }
 else {
    wrap(element.getValue());
  }
  return element.getValue();
}
Program: 64708
Project: 64708
Buggy source:
protected List<XmlAdapter> getAdapters() throws Exception {
  if (adapters == null) {
    adapters=new ArrayList<XmlAdapter>();
    for (    ClassDescriptor desc : this.getJpaSession().getDescriptors().values()) {
      if (!desc.isAggregateCollectionDescriptor() && !desc.isAggregateDescriptor()) {
        Class clz=desc.getJavaClass();
        String referenceAdapterName=clz.getName() + "String_Node_Str" + RestAdapterClassWriter.ADAPTER_INNER_CLASS_NAME;
        ClassLoader cl=getJpaSession().getDatasourcePlatform().getConversionManager().getLoader();
        Class referenceAdaptorClass=Class.forName(referenceAdapterName,true,cl);
        Class[] argTypes={String.class,PersistenceContext.class};
        Constructor referenceAdaptorConstructor=referenceAdaptorClass.getDeclaredConstructor(argTypes);
        Object[] args=new Object[]{getBaseURI().toString(),this};
        adapters.add((XmlAdapter)referenceAdaptorConstructor.newInstance(args));
      }
    }
  }
  return adapters;
}

Fixed version (ground truth):
protected List<XmlAdapter> getAdapters() throws JPARSException {
  if (adapters != null) {
    return adapters;
  }
  adapters=new ArrayList<XmlAdapter>();
  try {
    for (    ClassDescriptor desc : this.getJpaSession().getDescriptors().values()) {
      if (!desc.isAggregateCollectionDescriptor() && !desc.isAggregateDescriptor()) {
        Class clz=desc.getJavaClass();
        String referenceAdapterName=clz.getName() + "String_Node_Str" + RestAdapterClassWriter.ADAPTER_INNER_CLASS_NAME;
        ClassLoader cl=getJpaSession().getDatasourcePlatform().getConversionManager().getLoader();
        Class referenceAdaptorClass=Class.forName(referenceAdapterName,true,cl);
        Class[] argTypes={String.class,PersistenceContext.class};
        Constructor referenceAdaptorConstructor=referenceAdaptorClass.getDeclaredConstructor(argTypes);
        Object[] args=new Object[]{getBaseURI().toString(),this};
        adapters.add((XmlAdapter)referenceAdaptorConstructor.newInstance(args));
      }
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    throw new JPARSException(ex.getMessage());
  }
  return adapters;
}
Program: 64709
Project: 64709
Buggy source:
public static JAXBException missingPropertyInPropOrder(String fieldName){
  Object[] args={fieldName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,MISSING_PROPERTY_IN_PROP_ORDER,args));
  exception.setErrorCode(MISSING_PROPERTY_IN_PROP_ORDER);
  return exception;
}

Fixed version (ground truth):
public static JAXBException missingPropertyInPropOrder(String fieldName,String className){
  Object[] args={fieldName,className};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,MISSING_PROPERTY_IN_PROP_ORDER,args));
  exception.setErrorCode(MISSING_PROPERTY_IN_PROP_ORDER);
  return exception;
}