nus-yam/ex-repair huggingface dataset:
Program: 63208
Project: 63208
Buggy source:
@SuppressWarnings("String_Node_Str") protected <T>T serialClone(T o){
  try {
    ObjectInputStream ois=new ObjectInputStream(new ByteArrayInputStream(serialBytes(o)));
    T clone=(T)ois.readObject();
    if (o == clone)     assertImmutable(o);
    assertSame(o.getClass(),clone.getClass());
    return clone;
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
    return null;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected <T>T serialClone(T o){
  T clone=null;
  try {
    ObjectInputStream ois=new ObjectInputStream(new ByteArrayInputStream(serialBytes(o)));
    clone=(T)ois.readObject();
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
  if (o == clone)   assertImmutable(o);
 else   assertSame(o.getClass(),clone.getClass());
  return clone;
}
Program: 63209
Project: 63209
Buggy source:
/** 
 * A version of serialClone that leaves error handling (for e.g. NotSerializableException) up to the caller.
 */
@SuppressWarnings("String_Node_Str") <T>T serialClonePossiblyFailing(T o) throws Exception {
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  ObjectOutputStream oos=new ObjectOutputStream(bos);
  oos.writeObject(o);
  oos.flush();
  oos.close();
  ObjectInputStream ois=new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
  T clone=(T)ois.readObject();
  if (o == clone)   assertImmutable(o);
  assertSame(o.getClass(),clone.getClass());
  return clone;
}

Fixed version (ground truth):
/** 
 * A version of serialClone that leaves error handling (for e.g. NotSerializableException) up to the caller.
 */
@SuppressWarnings("String_Node_Str") <T>T serialClonePossiblyFailing(T o) throws Exception {
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  ObjectOutputStream oos=new ObjectOutputStream(bos);
  oos.writeObject(o);
  oos.flush();
  oos.close();
  ObjectInputStream ois=new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
  T clone=(T)ois.readObject();
  if (o == clone)   assertImmutable(o);
 else   assertSame(o.getClass(),clone.getClass());
  return clone;
}
Program: 63210
Project: 63210
Buggy source:
/** 
 * Tests scenario for JDK-8187947: A race condition in SubmissionPublisher cvs update -D '2017-11-25' src/main/java/util/concurrent/SubmissionPublisher.java && ant -Djsr166.expensiveTests=true -Djsr166.tckTestClass=SubmissionPublisherTest -Djsr166.methodFilter=testMissedSignal tck; cvs update -A src/main/java/util/concurrent/SubmissionPublisher.java
 */
public void testMissedSignal_8187947() throws Exception {
  final int N=expensiveTests ? (1 << 20) : (1 << 10);
  final CountDownLatch finished=new CountDownLatch(1);
  final SubmissionPublisher<Boolean> pub=new SubmissionPublisher<>();
class Sub implements Subscriber<Boolean> {
    int received;
    public void onSubscribe(    Subscription s){
      s.request(N);
    }
    public void onNext(    Boolean item){
      if (++received == N)       finished.countDown();
 else       CompletableFuture.runAsync(() -> pub.submit(Boolean.TRUE));
    }
    public void onError(    Throwable t){
      throw new AssertionError(t);
    }
    public void onComplete(){
    }
  }
  pub.subscribe(new Sub());
  CompletableFuture.runAsync(() -> pub.submit(Boolean.TRUE));
  await(finished);
}

Fixed version (ground truth):
/** 
 * Tests scenario for JDK-8187947: A race condition in SubmissionPublisher cvs update -D '2017-11-25' src/main/java/util/concurrent/SubmissionPublisher.java && ant -Djsr166.expensiveTests=true -Djsr166.tckTestClass=SubmissionPublisherTest -Djsr166.methodFilter=testMissedSignal tck; cvs update -A src/main/java/util/concurrent/SubmissionPublisher.java
 */
public void testMissedSignal_8187947() throws Exception {
  final int N=expensiveTests ? (1 << 20) : (1 << 10);
  final CountDownLatch finished=new CountDownLatch(1);
  final SubmissionPublisher<Boolean> pub=new SubmissionPublisher<>();
class Sub implements Subscriber<Boolean> {
    int received;
    public void onSubscribe(    Subscription s){
      s.request(N);
    }
    public void onNext(    Boolean item){
      if (++received == N)       finished.countDown();
 else       CompletableFuture.runAsync(() -> pub.submit(Boolean.TRUE));
    }
    public void onError(    Throwable t){
      throw new AssertionError(t);
    }
    public void onComplete(){
    }
  }
  pub.subscribe(new Sub());
  checkTimedGet(CompletableFuture.runAsync(() -> pub.submit(Boolean.TRUE)),null);
  await(finished);
}
Program: 63211
Project: 63211
Buggy source:
<T>void checkCompletedNormally(ForkJoinTask<T> a,T expected){
  assertTrue(a.isDone());
  assertFalse(a.isCancelled());
  assertTrue(a.isCompletedNormally());
  assertFalse(a.isCompletedAbnormally());
  assertNull(a.getException());
  assertSame(expected,a.getRawResult());
{
    Thread.currentThread().interrupt();
    long startTime=System.nanoTime();
    assertSame(expected,a.join());
    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
    Thread.interrupted();
  }
{
    Thread.currentThread().interrupt();
    long startTime=System.nanoTime();
    a.quietlyJoin();
    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
    Thread.interrupted();
  }
  assertFalse(a.cancel(false));
  assertFalse(a.cancel(true));
  try {
    assertSame(expected,a.get());
    assertSame(expected,a.get(randomTimeout(),randomTimeUnit()));
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
}

Fixed version (ground truth):
<T>void checkCompletedNormally(ForkJoinTask<T> a,T expectedValue){
  assertTrue(a.isDone());
  assertFalse(a.isCancelled());
  assertTrue(a.isCompletedNormally());
  assertFalse(a.isCompletedAbnormally());
  assertNull(a.getException());
  assertSame(expectedValue,a.getRawResult());
{
    Thread.currentThread().interrupt();
    long startTime=System.nanoTime();
    assertSame(expectedValue,a.join());
    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
    Thread.interrupted();
  }
{
    Thread.currentThread().interrupt();
    long startTime=System.nanoTime();
    a.quietlyJoin();
    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
    Thread.interrupted();
  }
  assertFalse(a.cancel(false));
  assertFalse(a.cancel(true));
  T v1=null, v2=null;
  try {
    v1=a.get();
    v2=a.get(randomTimeout(),randomTimeUnit());
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
  assertSame(expectedValue,v1);
  assertSame(expectedValue,v2);
}
Program: 63212
Project: 63212
Buggy source:
/** 
 * Waits for the task to complete, and checks that when it does, it will have an Integer result equals to the given int.
 */
void checkCompletesNormally(RecursiveTask<Integer> a,int expected){
  Integer r=a.join();
  assertEquals(expected,(int)r);
  checkCompletedNormally(a,r);
}

Fixed version (ground truth):
/** 
 * Waits for the task to complete, and checks that when it does, it will have an Integer result equals to the given int.
 */
void checkCompletesNormally(RecursiveTask<Integer> a,int expectedValue){
  Integer r=a.join();
  assertEquals(expectedValue,(int)r);
  checkCompletedNormally(a,r);
}
Program: 63213
Project: 63213
Buggy source:
/** 
 * Like checkCompletesNormally, but verifies that the task has already completed.
 */
void checkCompletedNormally(RecursiveTask<Integer> a,int expected){
  Integer r=a.getRawResult();
  assertEquals(expected,(int)r);
  checkCompletedNormally(a,r);
}

Fixed version (ground truth):
/** 
 * Like checkCompletesNormally, but verifies that the task has already completed.
 */
void checkCompletedNormally(RecursiveTask<Integer> a,int expectedValue){
  Integer r=a.getRawResult();
  assertEquals(expectedValue,(int)r);
  checkCompletedNormally(a,r);
}
Program: 63214
Project: 63214
Buggy source:
void checkCompletedNormally(ForkJoinTask<?> a){
  assertTrue(a.isDone());
  assertFalse(a.isCancelled());
  assertTrue(a.isCompletedNormally());
  assertFalse(a.isCompletedAbnormally());
  assertNull(a.getException());
  assertNull(a.getRawResult());
  assertNull(a.join());
  assertFalse(a.cancel(false));
  assertFalse(a.cancel(true));
  try {
    assertNull(a.get());
    assertNull(a.get(randomTimeout(),randomTimeUnit()));
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
}

Fixed version (ground truth):
void checkCompletedNormally(ForkJoinTask<?> a){
  assertTrue(a.isDone());
  assertFalse(a.isCancelled());
  assertTrue(a.isCompletedNormally());
  assertFalse(a.isCompletedAbnormally());
  assertNull(a.getException());
  assertNull(a.getRawResult());
  assertNull(a.join());
  assertFalse(a.cancel(false));
  assertFalse(a.cancel(true));
  Object v1=null, v2=null;
  try {
    v1=a.get();
    v2=a.get(randomTimeout(),randomTimeUnit());
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
  assertNull(v1);
  assertNull(v2);
}
Program: 63215
Project: 63215
Buggy source:
void checkCompletedNormally(RecursiveAction a){
  assertTrue(a.isDone());
  assertFalse(a.isCancelled());
  assertTrue(a.isCompletedNormally());
  assertFalse(a.isCompletedAbnormally());
  assertNull(a.getException());
  assertNull(a.getRawResult());
  assertNull(a.join());
  assertFalse(a.cancel(false));
  assertFalse(a.cancel(true));
  try {
    assertNull(a.get());
    assertNull(a.get(randomTimeout(),randomTimeUnit()));
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
}

Fixed version (ground truth):
void checkCompletedNormally(RecursiveAction a){
  assertTrue(a.isDone());
  assertFalse(a.isCancelled());
  assertTrue(a.isCompletedNormally());
  assertFalse(a.isCompletedAbnormally());
  assertNull(a.getException());
  assertNull(a.getRawResult());
  assertNull(a.join());
  assertFalse(a.cancel(false));
  assertFalse(a.cancel(true));
  Object v1=null, v2=null;
  try {
    v1=a.get();
    v2=a.get(randomTimeout(),randomTimeUnit());
  }
 catch (  Throwable fail) {
    threadUnexpectedException(fail);
  }
  assertNull(v1);
  assertNull(v2);
}
Program: 63216
Project: 63216
Buggy source:
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,MAX_SIZE)) {
    double[] array=new double[size];
    double[] degenerateTreeArray=new double[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Double>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Spliterators.iterator(J8Arrays.spliterator(array))));
    }
    nodes.add(tree(toList(array),l -> Nodes.node(toDoubleArray(l))));
    nodes.add(fill(array,Nodes.doubleBuilder(array.length)));
    nodes.add(fill(array,Nodes.doubleBuilder()));
    for (    Node<Double> node : nodes) {
      params.add(new Object[]{array,node});
    }
  }
  return params.toArray(new Object[0][]);
}

Fixed version (ground truth):
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,1000,MAX_SIZE)) {
    double[] array=new double[size];
    double[] degenerateTreeArray=new double[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Double>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Spliterators.iterator(J8Arrays.spliterator(array))));
    }
    nodes.add(tree(toList(array),l -> Nodes.node(toDoubleArray(l))));
    nodes.add(fill(array,Nodes.doubleBuilder(array.length)));
    nodes.add(fill(array,Nodes.doubleBuilder()));
    for (    Node<Double> node : nodes) {
      params.add(new Object[]{array,node});
    }
  }
  return params.toArray(new Object[0][]);
}
Program: 63217
Project: 63217
Buggy source:
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,MAX_SIZE)) {
    int[] array=new int[size];
    int[] degenerateTreeArray=new int[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Integer>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Spliterators.iterator(J8Arrays.spliterator(array))));
    }
    nodes.add(tree(toList(array),l -> Nodes.node(toIntArray(l))));
    nodes.add(fill(array,Nodes.intBuilder(array.length)));
    nodes.add(fill(array,Nodes.intBuilder()));
    for (    Node<Integer> node : nodes) {
      params.add(new Object[]{array,node});
    }
  }
  return params.toArray(new Object[0][]);
}

Fixed version (ground truth):
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,1000,MAX_SIZE)) {
    int[] array=new int[size];
    int[] degenerateTreeArray=new int[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Integer>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Spliterators.iterator(J8Arrays.spliterator(array))));
    }
    nodes.add(tree(toList(array),l -> Nodes.node(toIntArray(l))));
    nodes.add(fill(array,Nodes.intBuilder(array.length)));
    nodes.add(fill(array,Nodes.intBuilder()));
    for (    Node<Integer> node : nodes) {
      params.add(new Object[]{array,node});
    }
  }
  return params.toArray(new Object[0][]);
}
Program: 63218
Project: 63218
Buggy source:
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,MAX_SIZE)) {
    long[] array=new long[size];
    long[] degenerateTreeArray=new long[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Long>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Spliterators.iterator(J8Arrays.spliterator(array))));
    }
    nodes.add(tree(toList(array),l -> Nodes.node(toLongArray(l))));
    nodes.add(fill(array,Nodes.longBuilder(array.length)));
    nodes.add(fill(array,Nodes.longBuilder()));
    for (    Node<Long> node : nodes) {
      params.add(new Object[]{array,node});
    }
  }
  return params.toArray(new Object[0][]);
}

Fixed version (ground truth):
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,1000,MAX_SIZE)) {
    long[] array=new long[size];
    long[] degenerateTreeArray=new long[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Long>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Spliterators.iterator(J8Arrays.spliterator(array))));
    }
    nodes.add(tree(toList(array),l -> Nodes.node(toLongArray(l))));
    nodes.add(fill(array,Nodes.longBuilder(array.length)));
    nodes.add(fill(array,Nodes.longBuilder()));
    for (    Node<Long> node : nodes) {
      params.add(new Object[]{array,node});
    }
  }
  return params.toArray(new Object[0][]);
}
Program: 63219
Project: 63219
Buggy source:
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,MAX_SIZE)) {
    Integer[] array=new Integer[size];
    Integer[] degenerateTreeArray=new Integer[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Integer>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    nodes.add(Nodes.node(Arrays.asList(array)));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Arrays.asList(array).iterator()));
    }
    nodes.add(tree(Arrays.asList(array),l -> Nodes.node(l.toArray(new Integer[l.size()]))));
    nodes.add(tree(Arrays.asList(array),l -> Nodes.node(l)));
    nodes.add(fill(array,Nodes.builder(array.length,LambdaTestHelpers.integerArrayGenerator)));
    nodes.add(fill(array,Nodes.builder()));
    for (int i=0; i < nodes.size(); i++) {
      params.add(new Object[]{array,nodes.get(i)});
    }
  }
  return params.toArray(new Object[0][]);
}

Fixed version (ground truth):
@DataProvider(name="String_Node_Str") public Object[][] createSizes(){
  List<Object[]> params=new ArrayList<>();
  for (  int size : Arrays.asList(0,1,4,15,16,17,127,128,129,1000,MAX_SIZE)) {
    Integer[] array=new Integer[size];
    Integer[] degenerateTreeArray=new Integer[size];
    for (int i=0; i < array.length; i++) {
      array[i]=i;
    }
    if (size < MAX_SIZE) {
      for (int i=0; i < degenerateTreeArray.length; i++) {
        degenerateTreeArray[i]=i;
      }
    }
    List<Node<Integer>> nodes=new ArrayList<>();
    nodes.add(Nodes.node(array));
    nodes.add(Nodes.node(Arrays.asList(array)));
    if (size < MAX_SIZE) {
      nodes.add(degenerateTree(Arrays.asList(array).iterator()));
    }
    nodes.add(tree(Arrays.asList(array),l -> Nodes.node(l.toArray(new Integer[l.size()]))));
    nodes.add(tree(Arrays.asList(array),l -> Nodes.node(l)));
    nodes.add(fill(array,Nodes.builder(array.length,LambdaTestHelpers.integerArrayGenerator)));
    nodes.add(fill(array,Nodes.builder()));
    for (int i=0; i < nodes.size(); i++) {
      params.add(new Object[]{array,nodes.get(i)});
    }
  }
  return params.toArray(new Object[0][]);
}
Program: 63220
Project: 63220
Buggy source:
private Object newInstanceFromSystemProperty(String property) throws Exception {
  String className=System.getProperty(property);
  return (className == null) ? null : ClassLoader.getSystemClassLoader().loadClass(className).getConstructor().newInstance();
}

Fixed version (ground truth):
private static Object newInstanceFromSystemProperty(String property) throws Exception {
  String className=System.getProperty(property);
  return (className == null) ? null : ClassLoader.getSystemClassLoader().loadClass(className).getConstructor().newInstance();
}
Program: 63221
Project: 63221
Buggy source:
private <T,U,E,S extends BaseStream<E,S>,D extends TestData<E,S>>void assertSecondFails(D data,Function<S,T> first,Function<S,U> second,Class<? extends Throwable> exception,String text){
  S stream=data.stream();
  @SuppressWarnings("String_Node_Str") T fr=first.apply(stream);
  try {
    @SuppressWarnings("String_Node_Str") U sr=second.apply(stream);
    fail(text + "String_Node_Str");
  }
 catch (  Throwable e) {
    if (exception.isAssignableFrom(e.getClass())) {
    }
 else     if (e instanceof Error)     throw (Error)e;
 else     if (e instanceof RuntimeException)     throw (RuntimeException)e;
 else     throw new AssertionError("String_Node_Str" + e.getClass(),e);
  }
  stream=data.parallelStream();
  fr=first.apply(stream);
  try {
    @SuppressWarnings("String_Node_Str") U sr=second.apply(stream);
    fail(text + "String_Node_Str");
  }
 catch (  Throwable e) {
    if (exception.isAssignableFrom(e.getClass())) {
    }
 else     if (e instanceof Error)     throw (Error)e;
 else     if (e instanceof RuntimeException)     throw (RuntimeException)e;
 else     throw new AssertionError("String_Node_Str" + e.getClass(),e);
  }
}

Fixed version (ground truth):
private <T,U,E,S extends BaseStream<E,S>,D extends TestData<E,S>>void assertSecondFails(D data,Function<S,T> first,Function<S,U> second,Class<? extends Throwable> exception,String text){
  S stream=data.stream();
  @SuppressWarnings("String_Node_Str") T fr=first.apply(stream);
  try {
    @SuppressWarnings("String_Node_Str") U sr=second.apply(stream);
    fail(text + "String_Node_Str");
  }
 catch (  Throwable e) {
    if (exception.isAssignableFrom(e.getClass())) {
    }
 else     if (e instanceof Error) {
      throw (Error)e;
    }
 else     if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
 else {
      AssertionError ae=new AssertionError("String_Node_Str" + e.getClass());
      ae.initCause(e);
      throw ae;
    }
  }
  stream=data.parallelStream();
  fr=first.apply(stream);
  try {
    @SuppressWarnings("String_Node_Str") U sr=second.apply(stream);
    fail(text + "String_Node_Str");
  }
 catch (  Throwable e) {
    if (exception.isAssignableFrom(e.getClass())) {
    }
 else     if (e instanceof Error) {
      throw (Error)e;
    }
 else     if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
 else {
      AssertionError ae=new AssertionError("String_Node_Str" + e.getClass());
      ae.initCause(e);
      throw ae;
    }
  }
}
Program: 63222
Project: 63222
Buggy source:
static void assertArraysEqual(String[] actual,String[] expected){
  try {
    assertEquals(actual,expected,"String_Node_Str");
  }
 catch (  AssertionError x) {
    throw new AssertionError(String.format("String_Node_Str",java.util.Arrays.toString(expected),java.util.Arrays.toString(actual)),x);
  }
}

Fixed version (ground truth):
static void assertArraysEqual(String[] actual,String[] expected){
  try {
    assertEquals(actual,expected,"String_Node_Str");
  }
 catch (  AssertionError x) {
    AssertionError ae=new AssertionError(String.format("String_Node_Str",java.util.Arrays.toString(expected),java.util.Arrays.toString(actual)));
    ae.initCause(x);
    throw ae;
  }
}
Program: 63223
Project: 63223
Buggy source:
static String getDelegateeImplementationName(Spliterator<?> spliterator){
  try {
    if (spliterator == null || !"String_Node_Str".equals(spliterator.getClass().getName())) {
      return null;
    }
    return (String)GET_IMPL_NAME.invoke(spliterator);
  }
 catch (  Exception e) {
    throw new Error(e);
  }
}

Fixed version (ground truth):
static String getDelegateeImplementationName(Spliterator<?> spliterator){
  try {
    if (spliterator == null || GET_IMPL_NAME == null || !"String_Node_Str".equals(spliterator.getClass().getName())) {
      return null;
    }
    return (String)GET_IMPL_NAME.invoke(spliterator);
  }
 catch (  Exception e) {
    throw new Error(e);
  }
}
Program: 63224
Project: 63224
Buggy source:
static Method getDelegateeAccessMethod(){
  Method getImplName=null;
  try {
    Class<?> clazz=Class.forName("String_Node_Str");
    getImplName=clazz.getDeclaredMethod("String_Node_Str");
    getImplName.setAccessible(true);
  }
 catch (  Exception e) {
  }
  return getImplName;
}

Fixed version (ground truth):
static Method getDelegateeAccessMethod(){
  Method getImplName=null;
  try {
    Class<?> clazz=Class.forName("String_Node_Str");
    getImplName=clazz.getDeclaredMethod("String_Node_Str");
    getImplName.setAccessible(true);
  }
 catch (  Throwable ignore) {
  }
  return getImplName;
}
Program: 63225
Project: 63225
Buggy source:
/** 
 * CountedCompleter class javadoc code sample, version 3. 
 */
public static <E>void forEach3(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent);
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      int n=hi - lo;
      for (; n >= 2; n/=2) {
        addToPendingCount(1);
        new Task(this,lo + n / 2,lo + n).fork();
      }
      if (n > 0)       action.accept(array[lo]);
      propagateCompletion();
    }
  }
  new Task(null,0,array.length).invoke();
}

Fixed version (ground truth):
/** 
 * CountedCompleter class javadoc code sample, version 3. 
 */
private static <E>void forEach3(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent);
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      int n=hi - lo;
      for (; n >= 2; n/=2) {
        addToPendingCount(1);
        new Task(this,lo + n / 2,lo + n).fork();
      }
      if (n > 0)       action.accept(array[lo]);
      propagateCompletion();
    }
  }
  new Task(null,0,array.length).invoke();
}
Program: 63226
Project: 63226
Buggy source:
/** 
 * CountedCompleter class javadoc code sample, version 2. 
 */
public static <E>void forEach2(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent);
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      if (hi - lo >= 2) {
        int mid=(lo + hi) >>> 1;
        setPendingCount(1);
        new Task(this,mid,hi).fork();
        new Task(this,lo,mid).compute();
      }
 else {
        if (hi > lo)         action.accept(array[lo]);
        tryComplete();
      }
    }
  }
  new Task(null,0,array.length).invoke();
}

Fixed version (ground truth):
/** 
 * CountedCompleter class javadoc code sample, version 2. 
 */
private static <E>void forEach2(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent);
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      if (hi - lo >= 2) {
        int mid=(lo + hi) >>> 1;
        setPendingCount(1);
        new Task(this,mid,hi).fork();
        new Task(this,lo,mid).compute();
      }
 else {
        if (hi > lo)         action.accept(array[lo]);
        tryComplete();
      }
    }
  }
  new Task(null,0,array.length).invoke();
}
Program: 63227
Project: 63227
Buggy source:
/** 
 * CountedCompleter class javadoc code sample, version 4. 
 */
public static <E>void forEach4(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent,31 - Integer.numberOfLeadingZeros(hi - lo));
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      for (int n=hi - lo; n >= 2; n/=2)       new Task(this,lo + n / 2,lo + n).fork();
      action.accept(array[lo]);
      propagateCompletion();
    }
  }
  if (array.length > 0)   new Task(null,0,array.length).invoke();
}

Fixed version (ground truth):
/** 
 * CountedCompleter class javadoc code sample, version 4. 
 */
private static <E>void forEach4(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent,31 - Integer.numberOfLeadingZeros(hi - lo));
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      for (int n=hi - lo; n >= 2; n/=2)       new Task(this,lo + n / 2,lo + n).fork();
      action.accept(array[lo]);
      propagateCompletion();
    }
  }
  if (array.length > 0)   new Task(null,0,array.length).invoke();
}
Program: 63228
Project: 63228
Buggy source:
/** 
 * CountedCompleter class javadoc code sample, version 1. 
 */
public static <E>void forEach1(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent);
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      if (hi - lo >= 2) {
        int mid=(lo + hi) >>> 1;
        setPendingCount(2);
        new Task(this,mid,hi).fork();
        new Task(this,lo,mid).fork();
      }
 else       if (hi > lo)       action.accept(array[lo]);
      tryComplete();
    }
  }
  new Task(null,0,array.length).invoke();
}

Fixed version (ground truth):
/** 
 * CountedCompleter class javadoc code sample, version 1. 
 */
private static <E>void forEach1(E[] array,Consumer<E> action){
@SuppressWarnings("String_Node_Str") class Task extends CountedCompleter<Void> {
    final int lo, hi;
    Task(    Task parent,    int lo,    int hi){
      super(parent);
      this.lo=lo;
      this.hi=hi;
    }
    public void compute(){
      if (hi - lo >= 2) {
        int mid=(lo + hi) >>> 1;
        setPendingCount(2);
        new Task(this,mid,hi).fork();
        new Task(this,lo,mid).fork();
      }
 else       if (hi > lo)       action.accept(array[lo]);
      tryComplete();
    }
  }
  new Task(null,0,array.length).invoke();
}
Program: 63229
Project: 63229
Buggy source:
public ForkJoinWorkerThread newThread(ForkJoinPool p){
  if (++calls > 1)   return null;
  return new FailingFJWSubclass(p);
}

Fixed version (ground truth):
public ForkJoinWorkerThread newThread(ForkJoinPool p){
  if (calls.incrementAndGet() > 1)   return null;
  return new FailingFJWSubclass(p);
}
Program: 63230
Project: 63230
Buggy source:
static void fullFence(){
  U.putOrderedInt(x,OFF,0);
}

Fixed version (ground truth):
static void fullFence(){
  U.putIntVolatile(x,OFF,0);
}
Program: 63231
Project: 63231
Buggy source:
static void storeFence(){
  U.putIntVolatile(x,OFF,0);
}

Fixed version (ground truth):
static void storeFence(){
  U.putOrderedInt(x,OFF,0);
}
Program: 63233
Project: 63233
Buggy source:
public static void main(String[] args) throws Throwable {
  try {
    realMain(args);
  }
 catch (  Throwable t) {
    unexpected(t);
  }
  System.out.printf("String_Node_Str",passed,failed);
  if (failed > 0)   throw new AssertionError("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    realMain(args);
  }
 catch (  Throwable t) {
    unexpected(t);
  }
  System.out.printf("String_Node_Str",passed,failed);
  if (failed > 0)   throw new AssertionError("String_Node_Str");
}
Program: 63234
Project: 63234
Buggy source:
private void testDropWhileMulti(Consumer<Stream<Integer>> mRef,Consumer<IntStream> mInt,Consumer<LongStream> mLong,Consumer<DoubleStream> mDouble){
  Map<String,Supplier<Stream<Integer>>> sources=new HashMap<>();
  sources.put("String_Node_Str",() -> IntStreams.range(0,DROP_SOURCE_SIZE).boxed());
  sources.put("String_Node_Str",() -> IntStreams.range(0,DROP_SOURCE_SIZE).boxed().unordered());
  sources.put("String_Node_Str",() -> StreamSupport.stream(IntStreams.range(0,DROP_SOURCE_SIZE).boxed().collect((Collector<Integer,?,List<Integer>>)toCollection(LinkedList::new))));
  sources.put("String_Node_Str",() -> StreamSupport.stream(IntStreams.range(0,DROP_SOURCE_SIZE).boxed().collect((Collector<Integer,?,List<Integer>>)toCollection(LinkedList::new))).unordered());
  testWhileMulti(sources,mRef,mInt,mLong,mDouble);
}

Fixed version (ground truth):
private void testDropWhileMulti(Consumer<Stream<Integer>> mRef,Consumer<IntStream> mInt,Consumer<LongStream> mLong,Consumer<DoubleStream> mDouble){
  Map<String,Supplier<Stream<Integer>>> sources=new HashMap<>();
  sources.put("String_Node_Str",() -> IntStreams.range(0,DROP_SOURCE_SIZE).boxed());
  sources.put("String_Node_Str",() -> IntStreams.range(0,DROP_SOURCE_SIZE).boxed().unordered());
  sources.put("String_Node_Str",() -> StreamSupport.stream(IntStreams.range(0,DROP_SOURCE_SIZE).boxed().collect(toCollection(LinkedList::new))));
  sources.put("String_Node_Str",() -> StreamSupport.stream(IntStreams.range(0,DROP_SOURCE_SIZE).boxed().collect(toCollection(LinkedList::new))).unordered());
  testWhileMulti(sources,mRef,mInt,mLong,mDouble);
}
Program: 63235
Project: 63235
Buggy source:
private static <T>Spliterator<T> setSpliterator(Set<? extends T> c,String className){
  if (NATIVE_SPECIALIZATION || IS_ANDROID) {
    if ("String_Node_Str".equals(className)) {
      return (Spliterator<T>)HMSpliterators.<Object,Object>getEntrySetSpliterator((Set<Map.Entry<Object,Object>>)c);
    }
    if ("String_Node_Str".equals(className)) {
      return HMSpliterators.getKeySetSpliterator((Set<T>)c);
    }
    if (c instanceof HashSet) {
      return HMSpliterators.getHashSetSpliterator((HashSet<T>)c);
    }
  }
  if (c instanceof LinkedHashSet) {
    return spliterator(c,Spliterator.DISTINCT | Spliterator.ORDERED);
  }
  if (c instanceof SortedSet) {
    return new IteratorSpliterator<T>(c,Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED){
      @Override public Comparator<? super T> getComparator(){
        return ((SortedSet<T>)c).comparator();
      }
    }
;
  }
  if ((NATIVE_SPECIALIZATION || IS_ANDROID) && c instanceof CopyOnWriteArraySet) {
    return CopyOnWriteArraySetSpliterator.spliterator((CopyOnWriteArraySet<T>)c);
  }
  return Spliterators.spliterator(c,Spliterator.DISTINCT);
}

Fixed version (ground truth):
private static <T>Spliterator<T> setSpliterator(Set<? extends T> c,String className){
  if (NATIVE_SPECIALIZATION || IS_ANDROID) {
    if ("String_Node_Str".equals(className)) {
      return (Spliterator<T>)HMSpliterators.<Object,Object>getEntrySetSpliterator((Set<Map.Entry<Object,Object>>)c);
    }
    if ("String_Node_Str".equals(className)) {
      return HMSpliterators.getKeySetSpliterator((Set<T>)c);
    }
  }
  if (c instanceof LinkedHashSet) {
    return spliterator(c,Spliterator.DISTINCT | Spliterator.ORDERED);
  }
  if (NATIVE_SPECIALIZATION || IS_ANDROID) {
    if (c instanceof HashSet) {
      return HMSpliterators.getHashSetSpliterator((HashSet<T>)c);
    }
  }
  if (c instanceof SortedSet) {
    return new IteratorSpliterator<T>(c,Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED){
      @Override public Comparator<? super T> getComparator(){
        return ((SortedSet<T>)c).comparator();
      }
    }
;
  }
  if ((NATIVE_SPECIALIZATION || IS_ANDROID) && c instanceof CopyOnWriteArraySet) {
    return CopyOnWriteArraySetSpliterator.spliterator((CopyOnWriteArraySet<T>)c);
  }
  return Spliterators.spliterator(c,Spliterator.DISTINCT);
}
Program: 63236
Project: 63236
Buggy source:
/** 
 * Creates a TimSort instance to maintain the state of an ongoing sort.
 * @param a the array to be sorted
 * @param c the comparator to determine the order of the sort
 * @param work a workspace array (slice)
 * @param workBase origin of usable space in work array
 * @param workLen usable size of work array
 */
private TimSort(T[] a,Comparator<? super T> c,T[] work,int workBase,int workLen){
  this.a=a;
  this.c=c;
  int len=a.length;
  int tlen=(len < 2 * INITIAL_TMP_STORAGE_LENGTH) ? len >>> 1 : INITIAL_TMP_STORAGE_LENGTH;
  if (work == null || workLen < tlen || workBase + tlen > work.length) {
    @SuppressWarnings("String_Node_Str") T[] newArray=(T[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(),tlen);
    tmp=newArray;
    tmpBase=0;
    tmpLen=tlen;
  }
 else {
    tmp=work;
    tmpBase=workBase;
    tmpLen=workLen;
  }
  int stackLen=(len < 120 ? 5 : len < 1542 ? 10 : len < 119151 ? 24 : 40);
  runBase=new int[stackLen];
  runLen=new int[stackLen];
}

Fixed version (ground truth):
/** 
 * Creates a TimSort instance to maintain the state of an ongoing sort.
 * @param a the array to be sorted
 * @param c the comparator to determine the order of the sort
 * @param work a workspace array (slice)
 * @param workBase origin of usable space in work array
 * @param workLen usable size of work array
 */
private TimSort(T[] a,Comparator<? super T> c,T[] work,int workBase,int workLen){
  this.a=a;
  this.c=c;
  int len=a.length;
  int tlen=(len < 2 * INITIAL_TMP_STORAGE_LENGTH) ? len >>> 1 : INITIAL_TMP_STORAGE_LENGTH;
  if (work == null || workLen < tlen || workBase + tlen > work.length) {
    @SuppressWarnings("String_Node_Str") T[] newArray=(T[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(),tlen);
    tmp=newArray;
    tmpBase=0;
    tmpLen=tlen;
  }
 else {
    tmp=work;
    tmpBase=workBase;
    tmpLen=workLen;
  }
  int stackLen=(len < 120 ? 5 : len < 1542 ? 10 : len < 119151 ? 24 : 49);
  runBase=new int[stackLen];
  runLen=new int[stackLen];
}
Program: 63237
Project: 63237
Buggy source:
@SuppressWarnings("String_Node_Str") @Subscribe(thread=EventThread.IO,tags={@Tag(Constants.RxBusEventType.LOAD_BOOK_LIST)}) public void loadFileList(Integer type){
  File dir=Constants.DIR;
  if (dir.exists() && dir.isDirectory()) {
    File[] files=dir.listFiles();
    FileUtils.sortWithLastModified(files);
    if (files != null) {
      mFileModelList.clear();
      for (      File file : files) {
        handleFiles(file.getAbsolutePath(),file.length());
      }
    }
  }
  runOnUiThread(() -> {
    mSwipeRefreshLayout.setRefreshing(false);
    mAppshelfAdapter.notifyDataSetChanged();
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(thread=EventThread.IO,tags={@Tag(Constants.RxBusEventType.LOAD_BOOK_LIST)}) public void loadFileList(Integer type){
  File dir=Constants.DIR;
  if (dir.exists() && dir.isDirectory()) {
    File[] files=dir.listFiles();
    if (files == null) {
      return;
    }
    FileUtils.sortWithLastModified(files);
    mFileModelList.clear();
    for (    File file : files) {
      handleFiles(file.getAbsolutePath(),file.length());
    }
  }
  runOnUiThread(() -> {
    mSwipeRefreshLayout.setRefreshing(false);
    mAppshelfAdapter.notifyDataSetChanged();
  }
);
}
Program: 63238
Project: 63238
Buggy source:
/** 
 * Executes all the test entities in the collection.
 */
public void execute(TestExecutor executor) throws Throwable {
  setSummary(new TestResultsSummary(this));
  setExecutor(executor);
  computeNestedLevel();
  setupEntity();
  setFinishedTests(new Vector());
  if (getNestedCounter() < 1) {
    System.out.println();
    System.out.println("String_Node_Str" + getSummary().getName());
  }
  long startTime=System.nanoTime();
  for (Enumeration tests=getTests().elements(); tests.hasMoreElements(); ) {
    junit.framework.Test test=(junit.framework.Test)tests.nextElement();
    if ((TestExecutor.getDefaultJUnitTestResult() != null) && TestExecutor.getDefaultJUnitTestResult().shouldStop()) {
      break;
    }
    executor.execute(test);
    getFinishedTests().addElement(test);
  }
  long endTime=System.nanoTime();
  getSummary().setTotalTime(endTime - startTime);
  setFinishedTests((Vector)getTests().clone());
  if (getNestedCounter() < 1) {
    computeResultSummary();
    System.out.printf("String_Node_Str",getSummary().getPassed(),getSummary().getErrors() + getSummary().getSetupFailures(),getSummary().getFatalErrors(),getSummary().getWarnings() + getSummary().getProblems() + getSummary().getSetupWarnings(),getSummary().getTotalTime() / 1e9);
    System.out.println();
  }
}

Fixed version (ground truth):
/** 
 * Executes all the test entities in the collection.
 */
public void execute(TestExecutor executor) throws Throwable {
  setSummary(new TestResultsSummary(this));
  setExecutor(executor);
  computeNestedLevel();
  setupEntity();
  setFinishedTests(new Vector());
  if (getNestedCounter() < 1) {
    System.out.println();
    System.out.println("String_Node_Str" + getSummary().getName());
  }
  long startTime=System.nanoTime();
  for (Enumeration tests=getTests().elements(); tests.hasMoreElements(); ) {
    junit.framework.Test test=(junit.framework.Test)tests.nextElement();
    if ((TestExecutor.getDefaultJUnitTestResult() != null) && TestExecutor.getDefaultJUnitTestResult().shouldStop()) {
      break;
    }
    executor.execute(test);
    getFinishedTests().addElement(test);
  }
  long endTime=System.nanoTime();
  getSummary().setTotalTime(endTime - startTime);
  setFinishedTests((Vector)getTests().clone());
  if (getNestedCounter() < 1) {
    computeResultSummary();
    System.out.printf("String_Node_Str",getSummary().getPassed(),getSummary().getErrors() + getSummary().getSetupFailures(),getSummary().getFatalErrors(),getSummary().getWarnings() + getSummary().getProblems() + getSummary().getSetupWarnings(),getSummary().getTotalTime() / 1e9);
    System.out.println();
  }
  reset();
}
Program: 63240
Project: 63240
Buggy source:
/** 
 * INTERNAL: Returns query to check whether given table exists. Returned query must be completely prepared so it can be just executed by calling code.
 * @param table database table meta-data
 * @return query to check whether given table exists
 */
public DataReadQuery getTableExistsQuery(final TableDefinition table){
  String column=null;
  for (  FieldDefinition field : table.getFields()) {
    if (column == null) {
      column=field.getName();
    }
 else     if (field.isPrimaryKey()) {
      column=field.getName();
      break;
    }
  }
  final String sql="String_Node_Str" + column + "String_Node_Str"+ table.getFullName()+ "String_Node_Str";
  final DataReadQuery query=new DataReadQuery(sql);
  query.setMaxRows(1);
  return query;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Returns query to check whether given table exists. Query execution throws an exception when no such table exists.
 * @param table database table meta-data
 * @return query to check whether given table exists
 */
protected DataReadQuery getTableExistsQuery(final TableDefinition table){
  final String sql="String_Node_Str" + table.getFullName();
  final DataReadQuery query=new DataReadQuery(sql);
  query.setMaxRows(1);
  return query;
}
Program: 63241
Project: 63241
Buggy source:
public DatabasePlatform(){
  this.tableQualifier="String_Node_Str";
  this.usesNativeSQL=false;
  this.usesByteArrayBinding=true;
  this.usesStringBinding=false;
  this.stringBindingSize=255;
  this.shouldTrimStrings=true;
  this.shouldBindAllParameters=true;
  this.shouldCacheAllStatements=false;
  this.shouldOptimizeDataConversion=true;
  this.statementCacheSize=50;
  this.shouldForceFieldNamesToUpperCase=false;
  this.maxBatchWritingSize=0;
  this.usesJDBCBatchWriting=true;
  this.transactionIsolation=-1;
  this.cursorCode=-10;
  this.supportsAutoCommit=true;
  this.usesNativeBatchWriting=false;
  this.castSizeForVarcharParameter=32672;
  this.startDelimiter="String_Node_Str";
  this.endDelimiter="String_Node_Str";
  this.useJDBCStoredProcedureSyntax=null;
  this.storedProcedureTerminationToken="String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Creates an instance of default database platform.
 */
public DatabasePlatform(){
  this.tableQualifier="String_Node_Str";
  this.usesNativeSQL=false;
  this.usesByteArrayBinding=true;
  this.usesStringBinding=false;
  this.stringBindingSize=255;
  this.shouldTrimStrings=true;
  this.shouldBindAllParameters=true;
  this.shouldCacheAllStatements=false;
  this.shouldOptimizeDataConversion=true;
  this.statementCacheSize=50;
  this.shouldForceFieldNamesToUpperCase=false;
  this.maxBatchWritingSize=0;
  this.usesJDBCBatchWriting=true;
  this.transactionIsolation=-1;
  this.cursorCode=-10;
  this.supportsAutoCommit=true;
  this.usesNativeBatchWriting=false;
  this.castSizeForVarcharParameter=32672;
  this.startDelimiter="String_Node_Str";
  this.endDelimiter="String_Node_Str";
  this.useJDBCStoredProcedureSyntax=null;
  this.storedProcedureTerminationToken="String_Node_Str";
}
Program: 63242
Project: 63242
Buggy source:
public DatabasePlatform(){
  super();
}

Fixed version (ground truth):
/** 
 * Creates an instance of default database platform.
 */
public DatabasePlatform(){
  super();
}
Program: 63244
Project: 63244
Buggy source:
private void marshalStreamOrWriter(Object object,MarshalRecord marshalRecord,ABSTRACT_SESSION session,DESCRIPTOR descriptor,boolean isXMLRoot){
  marshalRecord.setMarshaller(this);
  if (isXMLRoot) {
    if (session == null || descriptor == null) {
      try {
        session=context.getSession(((Root)object).getObject());
        if (session != null) {
          descriptor=getDescriptor(((Root)object).getObject(),session);
        }
      }
 catch (      XMLMarshalException marshalException) {
        if (!isSimpleXMLRoot((Root)object)) {
          throw marshalException;
        }
      }
    }
  }
 else {
    Class objectClass=object.getClass();
    if (object instanceof Collection) {
      marshalRecord.startCollection();
      for (      Object o : (Collection)object) {
        marshal(o,marshalRecord);
      }
      marshalRecord.endCollection();
      marshalRecord.flush();
      return;
    }
 else     if (objectClass.isArray()) {
      marshalRecord.startCollection();
      int arrayLength=Array.getLength(object);
      for (int x=0; x < arrayLength; x++) {
        marshal(Array.get(object,x),marshalRecord);
      }
      marshalRecord.endCollection();
      marshalRecord.flush();
      return;
    }
    if (session == null || descriptor == null) {
      session=context.getSession(objectClass);
      descriptor=getDescriptor(objectClass,session);
    }
  }
  marshal(object,marshalRecord,session,descriptor,isXMLRoot);
  marshalRecord.flush();
}

Fixed version (ground truth):
private void marshalStreamOrWriter(Object object,MarshalRecord marshalRecord,ABSTRACT_SESSION session,DESCRIPTOR descriptor,boolean isXMLRoot){
  marshalRecord.setMarshaller(this);
  if (isXMLRoot) {
    if (session == null || descriptor == null) {
      try {
        session=context.getSession(((Root)object).getObject());
        if (session != null) {
          descriptor=getDescriptor(((Root)object).getObject(),session);
        }
 else         if (descriptor == null) {
          descriptor=context.getDescriptor(new QName(((Root)object).getNamespaceURI(),((Root)object).getLocalName()));
        }
      }
 catch (      XMLMarshalException marshalException) {
        if (!isSimpleXMLRoot((Root)object)) {
          throw marshalException;
        }
      }
    }
  }
 else {
    Class objectClass=object.getClass();
    if (object instanceof Collection) {
      marshalRecord.startCollection();
      for (      Object o : (Collection)object) {
        marshal(o,marshalRecord);
      }
      marshalRecord.endCollection();
      marshalRecord.flush();
      return;
    }
 else     if (objectClass.isArray()) {
      marshalRecord.startCollection();
      int arrayLength=Array.getLength(object);
      for (int x=0; x < arrayLength; x++) {
        marshal(Array.get(object,x),marshalRecord);
      }
      marshalRecord.endCollection();
      marshalRecord.flush();
      return;
    }
    if (session == null || descriptor == null) {
      session=context.getSession(objectClass);
      descriptor=getDescriptor(objectClass,session);
    }
  }
  marshal(object,marshalRecord,session,descriptor,isXMLRoot);
  marshalRecord.flush();
}
Program: 63247
Project: 63247
Buggy source:
/** 
 * Creates and stores primary key expression.
 */
public void createPrimaryKeyExpression(AbstractSession session){
  Expression expression=null;
  Expression builder=new ExpressionBuilder();
  Expression subExp1;
  Expression subExp2;
  Expression subExpression;
  List primaryKeyFields=this.descriptor.getPrimaryKeyFields();
  if (null != primaryKeyFields) {
    for (int index=0; index < primaryKeyFields.size(); index++) {
      DatabaseField primaryKeyField=(DatabaseField)primaryKeyFields.get(index);
      subExpression=session.getPlatform().createExpressionFor(primaryKeyField,builder);
      if (expression == null) {
        expression=subExpression;
      }
 else {
        expression=expression.and(subExpression);
      }
    }
  }
  setPrimaryKeyExpression(expression);
}

Fixed version (ground truth):
/** 
 * Creates and stores primary key expression.
 */
public void createPrimaryKeyExpression(AbstractSession session){
  Expression expression=null;
  Expression builder=new ExpressionBuilder();
  Expression subExp1;
  Expression subExp2;
  Expression subExpression;
  List primaryKeyFields=this.descriptor.getPrimaryKeyFields();
  if (null != primaryKeyFields) {
    for (int index=0; index < primaryKeyFields.size(); index++) {
      DatabaseField primaryKeyField=(DatabaseField)primaryKeyFields.get(index);
      subExpression=((DatasourcePlatform)session.getDatasourcePlatform()).createExpressionFor(primaryKeyField,builder);
      if (expression == null) {
        expression=subExpression;
      }
 else {
        expression=expression.and(subExpression);
      }
    }
  }
  setPrimaryKeyExpression(expression);
}