nus-yam/ex-repair huggingface dataset:
Program: 80149
Project: 80149
Buggy source:
public void close(){
synchronized (lock) {
    closeIn();
    parent=null;
    noMoreReads=true;
  }
}

Fixed version (ground truth):
/** 
 * Close the reader, disallowing further reads.
 */
public void close(){
synchronized (lock) {
    closeIn();
    parent=null;
    noMoreReads=true;
  }
}
Program: 80150
Project: 80150
Buggy source:
private final int readUnsignedShort() throws IOException {
  int ch1=in.read();
  int ch2=in.read();
  if ((ch1 | ch2) < 0)   throw new EOFException("String_Node_Str" + "String_Node_Str");
  return (ch1 << 8) + (ch2 << 0);
}

Fixed version (ground truth):
/** 
 * Decode the length encoded in the stream. This method came from   {@link java.io.DataInputStream}
 * @return The number of bytes in the stream, or <code>0</code> if thelength is unknown and the end of stream must be marked by the Derby-specific end of stream marker.
 */
private final int readUnsignedShort() throws IOException {
  int ch1=in.read();
  int ch2=in.read();
  if ((ch1 | ch2) < 0)   throw new EOFException("String_Node_Str" + "String_Node_Str");
  return (ch1 << 8) + (ch2 << 0);
}
Program: 80151
Project: 80151
Buggy source:
/** 
 * Removes the supplied LOCATOR entry from the hash map.
 * @param LOCATOR an integer that represents the locator that needs to beremoved from the hash map.
 * @throws SQLException.
 */
public static void CLOBRELEASELOCATOR(int LOCATOR) throws SQLException {
  Clob clob=(Clob)getEmbedConnection().getLOBMapping(LOCATOR);
  if (clob == null) {
    throw newSQLException(SQLState.LOB_LOCATOR_INVALID);
  }
  EmbedClob embedClob=(EmbedClob)clob;
  embedClob.free();
  getEmbedConnection().removeLOBMapping(LOCATOR);
}

Fixed version (ground truth):
/** 
 * Removes the supplied LOCATOR entry from the hash map.
 * @param LOCATOR an integer that represents the locator that needs to beremoved from the hash map.
 * @throws SQLException
 */
public static void CLOBRELEASELOCATOR(int LOCATOR) throws SQLException {
  Clob clob=(Clob)getEmbedConnection().getLOBMapping(LOCATOR);
  if (clob == null) {
    throw newSQLException(SQLState.LOB_LOCATOR_INVALID);
  }
  EmbedClob embedClob=(EmbedClob)clob;
  embedClob.free();
  getEmbedConnection().removeLOBMapping(LOCATOR);
}
Program: 80152
Project: 80152
Buggy source:
/** 
 * Returns the length in bytes of the Blob.
 * @param LOCATOR the locator value of the Blob whose length needs tobe found.
 * @return the length of the Blob object mapped to the locator .
 * @throws a SQLException.
 */
public static long BLOBGETLENGTH(int LOCATOR) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).length();
}

Fixed version (ground truth):
/** 
 * Returns the length in bytes of the Blob.
 * @param LOCATOR the locator value of the Blob whose length needs tobe found.
 * @return the length of the Blob object mapped to the locator .
 * @throws SQLException
 */
public static long BLOBGETLENGTH(int LOCATOR) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).length();
}
Program: 80153
Project: 80153
Buggy source:
/** 
 * Creates a new empty Clob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Clob.
 * @return an integer that maps to the Clob value created.
 * @throws a SQLException.
 */
public static int CLOBCREATELOCATOR() throws SQLException {
  Clob clob=getEmbedConnection().createClob();
  return getEmbedConnection().addLOBMapping(clob);
}

Fixed version (ground truth):
/** 
 * Creates a new empty Clob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Clob.
 * @return an integer that maps to the Clob value created.
 * @throws SQLException
 */
public static int CLOBCREATELOCATOR() throws SQLException {
  Clob clob=getEmbedConnection().createClob();
  return getEmbedConnection().addLOBMapping(clob);
}
Program: 80154
Project: 80154
Buggy source:
/** 
 * returns the length of the Clob corresponding to the LOCATOR value.
 * @param LOCATOR an integer that represents the locator of the Clob whoselength needs to be obtained.
 * @return an integer that represents the length of the Clob.
 */
public static long CLOBGETLENGTH(int LOCATOR) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).length();
}

Fixed version (ground truth):
/** 
 * returns the length of the Clob corresponding to the LOCATOR value.
 * @param LOCATOR an integer that represents the locator of the Clob whoselength needs to be obtained.
 * @return an integer that represents the length of the Clob.
 * @throws java.sql.SQLException 
 */
public static long CLOBGETLENGTH(int LOCATOR) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).length();
}
Program: 80155
Project: 80155
Buggy source:
/** 
 * Returns the first occurrence of locator in the Blob.
 * @param LOCATOR the locator value of the Blob in which the seaching needsto be done.
 * @param searchLocator the locator value of the Blob whose position needsneeds to be found.
 * @param pos the position from which the seaching needs to be done.
 * @return the position at which the first occurrence of the Blob isfound.
 * @throws a SQLException.
 */
public static long BLOBGETPOSITIONFROMLOCATOR(int LOCATOR,int searchLocator,long pos) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).position(getBlobObjectCorrespondingtoLOCATOR(searchLocator),pos);
}

Fixed version (ground truth):
/** 
 * Returns the first occurrence of locator in the Blob.
 * @param LOCATOR the locator value of the Blob in which the seaching needsto be done.
 * @param searchLocator the locator value of the Blob whose position needsneeds to be found.
 * @param pos the position from which the seaching needs to be done.
 * @return the position at which the first occurrence of the Blob isfound.
 * @throws SQLException
 */
public static long BLOBGETPOSITIONFROMLOCATOR(int LOCATOR,int searchLocator,long pos) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).position(getBlobObjectCorrespondingtoLOCATOR(searchLocator),pos);
}
Program: 80156
Project: 80156
Buggy source:
/** 
 * returns the first occurrence of the given search string from the given start search position inside the Clob.
 * @param LOCATOR an integer that represents the locator of the Clobin which the given position of the given sub-string needs to be found.
 * @param searchLiteral a String whose occurence inside the Clob needs tobe found starting from pos.
 * @param fromPosition an integer that represents the position insidethe Clob from which the search needs to begin.
 * @return an integer that represents the position inside the Clob of thefirst occurrence of the sub-string from the given starting position.
 * @throws an SQLException
 */
public static long CLOBGETPOSITIONFROMSTRING(int LOCATOR,String searchLiteral,long fromPosition) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).position(searchLiteral,fromPosition);
}

Fixed version (ground truth):
/** 
 * returns the first occurrence of the given search string from the given start search position inside the Clob.
 * @param LOCATOR an integer that represents the locator of the Clobin which the given position of the given sub-string needs to be found.
 * @param searchLiteral a String whose occurence inside the Clob needs tobe found starting from pos.
 * @param fromPosition an integer that represents the position insidethe Clob from which the search needs to begin.
 * @return an integer that represents the position inside the Clob of thefirst occurrence of the sub-string from the given starting position.
 * @throws SQLException
 */
public static long CLOBGETPOSITIONFROMSTRING(int LOCATOR,String searchLiteral,long fromPosition) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).position(searchLiteral,fromPosition);
}
Program: 80157
Project: 80157
Buggy source:
/** 
 * returns the Blob object corresponding to the locator.
 * @param LOCATOR an integer that represents the locator correspondingto the Blob object requested.
 * @return a Blob object that is mapped to the LOCATOR object passed in.
 * @throws a SQLException.
 */
private static Blob getBlobObjectCorrespondingtoLOCATOR(int LOCATOR) throws SQLException {
  Blob blob=(Blob)getEmbedConnection().getLOBMapping(LOCATOR);
  if (blob == null) {
    throw newSQLException(SQLState.LOB_LOCATOR_INVALID);
  }
  return blob;
}

Fixed version (ground truth):
/** 
 * returns the Blob object corresponding to the locator.
 * @param LOCATOR an integer that represents the locator correspondingto the Blob object requested.
 * @return a Blob object that is mapped to the LOCATOR object passed in.
 * @throws SQLException
 */
private static Blob getBlobObjectCorrespondingtoLOCATOR(int LOCATOR) throws SQLException {
  Blob blob=(Blob)getEmbedConnection().getLOBMapping(LOCATOR);
  if (blob == null) {
    throw newSQLException(SQLState.LOB_LOCATOR_INVALID);
  }
  return blob;
}
Program: 80158
Project: 80158
Buggy source:
/** 
 * truncates the Clob value represented by LOCATOR to have a length of length.
 * @param LOCATOR an integer that represents the LOCATOR used to retrieve aninstance of the LOB.
 * @param length an integer that represents the length to which the Clobmust be truncated to.
 * @throws a SQLException.
 */
public static void CLOBTRUNCATE(int LOCATOR,long length) throws SQLException {
  getClobObjectCorrespondingtoLOCATOR(LOCATOR).truncate(length);
}

Fixed version (ground truth):
/** 
 * truncates the Clob value represented by LOCATOR to have a length of length.
 * @param LOCATOR an integer that represents the LOCATOR used to retrieve aninstance of the LOB.
 * @param length an integer that represents the length to which the Clobmust be truncated to.
 * @throws SQLException
 */
public static void CLOBTRUNCATE(int LOCATOR,long length) throws SQLException {
  getClobObjectCorrespondingtoLOCATOR(LOCATOR).truncate(length);
}
Program: 80159
Project: 80159
Buggy source:
/** 
 * Creates a new empty Blob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Blob.
 * @return an integer that maps to the Blob value created.
 * @throws a SQLException.
 */
public static int BLOBCREATELOCATOR() throws SQLException {
  Blob blob=getEmbedConnection().createBlob();
  return getEmbedConnection().addLOBMapping(blob);
}

Fixed version (ground truth):
/** 
 * Creates a new empty Blob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Blob.
 * @return an integer that maps to the Blob value created.
 * @throws SQLException
 */
public static int BLOBCREATELOCATOR() throws SQLException {
  Blob blob=getEmbedConnection().createBlob();
  return getEmbedConnection().addLOBMapping(blob);
}
Program: 80160
Project: 80160
Buggy source:
/** 
 * replaces the characters starting at fromPosition and with length ForLength
 * @param LOCATOR an integer that represents the locator of the Clob in whichthe characters need to be replaced.
 * @param pos an integer that represents the position inside the Clob from whichthe string needs to be replaced.
 * @param length the number of characters from the string that need to be used forreplacement.
 * @param str the string from which the repalcement characters are built.
 * @throws an SQLException.
 */
public static void CLOBSETSTRING(int LOCATOR,long pos,int length,String str) throws SQLException {
  getClobObjectCorrespondingtoLOCATOR(LOCATOR).setString(pos,str,0,length);
}

Fixed version (ground truth):
/** 
 * replaces the characters starting at fromPosition and with length ForLength
 * @param LOCATOR an integer that represents the locator of the Clob in whichthe characters need to be replaced.
 * @param pos an integer that represents the position inside the Clob from whichthe string needs to be replaced.
 * @param length the number of characters from the string that need to be used forreplacement.
 * @param str the string from which the repalcement characters are built.
 * @throws SQLException
 */
public static void CLOBSETSTRING(int LOCATOR,long pos,int length,String str) throws SQLException {
  getClobObjectCorrespondingtoLOCATOR(LOCATOR).setString(pos,str,0,length);
}
Program: 80161
Project: 80161
Buggy source:
/** 
 * returns the first occurrence of the given search string from the given start search position inside the Clob.
 * @param LOCATOR an integer that represents the locator of the Clobin which the given position of the given sub-string needs to be found.
 * @param searchLocator a Locator representing a Clob whose occurence insidethe Clob needs to be found starting from pos.
 * @param fromPosition an integer that represents the position insidethe Clob from which the search needs to begin.
 * @return an integer that represents the position inside the Clob of thefirst occurrence of the sub-string from the given starting position.
 * @throws an SQLException
 */
public static long CLOBGETPOSITIONFROMLOCATOR(int LOCATOR,int searchLocator,long fromPosition) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).position(getClobObjectCorrespondingtoLOCATOR(searchLocator),fromPosition);
}

Fixed version (ground truth):
/** 
 * returns the first occurrence of the given search string from the given start search position inside the Clob.
 * @param LOCATOR an integer that represents the locator of the Clobin which the given position of the given sub-string needs to be found.
 * @param searchLocator a Locator representing a Clob whose occurence insidethe Clob needs to be found starting from pos.
 * @param fromPosition an integer that represents the position insidethe Clob from which the search needs to begin.
 * @return an integer that represents the position inside the Clob of thefirst occurrence of the sub-string from the given starting position.
 * @throws SQLException
 */
public static long CLOBGETPOSITIONFROMLOCATOR(int LOCATOR,int searchLocator,long fromPosition) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).position(getClobObjectCorrespondingtoLOCATOR(searchLocator),fromPosition);
}
Program: 80162
Project: 80162
Buggy source:
/** 
 * returns the String starting from pos and of len length from the LOB corresponding to LOCATOR.
 * @param LOCATOR an integer that represents the LOCATOR usedto retrieve an instance of the LOB.
 * @param pos a long that represents the position from whichthe substring begins.
 * @param len an integer that represents the length of the substring.
 * @return the substring conforming to the indexes we requested for frominside the LOB.
 * @throws a SQLException
 */
public static String CLOBGETSUBSTRING(int LOCATOR,long pos,int len) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).getSubString(pos,len);
}

Fixed version (ground truth):
/** 
 * returns the String starting from pos and of len length from the LOB corresponding to LOCATOR.
 * @param LOCATOR an integer that represents the LOCATOR usedto retrieve an instance of the LOB.
 * @param pos a long that represents the position from whichthe substring begins.
 * @param len an integer that represents the length of the substring.
 * @return the substring conforming to the indexes we requested for frominside the LOB.
 * @throws SQLException
 */
public static String CLOBGETSUBSTRING(int LOCATOR,long pos,int len) throws SQLException {
  return getClobObjectCorrespondingtoLOCATOR(LOCATOR).getSubString(pos,len);
}
Program: 80163
Project: 80163
Buggy source:
/** 
 * Replaces the bytes at pos with len bytes
 * @param LOCATOR the integer that represents the Blob in which the bytesneed to be replaced.
 * @param pos the position stating from which the byte replacement needs tohappen.
 * @param len the number of bytes that need to be used in replacement.
 * @param replaceBytes the byte array that contains the bytes that needs tobe used for replacement.
 * @throws a SQLException.
 */
public static void BLOBSETBYTES(int LOCATOR,long pos,int len,byte[] replaceBytes) throws SQLException {
  getBlobObjectCorrespondingtoLOCATOR(LOCATOR).setBytes(pos,replaceBytes,0,len);
}

Fixed version (ground truth):
/** 
 * Replaces the bytes at pos with len bytes
 * @param LOCATOR the integer that represents the Blob in which the bytesneed to be replaced.
 * @param pos the position stating from which the byte replacement needs tohappen.
 * @param len the number of bytes that need to be used in replacement.
 * @param replaceBytes the byte array that contains the bytes that needs tobe used for replacement.
 * @throws SQLException
 */
public static void BLOBSETBYTES(int LOCATOR,long pos,int len,byte[] replaceBytes) throws SQLException {
  getBlobObjectCorrespondingtoLOCATOR(LOCATOR).setBytes(pos,replaceBytes,0,len);
}
Program: 80164
Project: 80164
Buggy source:
/** 
 * Removes the supplied LOCATOR entry from the hash map.
 * @param LOCATOR an integer that represents the locator that needs to beremoved from the hash map.
 * @throws SQLException.
 */
public static void BLOBRELEASELOCATOR(int LOCATOR) throws SQLException {
  Blob blob=(Blob)getEmbedConnection().getLOBMapping(LOCATOR);
  if (blob == null) {
    throw newSQLException(SQLState.LOB_LOCATOR_INVALID);
  }
  EmbedBlob embedBlob=(EmbedBlob)blob;
  embedBlob.free();
  getEmbedConnection().removeLOBMapping(LOCATOR);
}

Fixed version (ground truth):
/** 
 * Removes the supplied LOCATOR entry from the hash map.
 * @param LOCATOR an integer that represents the locator that needs to beremoved from the hash map.
 * @throws SQLException
 */
public static void BLOBRELEASELOCATOR(int LOCATOR) throws SQLException {
  Blob blob=(Blob)getEmbedConnection().getLOBMapping(LOCATOR);
  if (blob == null) {
    throw newSQLException(SQLState.LOB_LOCATOR_INVALID);
  }
  EmbedBlob embedBlob=(EmbedBlob)blob;
  embedBlob.free();
  getEmbedConnection().removeLOBMapping(LOCATOR);
}
Program: 80165
Project: 80165
Buggy source:
/** 
 * Returns the first occurrence of the byte array in the Blob.
 * @param LOCATOR the locator value of the Blob in which the seaching needsto be done.
 * @param searchBytes the byte array whose position needs needs to be found.
 * @param pos the position from which the seaching needs to be done.
 * @return the position at which the first occurrence of the Byte array isfound.
 * @throws a SQLException.
 */
public static long BLOBGETPOSITIONFROMBYTES(int LOCATOR,byte[] searchBytes,long pos) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).position(searchBytes,pos);
}

Fixed version (ground truth):
/** 
 * Returns the first occurrence of the byte array in the Blob.
 * @param LOCATOR the locator value of the Blob in which the seaching needsto be done.
 * @param searchBytes the byte array whose position needs needs to be found.
 * @param pos the position from which the seaching needs to be done.
 * @return the position at which the first occurrence of the Byte array isfound.
 * @throws SQLException
 */
public static long BLOBGETPOSITIONFROMBYTES(int LOCATOR,byte[] searchBytes,long pos) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).position(searchBytes,pos);
}
Program: 80166
Project: 80166
Buggy source:
/** 
 * Returns the Byte array containing the bytes starting from pos and of length len
 * @param LOCATOR the locator value of the Blob from which the byte arrayneeds to be retrieved.
 * @param len the length of te byte array that needs to be retrieved frompos
 * @param pos the position from which the bytes from the Blob need to beretrieved.
 * @return a byte array containing the bytes stating from pos andof length len.
 * @throws a SQLException.
 */
public static byte[] BLOBGETBYTES(int LOCATOR,long pos,int len) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).getBytes(pos,len);
}

Fixed version (ground truth):
/** 
 * Returns the Byte array containing the bytes starting from pos and of length len
 * @param LOCATOR the locator value of the Blob from which the byte arrayneeds to be retrieved.
 * @param len the length of the byte array that needs to be retrieved frompos
 * @param pos the position from which the bytes from the Blob need to beretrieved.
 * @return a byte array containing the bytes stating from pos andof length len.
 * @throws SQLException
 */
public static byte[] BLOBGETBYTES(int LOCATOR,long pos,int len) throws SQLException {
  return getBlobObjectCorrespondingtoLOCATOR(LOCATOR).getBytes(pos,len);
}
Program: 80167
Project: 80167
Buggy source:
/** 
 * truncates the Blob value represented by LOCATOR to have a length of length.
 * @param LOCATOR an integer that represents the LOCATOR used to retrieve aninstance of the LOB.
 * @param length an integer that represents the length to which the Blobmust be truncated to.
 * @throws a SQLException.
 */
public static void BLOBTRUNCATE(int LOCATOR,long length) throws SQLException {
  getBlobObjectCorrespondingtoLOCATOR(LOCATOR).truncate(length);
}

Fixed version (ground truth):
/** 
 * truncates the Blob value represented by LOCATOR to have a length of length.
 * @param LOCATOR an integer that represents the LOCATOR used to retrieve aninstance of the LOB.
 * @param length an integer that represents the length to which the Blobmust be truncated to.
 * @throws SQLException
 */
public static void BLOBTRUNCATE(int LOCATOR,long length) throws SQLException {
  getBlobObjectCorrespondingtoLOCATOR(LOCATOR).truncate(length);
}
Program: 80168
Project: 80168
Buggy source:
/** 
 * Builds a list of columns suitable for creating this Catalog. The last column, the serialized statement, is not added to the column list.  This is done deliberately to make it a 'hidden' column -- one that is not visible to customers, but is visible to the system.
 * @return array of SystemColumn suitable for making this catalog.
 */
public SystemColumn[] buildColumnList(){
  return new SystemColumn[]{SystemColumnImpl.getUUIDColumn("String_Node_Str",false),SystemColumnImpl.getIdentifierColumn("String_Node_Str",false),SystemColumnImpl.getUUIDColumn("String_Node_Str",false),SystemColumnImpl.getIndicatorColumn("String_Node_Str"),SystemColumnImpl.getColumn("String_Node_Str",Types.BOOLEAN,false),SystemColumnImpl.getColumn("String_Node_Str",Types.LONGVARCHAR,false,TypeId.LONGVARCHAR_MAXWIDTH),SystemColumnImpl.getColumn("String_Node_Str",Types.TIMESTAMP,true),SystemColumnImpl.getUUIDColumn("String_Node_Str",false),SystemColumnImpl.getColumn("String_Node_Str",Types.LONGVARCHAR,false,TypeId.LONGVARCHAR_MAXWIDTH)};
}

Fixed version (ground truth):
/** 
 * Builds a list of columns suitable for creating this Catalog. The last column, the serialized statement, is not added to the column list.  This is done deliberately to make it a 'hidden' column -- one that is not visible to customers, but is visible to the system.
 * @return array of SystemColumn suitable for making this catalog.
 */
public SystemColumn[] buildColumnList(){
  return new SystemColumn[]{SystemColumnImpl.getUUIDColumn("String_Node_Str",false),SystemColumnImpl.getIdentifierColumn("String_Node_Str",false),SystemColumnImpl.getUUIDColumn("String_Node_Str",false),SystemColumnImpl.getIndicatorColumn("String_Node_Str"),SystemColumnImpl.getColumn("String_Node_Str",Types.BOOLEAN,false),SystemColumnImpl.getColumn("String_Node_Str",Types.LONGVARCHAR,false,TypeId.LONGVARCHAR_MAXWIDTH),SystemColumnImpl.getColumn("String_Node_Str",Types.TIMESTAMP,true),SystemColumnImpl.getUUIDColumn("String_Node_Str",true),SystemColumnImpl.getColumn("String_Node_Str",Types.LONGVARCHAR,true,TypeId.LONGVARCHAR_MAXWIDTH)};
}
Program: 80169
Project: 80169
Buggy source:
/** 
 * Return a suite that uses a single use database with a primary fixture from this test plus potentially other fixtures.
 * @param locale Locale to use for the database
 * @param baseFixture Base fixture from this test.
 * @return suite of tests to run for the given locale
 */
private static Test collatedSuite(String locale,String baseFixture){
  TestSuite suite=new TestSuite("String_Node_Str" + locale);
  suite.addTest(new CollationTest(baseFixture));
  suite.addTest(DatabaseMetaDataTest.suite());
  return Decorator.territoryCollatedDatabase(suite,locale);
}

Fixed version (ground truth):
/** 
 * Return a suite that uses a single use database with a primary fixture from this test plus potentially other fixtures.
 * @param locale Locale to use for the database
 * @param baseFixture Base fixture from this test.
 * @return suite of tests to run for the given locale
 */
private static Test collatedSuite(String locale,String baseFixture){
  TestSuite suite=new TestSuite("String_Node_Str" + locale);
  suite.addTest(new CollationTest(baseFixture));
  suite.addTest(DatabaseMetaDataTest.suite());
  suite.addTest(BatchUpdateTest.embeddedSuite());
  suite.addTest(GroupByExpressionTest.suite());
  suite.addTest(UpdatableResultSetTest.suite());
  return Decorator.territoryCollatedDatabase(suite,locale);
}
Program: 80170
Project: 80170
Buggy source:
/** 
 * Check the metatdata for a prepared statement that does not return a ResultSet is empty
 * @param conn connection to use
 * @param sql sql for prepared statement
 * @param execute execute PreparedStatement if true
 * @throws SQLException
 */
private void checkEmptyMetaData(String sql,boolean execute) throws SQLException {
  PreparedStatement ps=prepareStatement(sql);
  ResultSetMetaData rsmd=ps.getMetaData();
  assertEmptyResultSetMetaData(rsmd);
  if (execute)   ps.executeUpdate();
  ps.close();
}

Fixed version (ground truth):
/** 
 * Check the metatdata for a prepared statement that does not return a ResultSet is empty
 * @param sql sql for prepared statement
 * @param execute execute PreparedStatement if true
 * @throws SQLException
 */
private void checkEmptyMetaData(String sql,boolean execute) throws SQLException {
  PreparedStatement ps=prepareStatement(sql);
  ResultSetMetaData rsmd=ps.getMetaData();
  assertEmptyResultSetMetaData(rsmd);
  if (execute)   ps.executeUpdate();
  ps.close();
}
Program: 80171
Project: 80171
Buggy source:
/** 
 * Return a suite that uses a single use database with a primary fixture from this test plus potentially other fixtures.
 * @param locale Locale to use for the database
 * @param baseFixture Base fixture from this test.
 * @return
 */
private static Test collatedSuite(String locale,String baseFixture){
  TestSuite suite=new TestSuite("String_Node_Str" + locale);
  suite.addTest(new CollationTest(baseFixture));
  return Decorator.territoryCollatedDatabase(suite,locale);
}

Fixed version (ground truth):
/** 
 * Return a suite that uses a single use database with a primary fixture from this test plus potentially other fixtures.
 * @param locale Locale to use for the database
 * @param baseFixture Base fixture from this test.
 * @return suite of tests to run for the given locale
 */
private static Test collatedSuite(String locale,String baseFixture){
  TestSuite suite=new TestSuite("String_Node_Str" + locale);
  suite.addTest(new CollationTest(baseFixture));
  return Decorator.territoryCollatedDatabase(suite,locale);
}
Program: 80172
Project: 80172
Buggy source:
/** 
 * This function public for testing purposes.
 * @param trimType
 * @param trimChar
 * @param source
 * @return
 */
private String trimInternal(int trimType,char trimChar,String source){
  if (source == null) {
    return null;
  }
  int len=source.length();
  int start=0;
  if (trimType == LEADING || trimType == BOTH) {
    for (; start < len; start++)     if (trimChar != source.charAt(start))     break;
  }
  if (start == len)   return "String_Node_Str";
  int end=len - 1;
  if (trimType == TRAILING || trimType == BOTH) {
    for (; end >= 0; end--)     if (trimChar != source.charAt(end))     break;
  }
  if (end == -1)   return "String_Node_Str";
  return source.substring(start,end + 1);
}

Fixed version (ground truth):
/** 
 * This function public for testing purposes.
 * @param trimType  Type of trim (LEADING, TRAILING, or BOTH)
 * @param trimChar  Character to trim
 * @param source    String from which to trim trimChar
 * @return A String containing the result of the trim.
 */
private String trimInternal(int trimType,char trimChar,String source){
  if (source == null) {
    return null;
  }
  int len=source.length();
  int start=0;
  if (trimType == LEADING || trimType == BOTH) {
    for (; start < len; start++)     if (trimChar != source.charAt(start))     break;
  }
  if (start == len)   return "String_Node_Str";
  int end=len - 1;
  if (trimType == TRAILING || trimType == BOTH) {
    for (; end >= 0; end--)     if (trimChar != source.charAt(end))     break;
  }
  if (end == -1)   return "String_Node_Str";
  return source.substring(start,end + 1);
}
Program: 80173
Project: 80173
Buggy source:
/** 
 * @param trimType
 * @param trimChar
 * @param result
 * @return
 */
public StringDataValue ansiTrim(int trimType,StringDataValue trimChar,StringDataValue result) throws StandardException {
  if (result == null) {
    result=getNewVarchar();
  }
  if (trimChar == null || trimChar.getString() == null) {
    result.setToNull();
    return result;
  }
  if (trimChar.getString().length() != 1) {
    throw StandardException.newException(SQLState.LANG_INVALID_TRIM_CHARACTER,trimChar.getString());
  }
  char trimCharacter=trimChar.getString().charAt(0);
  result.setValue(trimInternal(trimType,trimCharacter,getString()));
  return result;
}

Fixed version (ground truth):
/** 
 * @param trimType  Type of trim (LEADING, TRAILING, or BOTH)
 * @param trimChar  Character to trim from this SQLChar (may be null)
 * @param result    The result of a previous call to this method,null if not called yet.
 * @return A StringDataValue containing the result of the trim.
 */
public StringDataValue ansiTrim(int trimType,StringDataValue trimChar,StringDataValue result) throws StandardException {
  if (result == null) {
    result=getNewVarchar();
  }
  if (trimChar == null || trimChar.getString() == null) {
    result.setToNull();
    return result;
  }
  if (trimChar.getString().length() != 1) {
    throw StandardException.newException(SQLState.LANG_INVALID_TRIM_CHARACTER,trimChar.getString());
  }
  char trimCharacter=trimChar.getString().charAt(0);
  result.setValue(trimInternal(trimType,trimCharacter,getString()));
  return result;
}
Program: 80174
Project: 80174
Buggy source:
public Object run() throws IOException {
  lobFile.delete();
  return null;
}

Fixed version (ground truth):
public Object run() throws IOException {
  sf.delete();
  return null;
}
Program: 80176
Project: 80176
Buggy source:
/** 
 * Invalidates all the variables and closes file handle if open.
 * @throws IOexception
 */
void free() throws IOException {
  dataBytes=null;
  if (tmpFile != null) {
    tmpFile.close();
    try {
      AccessController.doPrivileged(new PrivilegedExceptionAction(){
        public Object run() throws IOException {
          lobFile.delete();
          return null;
        }
      }
);
    }
 catch (    PrivilegedActionException pae) {
      Exception e=pae.getException();
      if (e instanceof IOException)       throw (IOException)e;
      if (e instanceof RuntimeException)       throw (RuntimeException)e;
      IOException ioe=new IOException(e.getMessage());
      ioe.initCause(e);
      throw ioe;
    }
  }
}

Fixed version (ground truth):
/** 
 * Invalidates all the variables and closes file handle if open.
 * @throws IOexception
 */
void free() throws IOException {
  dataBytes=null;
  if (tmpFile != null) {
    tmpFile.close();
    deleteFile(lobFile);
    tmpFile=null;
  }
}
Program: 80177
Project: 80177
Buggy source:
public int read(byte[] buf,int off,int length){
  if (remainingBlanks <= 0 && remainingNonBlanks <= 0) {
    return -1;
  }
  int nonBlankLength=Math.min((int)remainingNonBlanks,length);
  fillBuffer(nonBlankLength);
  int read=0;
  int bOff=alphabet.nextByteToRead(0);
  if (nonBlankLength <= (buffer.length - bOff)) {
    System.arraycopy(buffer,bOff,buf,off,nonBlankLength);
    remainingNonBlanks-=nonBlankLength;
    read=nonBlankLength;
    alphabet.nextByteToRead(nonBlankLength);
  }
 else {
    int toRead=0;
    while (remainingNonBlanks > 0 && read < nonBlankLength) {
      bOff=alphabet.nextByteToRead(toRead);
      toRead=Math.min(buffer.length - bOff,nonBlankLength - read);
      System.arraycopy(buffer,bOff,buf,off + read,toRead);
      remainingNonBlanks-=toRead;
      read+=toRead;
    }
    bOff=alphabet.nextByteToRead(toRead);
  }
  if (read < length && remainingBlanks > 0) {
    read+=fillBlanks(buf,off + read,length - read);
  }
  return read;
}

Fixed version (ground truth):
public int read(byte[] buf,int off,int length){
  if (remainingBlanks <= 0 && remainingNonBlanks <= 0) {
    return -1;
  }
  int nonBlankLength=(int)Math.min(remainingNonBlanks,(long)length);
  fillBuffer(nonBlankLength);
  int read=0;
  int bOff=alphabet.nextByteToRead(0);
  if (nonBlankLength <= (buffer.length - bOff)) {
    System.arraycopy(buffer,bOff,buf,off,nonBlankLength);
    remainingNonBlanks-=nonBlankLength;
    read=nonBlankLength;
    alphabet.nextByteToRead(nonBlankLength);
  }
 else {
    int toRead=0;
    while (remainingNonBlanks > 0 && read < nonBlankLength) {
      bOff=alphabet.nextByteToRead(toRead);
      toRead=Math.min(buffer.length - bOff,nonBlankLength - read);
      System.arraycopy(buffer,bOff,buf,off + read,toRead);
      remainingNonBlanks-=toRead;
      read+=toRead;
    }
    bOff=alphabet.nextByteToRead(toRead);
  }
  if (read < length && remainingBlanks > 0) {
    read+=fillBlanks(buf,off + read,length - read);
  }
  return read;
}
Program: 80178
Project: 80178
Buggy source:
/** 
 * Returns a writer to write data into the Clob. <p> The semantics of the writer is the same as for   {@link #setString}.
 * @param charPos the starting character position. The first character isat position <code>1</code>.
 * @return A writer initialized at the specified character position.
 * @throws IOException if writing to the Clob fails
 * @throws SQLException if accessing underlying resources fail
 * @throws UnsupportedOperationException if the Clob representation isread-only
 */
Writer getWriter(long pos) throws IOException, SQLException ;

Fixed version (ground truth):
/** 
 * Returns a writer to write data into the Clob. <p> The semantics of the writer is the same as for   {@link #insertString}.
 * @param charPos the starting character position. The first character isat position <code>1</code>.
 * @return A writer initialized at the specified character position.
 * @throws IOException if writing to the Clob fails
 * @throws SQLException if accessing underlying resources fail
 * @throws UnsupportedOperationException if the Clob representation isread-only
 */
Writer getWriter(long charPos) throws IOException, SQLException ;
Program: 80179
Project: 80179
Buggy source:
/** 
 * Test simple call to DatabaseMetaData.getColumns() <p> This test is the same form of the getColumns() call that  the IMPORT and EXPORT system procedures depend on.  Currently on ibm and sun 1.4.2 jvm's this test fails.
 */
private void runDERBY_2703(Connection conn,int db_index) throws SQLException {
  if (is142JVM())   return;
  setUpTable(conn);
  ResultSet rs=conn.getMetaData().getColumns(null,"String_Node_Str","String_Node_Str","String_Node_Str");
  SanityManager.DEBUG_PRINT("String_Node_Str","String_Node_Str");
  Assert.assertTrue("String_Node_Str",rs.next());
  if (verbose_debug)   System.out.println("String_Node_Str" + rs.getString(4));
  while (rs.next()) {
    if (verbose_debug)     System.out.println("String_Node_Str" + rs.getString(4));
  }
  rs.close();
  dropTable(conn);
}

Fixed version (ground truth):
/** 
 * Test simple call to DatabaseMetaData.getColumns() <p> This test is the same form of the getColumns() call that  the IMPORT and EXPORT system procedures depend on.  Currently on ibm and sun 1.4.2 jvm's this test fails.
 */
private void runDERBY_2703(Connection conn,int db_index) throws SQLException {
  if (is142JVM())   return;
  setUpTable(conn);
  ResultSet rs=conn.getMetaData().getColumns(null,"String_Node_Str","String_Node_Str","String_Node_Str");
  if (SanityManager.DEBUG) {
    SanityManager.DEBUG_PRINT("String_Node_Str","String_Node_Str");
  }
  Assert.assertTrue("String_Node_Str",rs.next());
  if (verbose_debug)   System.out.println("String_Node_Str" + rs.getString(4));
  while (rs.next()) {
    if (verbose_debug)     System.out.println("String_Node_Str" + rs.getString(4));
  }
  rs.close();
  dropTable(conn);
}
Program: 80180
Project: 80180
Buggy source:
/** 
 * Drops the given ConstraintDescriptor from the data dictionary. NOTE: Caller is responsible for dropping any backing index
 * @param table	The table from which to drop theconstraint descriptor
 * @param descriptor	The descriptor to drop
 * @param tc	The TransactionController.
 * @exception StandardException		Thrown on failure
 */
public void dropConstraintDescriptor(ConstraintDescriptor descriptor,TransactionController tc) throws StandardException ;

Fixed version (ground truth):
/** 
 * Drops the given ConstraintDescriptor from the data dictionary. NOTE: Caller is responsible for dropping any backing index
 * @param descriptor	The descriptor to drop
 * @param tc	The TransactionController.
 * @exception StandardException		Thrown on failure
 */
public void dropConstraintDescriptor(ConstraintDescriptor descriptor,TransactionController tc) throws StandardException ;
Program: 80181
Project: 80181
Buggy source:
/** 
 * @see TypeCompiler#generateDataValue(ExpressionClassBuilder,MethodBuilder,int,String,LocalField) 
 */
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  super.generateDataValue(eb,mb,collationType,field);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}

Fixed version (ground truth):
/** 
 * Augment the parent's method by ensuring the generated value is setup for collation if required.
 * @see BaseTypeCompiler#generateCollationSensitiveDataValue(ExpressionClassBuilder,MethodBuilder,int)
 */
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  super.generateDataValue(eb,mb,collationType,field);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}
Program: 80182
Project: 80182
Buggy source:
/** 
 * @see TypeCompiler#generateNull(ExpressionClassBuilder,MethodBuilder,int,String)
 */
public void generateNull(ExpressionClassBuilder eb,MethodBuilder mb,int collationType){
  super.generateNull(eb,mb,collationType);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}

Fixed version (ground truth):
/** 
 * Augment the parent's method by ensuring the generated value is setup for collation if required.
 * @see BaseTypeCompiler#generateCollationSensitiveDataValue(ExpressionClassBuilder,MethodBuilder,int)
 */
public void generateNull(ExpressionClassBuilder eb,MethodBuilder mb,int collationType){
  super.generateNull(eb,mb,collationType);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}
Program: 80183
Project: 80183
Buggy source:
/** 
 * @see TypeCompiler#generateDataValue(ExpressionClassBuilder,MethodBuilder,int,String,LocalField) 
 */
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  super.generateDataValue(eb,mb,collationType,field);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}

Fixed version (ground truth):
/** 
 * Augment the parent's method by ensuring the generated value is setup for collation if required.
 * @see BaseTypeCompiler#generateCollationSensitiveDataValue(ExpressionClassBuilder,MethodBuilder,int)
 */
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  super.generateDataValue(eb,mb,collationType,field);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}
Program: 80184
Project: 80184
Buggy source:
/** 
 * @see TypeCompiler#generateNull(ExpressionClassBuilder,MethodBuilder,int,String)
 */
public void generateNull(ExpressionClassBuilder eb,MethodBuilder mb,int collationType){
  super.generateNull(eb,mb,collationType);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}

Fixed version (ground truth):
/** 
 * Augment the parent's method by ensuring the generated value is setup for collation if required.
 * @see BaseTypeCompiler#generateCollationSensitiveDataValue(ExpressionClassBuilder,MethodBuilder,int)
 */
public void generateNull(ExpressionClassBuilder eb,MethodBuilder mb,int collationType){
  super.generateNull(eb,mb,collationType);
  generateCollationSensitiveDataValue(eb,mb,collationType);
}
Program: 80185
Project: 80185
Buggy source:
/** 
 * @see TypeCompiler#generateDataValue(ExpressionClassBuilder,MethodBuilder,int,String,LocalField) 
 */
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  if (!JVMInfo.J2ME && getTypeId().isDecimalTypeId()) {
    mb.upCast("String_Node_Str");
  }
  super.generateDataValue(eb,mb,collationType,field);
}

Fixed version (ground truth):
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  if (!JVMInfo.J2ME && getTypeId().isDecimalTypeId()) {
    mb.upCast("String_Node_Str");
  }
  super.generateDataValue(eb,mb,collationType,field);
}
Program: 80186
Project: 80186
Buggy source:
/** 
 * @see TypeCompiler#generateDataValue(ExpressionClassBuilder,MethodBuilder,int,String,LocalField) 
 */
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  mb.upCast("String_Node_Str");
  super.generateDataValue(eb,mb,collationType,field);
}

Fixed version (ground truth):
public void generateDataValue(ExpressionClassBuilder eb,MethodBuilder mb,int collationType,LocalField field){
  mb.upCast("String_Node_Str");
  super.generateDataValue(eb,mb,collationType,field);
}
Program: 80187
Project: 80187
Buggy source:
/** 
 * Gets the foreign key information for this constant action. A full list of foreign keys was compiled into this constant action.
 * @param ec	the ExecutionContext
 * @return	the list of foreign keys to enforce for this action
 */
final FKInfo[] getFKInfo(){
  return fkInfo;
}

Fixed version (ground truth):
/** 
 * Gets the foreign key information for this constant action. A full list of foreign keys was compiled into this constant action.
 * @return	the list of foreign keys to enforce for this action
 */
final FKInfo[] getFKInfo(){
  return fkInfo;
}
Program: 80188
Project: 80188
Buggy source:
ElementEnum(){
  try {
    scan=tc.openScan(rowConglomerateId,false,0,TransactionController.MODE_TABLE,TransactionController.ISOLATION_NOLOCK,(FormatableBitSet)null,(DataValueDescriptor[])null,0,(Qualifier[][])null,(DataValueDescriptor[])null,0);
    hasMore=scan.next();
    if (!hasMore) {
      scan.close();
      scan=null;
    }
  }
 catch (  StandardException se) {
    hasMore=false;
    if (scan != null) {
      try {
        scan.close();
      }
 catch (      StandardException se1) {
      }
      ;
      scan=null;
    }
  }
}

Fixed version (ground truth):
ElementEnum(){
  try {
    scan=tc.openScan(rowConglomerateId,keepAfterCommit,0,TransactionController.MODE_TABLE,TransactionController.ISOLATION_NOLOCK,(FormatableBitSet)null,(DataValueDescriptor[])null,0,(Qualifier[][])null,(DataValueDescriptor[])null,0);
    hasMore=scan.next();
    if (!hasMore) {
      scan.close();
      scan=null;
    }
 else     if (keepAfterCommit) {
      rowloc=rowConglomerate.newRowLocationTemplate();
      scan.fetchLocation(rowloc);
    }
  }
 catch (  StandardException se) {
    hasMore=false;
    if (scan != null) {
      try {
        scan.close();
      }
 catch (      StandardException se1) {
      }
      ;
      scan=null;
    }
  }
}
Program: 80190
Project: 80190
Buggy source:
public Object nextElement(){
  if (!hasMore)   throw new NoSuchElementException();
  try {
    scan.fetch(row);
    Object retValue=BackingStoreHashtable.shallowCloneRow(row);
    hasMore=scan.next();
    if (!hasMore) {
      scan.close();
      scan=null;
    }
    return retValue;
  }
 catch (  StandardException se) {
    if (scan != null) {
      try {
        scan.close();
      }
 catch (      StandardException se1) {
      }
      ;
      scan=null;
    }
    throw new NoSuchElementException();
  }
}

Fixed version (ground truth):
public Object nextElement(){
  if (!hasMore)   throw new NoSuchElementException();
  try {
    if (scan.isHeldAfterCommit()) {
      if (!scan.positionAtRowLocation(rowloc)) {
        throw StandardException.newException(SQLState.NO_CURRENT_ROW);
      }
    }
    scan.fetch(row);
    Object retValue=BackingStoreHashtable.shallowCloneRow(row);
    hasMore=scan.next();
    if (!hasMore) {
      scan.close();
      scan=null;
    }
 else     if (keepAfterCommit) {
      scan.fetchLocation(rowloc);
    }
    return retValue;
  }
 catch (  StandardException se) {
    if (scan != null) {
      try {
        scan.close();
      }
 catch (      StandardException se1) {
      }
      ;
      scan=null;
    }
    throw new NoSuchElementException();
  }
}
Program: 80194
Project: 80194
Buggy source:
/** 
 * Constructors for This class:
 */
public BackingStoreHashTableFromScan(TransactionController tc,long conglomId,int open_mode,int lock_level,int isolation_level,FormatableBitSet scanColumnList,DataValueDescriptor[] startKeyValue,int startSearchOperator,Qualifier qualifier[][],DataValueDescriptor[] stopKeyValue,int stopSearchOperator,long max_rowcnt,int[] key_column_numbers,boolean remove_duplicates,long estimated_rowcnt,long max_inmemory_rowcnt,int initialCapacity,float loadFactor,boolean collect_runtimestats,boolean skipNullKeyColumns) throws StandardException {
  super(tc,(RowSource)null,key_column_numbers,remove_duplicates,estimated_rowcnt,max_inmemory_rowcnt,initialCapacity,loadFactor,skipNullKeyColumns,false);
  open_scan=(ScanManager)tc.openScan(conglomId,false,open_mode,lock_level,isolation_level,scanColumnList,startKeyValue,startSearchOperator,qualifier,stopKeyValue,stopSearchOperator);
  open_scan.fetchSet(max_rowcnt,key_column_numbers,this);
  if (collect_runtimestats) {
    Properties prop=new Properties();
    open_scan.getScanInfo().getAllScanInfo(prop);
    this.setAuxillaryRuntimeStats(prop);
    prop=null;
  }
}

Fixed version (ground truth):
/** 
 * Constructors for This class:
 */
public BackingStoreHashTableFromScan(TransactionController tc,long conglomId,int open_mode,int lock_level,int isolation_level,FormatableBitSet scanColumnList,DataValueDescriptor[] startKeyValue,int startSearchOperator,Qualifier qualifier[][],DataValueDescriptor[] stopKeyValue,int stopSearchOperator,long max_rowcnt,int[] key_column_numbers,boolean remove_duplicates,long estimated_rowcnt,long max_inmemory_rowcnt,int initialCapacity,float loadFactor,boolean collect_runtimestats,boolean skipNullKeyColumns,boolean keepAfterCommit) throws StandardException {
  super(tc,(RowSource)null,key_column_numbers,remove_duplicates,estimated_rowcnt,max_inmemory_rowcnt,initialCapacity,loadFactor,skipNullKeyColumns,keepAfterCommit);
  open_scan=(ScanManager)tc.openScan(conglomId,false,open_mode,lock_level,isolation_level,scanColumnList,startKeyValue,startSearchOperator,qualifier,stopKeyValue,stopSearchOperator);
  open_scan.fetchSet(max_rowcnt,key_column_numbers,this);
  if (collect_runtimestats) {
    Properties prop=new Properties();
    open_scan.getScanInfo().getAllScanInfo(prop);
    this.setAuxillaryRuntimeStats(prop);
    prop=null;
  }
}