nus-yam/ex-repair huggingface dataset:
Program: 42986
Project: 42986
Buggy source:
@SuppressWarnings("String_Node_Str") final K key(){
  if (keyRef instanceof Reference)   return ((Reference<K>)keyRef).get();
  return (K)keyRef;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") final K key(){
  if (keyRef instanceof KeyReference)   return ((Reference<K>)keyRef).get();
  return (K)keyRef;
}
Program: 42987
Project: 42987
Buggy source:
@SuppressWarnings("String_Node_Str") final V dereferenceValue(Object value){
  if (value instanceof Reference)   return ((Reference<V>)value).get();
  return (V)value;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") final V dereferenceValue(Object value){
  if (value instanceof KeyReference)   return ((Reference<V>)value).get();
  return (V)value;
}
Program: 42988
Project: 42988
Buggy source:
public boolean equals(Object o){
  if (!(o instanceof Map.Entry))   return false;
  @SuppressWarnings("String_Node_Str") Map.Entry e=(Map.Entry)o;
  return eq(key,e.getKey()) && eq(value,e.getValue());
}

Fixed version (ground truth):
public boolean equals(Object o){
  if (!(o instanceof Map.Entry))   return false;
  Map.Entry<?,?> e=(Map.Entry<?,?>)o;
  return eq(key,e.getKey()) && eq(value,e.getValue());
}
Program: 42989
Project: 42989
Buggy source:
/** 
 * Push an exception condition into the queue.  After this method is called, no further buffers may be pushed into this instance.
 * @param e the exception to push
 */
public void pushException(IOException e){
synchronized (this) {
    if (!eof) {
      failure=e;
    }
  }
}

Fixed version (ground truth):
/** 
 * Push an exception condition into the queue.  After this method is called, no further buffers may be pushed into this instance.
 * @param e the exception to push
 */
public void pushException(IOException e){
synchronized (this) {
    if (!eof) {
      failure=e;
      notifyAll();
    }
  }
}
Program: 42990
Project: 42990
Buggy source:
/** 
 * Construct a new instance.  The given   {@code inputHandler} willbe invoked after each buffer is fully read and when the stream is closed.
 * @param inputHandler the input events handler
 */
public NioByteInput(final InputHandler inputHandler){
  this.inputHandler=inputHandler;
  queue=new ArrayDeque<ByteBuffer>();
}

Fixed version (ground truth):
/** 
 * Construct a new instance.  The given   {@code inputHandler} willbe invoked after each buffer is fully read and when the stream is closed.
 * @param inputHandler the input events handler
 */
public NioByteInput(final InputHandler inputHandler){
  this.inputHandler=inputHandler;
  queue=new ArrayDeque<Pair<ByteBuffer,BufferReturn>>();
}
Program: 42991
Project: 42991
Buggy source:
/** 
 * {@inheritDoc} 
 */
public int read(final byte[] b,final int off,int len) throws IOException {
  if (len == 0) {
    return 0;
  }
  final Queue<ByteBuffer> queue=this.queue;
synchronized (this) {
    while (queue.isEmpty()) {
      if (eof) {
        return -1;
      }
      checkFailure();
      try {
        wait();
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new InterruptedIOException("String_Node_Str");
      }
    }
    int total=0;
    while (len > 0) {
      final ByteBuffer buffer=queue.peek();
      if (buffer == null) {
        break;
      }
      final int bytecnt=Math.min(buffer.remaining(),len);
      buffer.get(b,off,bytecnt);
      total+=bytecnt;
      len-=bytecnt;
      if (buffer.remaining() == 0) {
        try {
          inputHandler.acknowledge();
        }
 catch (        IOException e) {
          eof=true;
          queue.clear();
          throw e;
        }
      }
    }
    return total;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public int read(final byte[] b,final int off,int len) throws IOException {
  if (len == 0) {
    return 0;
  }
  final Queue<Pair<ByteBuffer,BufferReturn>> queue=this.queue;
synchronized (this) {
    while (queue.isEmpty()) {
      if (eof) {
        return -1;
      }
      checkFailure();
      try {
        wait();
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new InterruptedIOException("String_Node_Str");
      }
    }
    int total=0;
    while (len > 0) {
      final Pair<ByteBuffer,BufferReturn> pair=queue.peek();
      if (pair == null) {
        break;
      }
      final ByteBuffer buffer=pair.getA();
      final BufferReturn bufferReturn=pair.getB();
      final int bytecnt=Math.min(buffer.remaining(),len);
      buffer.get(b,off,bytecnt);
      total+=bytecnt;
      len-=bytecnt;
      if (buffer.remaining() == 0) {
        if (bufferReturn != null) {
          bufferReturn.returnBuffer(buffer);
        }
        queue.poll();
        try {
          inputHandler.acknowledge();
        }
 catch (        IOException e) {
          eof=true;
          clearQueue();
          notifyAll();
          throw e;
        }
      }
    }
    return total;
  }
}
Program: 42992
Project: 42992
Buggy source:
/** 
 * Push the EOF condition into the queue.  After this method is called, no further buffers may be pushed into this instance.
 */
public void pushEof(){
synchronized (this) {
    eof=true;
  }
}

Fixed version (ground truth):
/** 
 * Push the EOF condition into the queue.  After this method is called, no further buffers may be pushed into this instance.
 */
public void pushEof(){
synchronized (this) {
    eof=true;
    notifyAll();
  }
}
Program: 42993
Project: 42993
Buggy source:
/** 
 * {@inheritDoc} 
 */
public int available() throws IOException {
synchronized (this) {
    int total=0;
    for (    ByteBuffer buffer : queue) {
      total+=buffer.remaining();
      if (total < 0) {
        return Integer.MAX_VALUE;
      }
    }
    return total;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public int available() throws IOException {
synchronized (this) {
    int total=0;
    for (    Pair<ByteBuffer,BufferReturn> pair : queue) {
      total+=pair.getA().remaining();
      if (total < 0) {
        return Integer.MAX_VALUE;
      }
    }
    return total;
  }
}
Program: 42994
Project: 42994
Buggy source:
public long skip(long qty) throws IOException {
  final Queue<ByteBuffer> queue=this.queue;
synchronized (this) {
    while (queue.isEmpty()) {
      if (eof) {
        return 0L;
      }
      checkFailure();
      try {
        wait();
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new InterruptedIOException("String_Node_Str");
      }
    }
    long skipped=0L;
    while (qty > 0L) {
      final ByteBuffer buffer=queue.peek();
      if (buffer == null) {
        break;
      }
      final int bytecnt=Math.min(buffer.remaining(),(int)Math.max((long)Integer.MAX_VALUE,qty));
      buffer.position(buffer.position() + bytecnt);
      skipped+=bytecnt;
      qty-=bytecnt;
      if (buffer.remaining() == 0) {
        queue.poll();
        try {
          inputHandler.acknowledge();
        }
 catch (        IOException e) {
          eof=true;
          queue.clear();
          throw e;
        }
      }
    }
    return skipped;
  }
}

Fixed version (ground truth):
public long skip(long qty) throws IOException {
  final Queue<Pair<ByteBuffer,BufferReturn>> queue=this.queue;
synchronized (this) {
    while (queue.isEmpty()) {
      if (eof) {
        return 0L;
      }
      checkFailure();
      try {
        wait();
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new InterruptedIOException("String_Node_Str");
      }
    }
    long skipped=0L;
    while (qty > 0L) {
      final Pair<ByteBuffer,BufferReturn> pair=queue.peek();
      if (pair == null) {
        break;
      }
      final ByteBuffer buffer=pair.getA();
      final BufferReturn bufferReturn=pair.getB();
      final int bytecnt=Math.min(buffer.remaining(),(int)Math.max((long)Integer.MAX_VALUE,qty));
      buffer.position(buffer.position() + bytecnt);
      skipped+=bytecnt;
      qty-=bytecnt;
      if (buffer.remaining() == 0) {
        queue.poll();
        if (bufferReturn != null) {
          bufferReturn.returnBuffer(buffer);
        }
        try {
          inputHandler.acknowledge();
        }
 catch (        IOException e) {
          eof=true;
          clearQueue();
          throw e;
        }
      }
    }
    return skipped;
  }
}
Program: 42995
Project: 42995
Buggy source:
private void checkFailure() throws IOException {
  final IOException failure=this.failure;
  if (failure != null) {
    failure.fillInStackTrace();
    try {
      throw failure;
    }
  finally {
      eof=true;
      this.failure=null;
    }
  }
}

Fixed version (ground truth):
private void checkFailure() throws IOException {
  final IOException failure=this.failure;
  if (failure != null) {
    failure.fillInStackTrace();
    try {
      throw failure;
    }
  finally {
      eof=true;
      clearQueue();
      this.failure=null;
    }
  }
}
Program: 42996
Project: 42996
Buggy source:
/** 
 * Push a buffer into the queue.  There is no mechanism to limit the number of pushed buffers; if such a mechanism is desired, it must be implemented externally, for example maybe using a   {@link java.util.concurrent.Semaphore Semaphore}.
 * @param buffer the buffer from which more data should be read
 */
public void push(final ByteBuffer buffer){
synchronized (this) {
    if (!eof && failure == null) {
      queue.add(buffer);
    }
  }
}

Fixed version (ground truth):
/** 
 * Push a buffer into the queue.  There is no mechanism to limit the number of pushed buffers; if such a mechanism is desired, it must be implemented externally, for example maybe using a   {@link java.util.concurrent.Semaphore Semaphore}.
 * @param buffer the buffer from which more data should be read
 * @param bufferReturn the buffer return to send this buffer to when it is exhausted
 */
public void push(final ByteBuffer buffer,final BufferReturn bufferReturn){
synchronized (this) {
    if (!eof && failure == null) {
      queue.add(Pair.create(buffer,bufferReturn));
      notifyAll();
    }
 else {
      throw new IllegalStateException();
    }
  }
}
Program: 42998
Project: 42998
Buggy source:
public void defaultReadObject() throws IOException, ClassNotFoundException {
  if (!state.compareAndSet(State.UNREAD_FIELDS,State.ON)) {
    throw new NotActiveException("String_Node_Str");
  }
  try {
    unmarshaller.readFields(current,serializableClassDescriptor);
  }
  finally {
    serializableClassDescriptor=null;
    current=null;
  }
}

Fixed version (ground truth):
public void defaultReadObject() throws IOException, ClassNotFoundException {
  State old=state.getAndSet(State.ON);
switch (old) {
case UNREAD_FIELDS:
case UNREAD_FIELDS_EOB:
    break;
default :
  throw new NotActiveException("String_Node_Str");
}
try {
unmarshaller.readFields(current,serializableClassDescriptor);
if (old == State.UNREAD_FIELDS_EOB) {
  restoreIdx=blockUnmarshaller.tempEndOfStream();
}
}
  finally {
serializableClassDescriptor=null;
current=null;
}
}
Program: 43000
Project: 43000
Buggy source:
protected RiverObjectInputStream(final RiverUnmarshaller riverUnmarshaller,final Unmarshaller delegateUnmarshaller) throws IOException, SecurityException {
  super(delegateUnmarshaller);
  unmarshaller=riverUnmarshaller;
}

Fixed version (ground truth):
protected RiverObjectInputStream(final RiverUnmarshaller riverUnmarshaller,final BlockUnmarshaller delegateUnmarshaller) throws IOException, SecurityException {
  super(delegateUnmarshaller);
  unmarshaller=riverUnmarshaller;
  blockUnmarshaller=delegateUnmarshaller;
}
Program: 43002
Project: 43002
Buggy source:
void toString(final StringBuilder builder){
  final Info cause=this.cause;
  if (cause != null) {
    cause.toString(builder);
  }
  builder.append("String_Node_Str").append(fieldName);
}

Fixed version (ground truth):
void toString(final StringBuilder builder){
  final Info cause=this.getCause();
  if (cause != null) {
    cause.toString(builder);
  }
  builder.append("String_Node_Str").append(fieldName);
}
Program: 43004
Project: 43004
Buggy source:
void readToEndBlockData() throws IOException, ClassNotFoundException {
  for (; ; ) {
    while (remaining > 0) {
      skipBytes(remaining);
    }
    final int b=serialUnmarshaller.read();
switch (b) {
case -1:
      remaining=-1;
    return;
case TC_ENDBLOCKDATA:
  remaining=-1;
return;
case TC_BLOCKDATA:
case TC_BLOCKDATALONG:
readBlockHeader(b);
break;
default :
serialUnmarshaller.doReadObject(b,false);
break;
}
}
}

Fixed version (ground truth):
void readToEndBlockData() throws IOException, ClassNotFoundException {
  for (; ; ) {
    while (remaining > 0) {
      skipBytes(remaining);
    }
    if (remaining == -1) {
      return;
    }
    final int b=serialUnmarshaller.read();
switch (b) {
case -1:
      remaining=-1;
    return;
case TC_ENDBLOCKDATA:
  remaining=-1;
return;
case TC_BLOCKDATA:
case TC_BLOCKDATALONG:
readBlockHeader(b);
break;
default :
serialUnmarshaller.doReadObject(b,false);
break;
}
}
}
Program: 43007
Project: 43007
Buggy source:
@Test public void testExternalizerWithRepeatedWrites() throws Throwable {
  if (testMarshallerProvider instanceof ObjectOutputStreamTestMarshallerProvider) {
    throw new SkipException("String_Node_Str");
  }
  if (testUnmarshallerProvider instanceof ObjectInputStreamTestUnmarshallerProvider) {
    throw new SkipException("String_Node_Str");
  }
  TestExternalizerFactory externalizerFactory=new TestExternalizerFactory();
  Object o=new TestExternalizableInt(7);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ByteOutput byteOutput=Marshalling.createByteOutput(baos);
  MarshallingConfiguration config=configuration.clone();
  config.setClassExternalizerFactory(externalizerFactory);
  Marshaller marshaller=testMarshallerProvider.create(config,byteOutput);
  if (marshaller instanceof SerialMarshaller) {
    throw new SkipException("String_Node_Str");
  }
  marshaller.writeObject(o);
  marshaller.writeObject(o);
  marshaller.flush();
  ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
  ByteInput byteInput=Marshalling.createByteInput(bais);
  config=configuration.clone();
  config.setClassExternalizerFactory(externalizerFactory);
  Unmarshaller unmarshaller=testUnmarshallerProvider.create(config,byteInput);
  Object o2=unmarshaller.readObject();
  assertEquals(o,o2);
  Object o3=unmarshaller.readObject();
  assertSame(o2,o3);
}

Fixed version (ground truth):
@Test public void testExternalizerWithRepeatedWrites() throws Throwable {
  if (testMarshallerProvider instanceof ObjectOutputStreamTestMarshallerProvider) {
    throw new SkipException("String_Node_Str");
  }
  if (testUnmarshallerProvider instanceof ObjectInputStreamTestUnmarshallerProvider) {
    throw new SkipException("String_Node_Str");
  }
  TestExternalizerFactory externalizerFactory=new TestExternalizerFactory();
  Object o=new TestExternalizableInt(7);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ByteOutput byteOutput=Marshalling.createByteOutput(baos);
  MarshallingConfiguration config=configuration.clone();
  config.setClassExternalizerFactory(externalizerFactory);
  Marshaller marshaller=testMarshallerProvider.create(config,byteOutput);
  marshaller.writeObject(o);
  marshaller.writeObject(o);
  marshaller.flush();
  ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
  ByteInput byteInput=Marshalling.createByteInput(bais);
  config=configuration.clone();
  config.setClassExternalizerFactory(externalizerFactory);
  Unmarshaller unmarshaller=testUnmarshallerProvider.create(config,byteInput);
  Object o2=unmarshaller.readObject();
  assertEquals(o,o2);
  Object o3=unmarshaller.readObject();
  assertSame(o2,o3);
}
Program: 43011
Project: 43011
Buggy source:
public Method run(){
  Class<?> foundClass;
  Method method=null;
  for (foundClass=subject; method == null; foundClass=foundClass.getSuperclass()) {
    try {
      if (foundClass == null) {
        return null;
      }
      method=foundClass.getDeclaredMethod(name);
    }
 catch (    NoSuchMethodException e) {
      continue;
    }
  }
  final int modifiers=method.getModifiers();
  if ((modifiers & Modifier.STATIC) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.ABSTRACT) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
    return null;
  }
 else   if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
    method.setAccessible(true);
    return method;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Method run(){
  Class<?> foundClass=subject;
  Method method=null;
  while (method == null) {
    try {
      if (foundClass == null) {
        return null;
      }
      method=foundClass.getDeclaredMethod(name);
      if (method == null) {
        foundClass=foundClass.getSuperclass();
      }
    }
 catch (    NoSuchMethodException e) {
      foundClass=foundClass.getSuperclass();
      continue;
    }
  }
  final int modifiers=method.getModifiers();
  if ((modifiers & Modifier.STATIC) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.ABSTRACT) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
    return null;
  }
 else   if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
    method.setAccessible(true);
    return method;
  }
 else {
    return null;
  }
}
Program: 43012
Project: 43012
Buggy source:
private static Method lookupInheritableMethod(final Class<?> subject,final String name){
  return AccessController.doPrivileged(new PrivilegedAction<Method>(){
    public Method run(){
      Class<?> foundClass;
      Method method=null;
      for (foundClass=subject; method == null; foundClass=foundClass.getSuperclass()) {
        try {
          if (foundClass == null) {
            return null;
          }
          method=foundClass.getDeclaredMethod(name);
        }
 catch (        NoSuchMethodException e) {
          continue;
        }
      }
      final int modifiers=method.getModifiers();
      if ((modifiers & Modifier.STATIC) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.ABSTRACT) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
        return null;
      }
 else       if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
        method.setAccessible(true);
        return method;
      }
 else {
        return null;
      }
    }
  }
);
}

Fixed version (ground truth):
private static Method lookupInheritableMethod(final Class<?> subject,final String name){
  return AccessController.doPrivileged(new PrivilegedAction<Method>(){
    public Method run(){
      Class<?> foundClass=subject;
      Method method=null;
      while (method == null) {
        try {
          if (foundClass == null) {
            return null;
          }
          method=foundClass.getDeclaredMethod(name);
          if (method == null) {
            foundClass=foundClass.getSuperclass();
          }
        }
 catch (        NoSuchMethodException e) {
          foundClass=foundClass.getSuperclass();
          continue;
        }
      }
      final int modifiers=method.getModifiers();
      if ((modifiers & Modifier.STATIC) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.ABSTRACT) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
        return null;
      }
 else       if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
        method.setAccessible(true);
        return method;
      }
 else {
        return null;
      }
    }
  }
);
}
Program: 43013
Project: 43013
Buggy source:
public Method run(){
  Class<?> foundClass;
  Method method=null;
  for (foundClass=subject; foundClass != null; foundClass=foundClass.getSuperclass()) {
    try {
      method=foundClass.getDeclaredMethod(name);
    }
 catch (    NoSuchMethodException e) {
      continue;
    }
  }
  if (method == null) {
    return null;
  }
  final int modifiers=method.getModifiers();
  if ((modifiers & Modifier.STATIC) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.ABSTRACT) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
    return null;
  }
 else   if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
    method.setAccessible(true);
    return method;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Method run(){
  Class<?> foundClass;
  Method method=null;
  for (foundClass=subject; method == null; foundClass=foundClass.getSuperclass()) {
    try {
      if (foundClass == null) {
        return null;
      }
      method=foundClass.getDeclaredMethod(name);
    }
 catch (    NoSuchMethodException e) {
      continue;
    }
  }
  final int modifiers=method.getModifiers();
  if ((modifiers & Modifier.STATIC) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.ABSTRACT) != 0) {
    return null;
  }
 else   if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
    return null;
  }
 else   if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
    method.setAccessible(true);
    return method;
  }
 else {
    return null;
  }
}
Program: 43014
Project: 43014
Buggy source:
private static Method lookupInheritableMethod(final Class<?> subject,final String name){
  return AccessController.doPrivileged(new PrivilegedAction<Method>(){
    public Method run(){
      Class<?> foundClass;
      Method method=null;
      for (foundClass=subject; foundClass != null; foundClass=foundClass.getSuperclass()) {
        try {
          method=foundClass.getDeclaredMethod(name);
        }
 catch (        NoSuchMethodException e) {
          continue;
        }
      }
      if (method == null) {
        return null;
      }
      final int modifiers=method.getModifiers();
      if ((modifiers & Modifier.STATIC) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.ABSTRACT) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
        return null;
      }
 else       if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
        method.setAccessible(true);
        return method;
      }
 else {
        return null;
      }
    }
  }
);
}

Fixed version (ground truth):
private static Method lookupInheritableMethod(final Class<?> subject,final String name){
  return AccessController.doPrivileged(new PrivilegedAction<Method>(){
    public Method run(){
      Class<?> foundClass;
      Method method=null;
      for (foundClass=subject; method == null; foundClass=foundClass.getSuperclass()) {
        try {
          if (foundClass == null) {
            return null;
          }
          method=foundClass.getDeclaredMethod(name);
        }
 catch (        NoSuchMethodException e) {
          continue;
        }
      }
      final int modifiers=method.getModifiers();
      if ((modifiers & Modifier.STATIC) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.ABSTRACT) != 0) {
        return null;
      }
 else       if ((modifiers & Modifier.PRIVATE) != 0 && foundClass != subject) {
        return null;
      }
 else       if ((modifiers & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0 || isSamePackage(foundClass,subject)) {
        method.setAccessible(true);
        return method;
      }
 else {
        return null;
      }
    }
  }
);
}
Program: 43016
Project: 43016
Buggy source:
public void runWrite(final Marshaller marshaller) throws Throwable {
  if (marshaller instanceof JavaSerializationMarshaller) {
    javaSerializationMarshaller.set(true);
  }
  marshaller.writeObject(map);
  marshaller.writeObject(map);
}

Fixed version (ground truth):
public void runWrite(final Marshaller marshaller) throws Throwable {
  marshaller.writeObject(s);
  marshaller.writeObject(s);
}
Program: 43017
Project: 43017
Buggy source:
public void runRead(final Unmarshaller unmarshaller) throws Throwable {
  if ((unmarshaller instanceof RiverUnmarshaller) && version.get() < 1) {
    throw new SkipException("String_Node_Str");
  }
  if ((unmarshaller instanceof ObjectInputStreamUnmarshaller) && javaSerializationMarshaller.get()) {
    throw new SkipException("String_Node_Str");
  }
  final Object m1=unmarshaller.readObject();
  assertEquals(HashMap.class,m1.getClass());
  assertSame(m1,unmarshaller.readObject());
  assertEOF(unmarshaller);
}

Fixed version (ground truth):
public void runRead(final Unmarshaller unmarshaller) throws Throwable {
  final String rs=(String)unmarshaller.readObject();
  assertEquals("String_Node_Str",s,rs);
  assertSame(rs,unmarshaller.readObject());
}
Program: 43018
Project: 43018
Buggy source:
public void clearInstanceCache() throws IOException {
  instanceCache.clear();
  replacementCache.clear();
  externalizers.clear();
  instanceSeq=baseWireHandle;
  write(TC_RESET);
}

Fixed version (ground truth):
public void clearInstanceCache() throws IOException {
  instanceCache.clear();
  descriptorCache.clear();
  replacementCache.clear();
  externalizers.clear();
  instanceSeq=0;
  if (byteOutput != null) {
    write(TC_RESET);
  }
}
Program: 43019
Project: 43019
Buggy source:
Object readBackReference(int handle) throws IOException {
  final int idx=handle - baseWireHandle;
  if (idx < 0 || idx > instanceCache.size()) {
    throw new StreamCorruptedException(String.format("String_Node_Str",Integer.valueOf(handle)));
  }
  final Object obj=instanceCache.get(idx);
  if (obj == UNSHARED) {
    throw new StreamCorruptedException(String.format("String_Node_Str",Integer.valueOf(handle)));
  }
  if (obj == UNRESOLVED) {
    throw new StreamCorruptedException(String.format("String_Node_Str",Integer.valueOf(handle)));
  }
  return obj;
}

Fixed version (ground truth):
Object readBackReference(int handle) throws IOException {
  final int idx=handle - baseWireHandle;
  if (idx < 0 || idx >= instanceCache.size()) {
    throw new StreamCorruptedException(String.format("String_Node_Str",Integer.valueOf(handle)));
  }
  final Object obj=instanceCache.get(idx);
  if (obj == UNSHARED) {
    throw new StreamCorruptedException(String.format("String_Node_Str",Integer.valueOf(handle)));
  }
  if (obj == UNRESOLVED) {
    throw new StreamCorruptedException(String.format("String_Node_Str",Integer.valueOf(handle)));
  }
  return obj;
}
Program: 43020
Project: 43020
Buggy source:
public void runRead(final Unmarshaller unmarshaller) throws Throwable {
  if (unmarshaller instanceof ObjectInputStreamUnmarshaller) {
    throw new SkipException("String_Node_Str" + unmarshaller);
  }
  final Object repl=unmarshaller.readObject();
  assertEquals(ReplacementClass.class,repl.getClass());
  assertSame(repl,unmarshaller.readObject());
  assertEquals(((ReplacementClass)repl).blah,"String_Node_Str");
}

Fixed version (ground truth):
public void runRead(final Unmarshaller unmarshaller) throws Throwable {
  final String o1=(String)unmarshaller.readObject();
  final Integer o2=(Integer)unmarshaller.readObject();
  assertSame(o1,unmarshaller.readObject());
  assertSame(o2,unmarshaller.readObject());
  final String o1p=(String)unmarshaller.readObject();
  final Integer o2p=(Integer)unmarshaller.readObject();
  assertNotSame(o1,o1p);
  assertNotSame(o2,o2p);
  assertSame(o1p,unmarshaller.readObject());
  assertSame(o2p,unmarshaller.readObject());
}
Program: 43021
Project: 43021
Buggy source:
public void runWrite(final Marshaller marshaller) throws Throwable {
  if (marshaller instanceof ObjectOutputStreamMarshaller) {
    throw new SkipException("String_Node_Str" + marshaller);
  }
  if (marshaller instanceof JavaSerializationMarshaller) {
    throw new SkipException("String_Node_Str");
  }
  marshaller.writeObject(orig);
  marshaller.writeObject(orig);
}

Fixed version (ground truth):
public void runWrite(final Marshaller marshaller) throws Throwable {
  final String o1="String_Node_Str";
  final Integer o2=Integer.valueOf(48392);
  marshaller.writeObject(o1);
  marshaller.writeObject(o2);
  marshaller.writeObject(o1);
  marshaller.writeObject(o2);
  marshaller.clearClassCache();
  marshaller.writeObject(o1);
  marshaller.writeObject(o2);
  marshaller.writeObject(o1);
  marshaller.writeObject(o2);
}
Program: 43022
Project: 43022
Buggy source:
/** 
 * An object field. 
 */
SerializableField(Class<?> clazz,Class<?> type,String name,boolean unshared){
  classRef=new WeakReference<Class<?>>(clazz);
  typeRef=new WeakReference<Class<?>>(type);
  this.name=name;
  this.unshared=unshared;
  if (type == boolean.class) {
    kind=Kind.BOOLEAN;
  }
 else   if (type == byte.class) {
    kind=Kind.BYTE;
  }
 else   if (type == short.class) {
    kind=Kind.SHORT;
  }
 else   if (type == int.class) {
    kind=Kind.INT;
  }
 else   if (type == long.class) {
    kind=Kind.LONG;
  }
 else   if (type == char.class) {
    kind=Kind.CHAR;
  }
 else   if (type == float.class) {
    kind=Kind.FLOAT;
  }
 else   if (type == double.class) {
    kind=Kind.DOUBLE;
  }
 else {
    kind=Kind.OBJECT;
  }
}

Fixed version (ground truth):
SerializableField(Class<?> clazz,Class<?> type,String name,boolean unshared){
  classRef=new WeakReference<Class<?>>(clazz);
  typeRef=new WeakReference<Class<?>>(type);
  this.name=name;
  this.unshared=unshared;
  if (type == boolean.class) {
    kind=Kind.BOOLEAN;
  }
 else   if (type == byte.class) {
    kind=Kind.BYTE;
  }
 else   if (type == short.class) {
    kind=Kind.SHORT;
  }
 else   if (type == int.class) {
    kind=Kind.INT;
  }
 else   if (type == long.class) {
    kind=Kind.LONG;
  }
 else   if (type == char.class) {
    kind=Kind.CHAR;
  }
 else   if (type == float.class) {
    kind=Kind.FLOAT;
  }
 else   if (type == double.class) {
    kind=Kind.DOUBLE;
  }
 else {
    kind=Kind.OBJECT;
  }
}
Program: 43023
Project: 43023
Buggy source:
/** 
 * Get the reflection   {@code Field} for this serializable field.  The resultant field will be accessable.
 * @return the reflection field
 */
public Field getField(){
}

Fixed version (ground truth):
/** 
 * Get the reflection   {@code Field} for this serializable field.  The resultant field will be accessable.
 * @return the reflection field
 */
public Field getField(){
  final WeakReference<Field> fieldRef=fieldRefRef.get();
  if (fieldRef == null) {
    final Field field=lookupField();
    if (field != null) {
      fieldRefRef.compareAndSet(null,new WeakReference<Field>(field));
    }
    AccessController.doPrivileged(new PrivilegedAction<Void>(){
      public Void run(){
        field.setAccessible(true);
        return null;
      }
    }
);
    return field;
  }
 else {
    final Field field=fieldRef.get();
    if (field != null) {
      return field;
    }
    return AccessController.doPrivileged(new PrivilegedAction<Field>(){
      public Field run(){
        final Field newField=lookupField();
        final WeakReference<Field> newFieldRef;
        if (newField == null) {
          newFieldRef=null;
        }
 else {
          newField.setAccessible(true);
          newFieldRef=new WeakReference<Field>(newField);
        }
        fieldRefRef.compareAndSet(fieldRef,newFieldRef);
        return newField;
      }
    }
);
  }
}
Program: 43024
Project: 43024
Buggy source:
void defaultReadFields(final SerialUnmarshaller serialUnmarshaller,final Object subject) throws IOException, ClassNotFoundException {
  try {
    for (    SerializableField serializableField : fields) {
switch (serializableField.getKind()) {
case BOOLEAN:
{
          serializableField.getField().setBoolean(subject,serialUnmarshaller.readBoolean());
          break;
        }
case BYTE:
{
        serializableField.getField().setByte(subject,serialUnmarshaller.readByte());
        break;
      }
case CHAR:
{
      serializableField.getField().setChar(subject,serialUnmarshaller.readChar());
      break;
    }
case DOUBLE:
{
    serializableField.getField().setDouble(subject,serialUnmarshaller.readDouble());
    break;
  }
case FLOAT:
{
  serializableField.getField().setFloat(subject,serialUnmarshaller.readFloat());
  break;
}
case INT:
{
serializableField.getField().setInt(subject,serialUnmarshaller.readInt());
break;
}
case LONG:
{
serializableField.getField().setLong(subject,serialUnmarshaller.readLong());
break;
}
case SHORT:
{
serializableField.getField().setShort(subject,serialUnmarshaller.readShort());
break;
}
}
}
for (SerializableField serializableField : fields) {
if (serializableField.getKind() == SerializableField.Kind.OBJECT) {
serializableField.getField().set(subject,serialUnmarshaller.readObject());
}
}
}
 catch (IllegalAccessException e) {
final InvalidClassException ice=new InvalidClassException("String_Node_Str");
ice.initCause(e);
throw ice;
}
}

Fixed version (ground truth):
void defaultReadFields(final SerialUnmarshaller serialUnmarshaller,final Object subject) throws IOException, ClassNotFoundException {
  try {
    for (    SerializableField serializableField : fields) {
switch (serializableField.getKind()) {
case BOOLEAN:
{
          serializableField.getField().setBoolean(subject,serialUnmarshaller.readBoolean());
          break;
        }
case BYTE:
{
        serializableField.getField().setByte(subject,serialUnmarshaller.readByte());
        break;
      }
case CHAR:
{
      serializableField.getField().setChar(subject,serialUnmarshaller.readChar());
      break;
    }
case DOUBLE:
{
    serializableField.getField().setDouble(subject,serialUnmarshaller.readDouble());
    break;
  }
case FLOAT:
{
  serializableField.getField().setFloat(subject,serialUnmarshaller.readFloat());
  break;
}
case INT:
{
serializableField.getField().setInt(subject,serialUnmarshaller.readInt());
break;
}
case LONG:
{
serializableField.getField().setLong(subject,serialUnmarshaller.readLong());
break;
}
case SHORT:
{
serializableField.getField().setShort(subject,serialUnmarshaller.readShort());
break;
}
}
}
for (SerializableField serializableField : fields) {
if (serializableField.getKind() == Kind.OBJECT) {
serializableField.getField().set(subject,serialUnmarshaller.readObject());
}
}
}
 catch (IllegalAccessException e) {
final InvalidClassException ice=new InvalidClassException("String_Node_Str");
ice.initCause(e);
throw ice;
}
}
Program: 43025
Project: 43025
Buggy source:
private void writeSerialData(Class<?> objClass,Object obj) throws IOException {
  final Class<?> superClass=objClass.getSuperclass();
  if (superClass != null && Serializable.class.isAssignableFrom(objClass)) {
    writeSerialData(superClass,obj);
  }
  final SerializableClass sc=registry.lookup(objClass);
  if (sc.hasWriteObject()) {
    final SerialObjectOutputStream oos=getObjectOutputStream();
    final Object oldObj=oos.saveCurrentObject(obj);
    final SerializableClass oldSc=oos.saveCurrentSerializableClass(sc);
    final SerialObjectOutputStream.State oldState=oos.saveState();
    try {
      sc.callWriteObject(obj,oos);
    }
  finally {
      oos.setCurrentObject(oldObj);
      oos.setCurrentSerializableClass(oldSc);
      oos.restoreState(oldState);
    }
    doEndBlock();
  }
 else {
    doWriteFields(sc,obj);
  }
}

Fixed version (ground truth):
private void writeSerialData(Class<?> objClass,Object obj) throws IOException {
  final Class<?> superClass=objClass.getSuperclass();
  if (superClass != null && Serializable.class.isAssignableFrom(objClass)) {
    writeSerialData(superClass,obj);
  }
  final SerializableClass sc=registry.lookup(objClass);
  if (sc.hasWriteObject()) {
    final SerialObjectOutputStream oos=getObjectOutputStream();
    final Object oldObj=oos.saveCurrentObject(obj);
    final SerializableClass oldSc=oos.saveCurrentSerializableClass(sc);
    final Map<String,FieldPutter> map=oos.saveCurrentFieldMap();
    final SerialObjectOutputStream.State oldState=oos.saveState();
    try {
      sc.callWriteObject(obj,oos);
    }
  finally {
      oos.setCurrentObject(oldObj);
      oos.setCurrentSerializableClass(oldSc);
      oos.setCurrentFieldMap(map);
      oos.restoreState(oldState);
    }
    doEndBlock();
  }
 else {
    doWriteFields(sc,obj);
  }
}
Program: 43027
Project: 43027
Buggy source:
protected void doWriteFields(final SerializableClass info,final Object obj) throws IOException {
  final SerializableField[] serializableFields=info.getFields();
  for (  SerializableField serializableField : serializableFields) {
    try {
      final Field field=serializableField.getField();
switch (serializableField.getKind()) {
case BOOLEAN:
{
          writeBoolean(field.getBoolean(obj));
          break;
        }
case BYTE:
{
        writeByte(field.getByte(obj));
        break;
      }
case SHORT:
{
      writeShort(field.getShort(obj));
      break;
    }
case INT:
{
    writeInt(field.getInt(obj));
    break;
  }
case CHAR:
{
  writeChar(field.getChar(obj));
  break;
}
case LONG:
{
writeLong(field.getLong(obj));
break;
}
case DOUBLE:
{
writeDouble(field.getDouble(obj));
break;
}
case FLOAT:
{
writeFloat(field.getFloat(obj));
break;
}
}
}
 catch (IllegalAccessException e) {
final InvalidObjectException ioe=new InvalidObjectException("String_Node_Str");
ioe.initCause(e);
throw ioe;
}
}
for (SerializableField serializableField : serializableFields) {
try {
final Field field=serializableField.getField();
SerializableField.Kind i=serializableField.getKind();
if (i == SerializableField.Kind.OBJECT) {
doWriteObject(field.get(obj),serializableField.isUnshared());
}
}
 catch (IllegalAccessException e) {
final InvalidObjectException ioe=new InvalidObjectException("String_Node_Str");
ioe.initCause(e);
throw ioe;
}
}
}

Fixed version (ground truth):
protected void doWriteFields(final SerializableClass info,final Object obj) throws IOException {
  final SerializableField[] serializableFields=info.getFields();
  for (  SerializableField serializableField : serializableFields) {
    try {
      final Field field=serializableField.getField();
switch (serializableField.getKind()) {
case BOOLEAN:
{
          writeBoolean(field.getBoolean(obj));
          break;
        }
case BYTE:
{
        writeByte(field.getByte(obj));
        break;
      }
case SHORT:
{
      writeShort(field.getShort(obj));
      break;
    }
case INT:
{
    writeInt(field.getInt(obj));
    break;
  }
case CHAR:
{
  writeChar(field.getChar(obj));
  break;
}
case LONG:
{
writeLong(field.getLong(obj));
break;
}
case DOUBLE:
{
writeDouble(field.getDouble(obj));
break;
}
case FLOAT:
{
writeFloat(field.getFloat(obj));
break;
}
}
}
 catch (IllegalAccessException e) {
final InvalidObjectException ioe=new InvalidObjectException("String_Node_Str");
ioe.initCause(e);
throw ioe;
}
}
for (SerializableField serializableField : serializableFields) {
try {
final Field field=serializableField.getField();
Kind i=serializableField.getKind();
if (i == Kind.OBJECT) {
doWriteObject(field.get(obj),serializableField.isUnshared());
}
}
 catch (IllegalAccessException e) {
final InvalidObjectException ioe=new InvalidObjectException("String_Node_Str");
ioe.initCause(e);
throw ioe;
}
}
}
Program: 43028
Project: 43028
Buggy source:
protected void readSerial(final SerialUnmarshaller serialUnmarshaller,final SerializableClass sc,final Object subject) throws IOException, ClassNotFoundException {
  if ((flags & SC_WRITE_METHOD) != 0) {
    if (sc.hasReadObject()) {
      doReadObject(serialUnmarshaller,sc,subject);
    }
 else {
      defaultReadFields(serialUnmarshaller,subject);
    }
    serialUnmarshaller.getBlockUnmarshaller().readToEndBlockData();
  }
 else {
    if (sc.hasReadObject()) {
      final BlockUnmarshaller blockUnmarshaller=serialUnmarshaller.getBlockUnmarshaller();
      blockUnmarshaller.endOfStream();
      doReadObject(serialUnmarshaller,sc,subject);
      blockUnmarshaller.unblock();
    }
 else {
      defaultReadFields(serialUnmarshaller,subject);
    }
  }
}

Fixed version (ground truth):
protected void readSerial(final SerialUnmarshaller serialUnmarshaller,final SerializableClass sc,final Object subject) throws IOException, ClassNotFoundException {
  if ((flags & SC_WRITE_METHOD) != 0) {
    if (sc.hasReadObject()) {
      doReadObject(serialUnmarshaller,sc,subject);
    }
 else {
      defaultReadFields(serialUnmarshaller,subject);
    }
    final BlockUnmarshaller blockUnmarshaller=serialUnmarshaller.getBlockUnmarshaller();
    blockUnmarshaller.readToEndBlockData();
    blockUnmarshaller.unblock();
  }
 else {
    if (sc.hasReadObject()) {
      final BlockUnmarshaller blockUnmarshaller=serialUnmarshaller.getBlockUnmarshaller();
      blockUnmarshaller.endOfStream();
      doReadObject(serialUnmarshaller,sc,subject);
      blockUnmarshaller.unblock();
    }
 else {
      defaultReadFields(serialUnmarshaller,subject);
    }
  }
}
Program: 43029
Project: 43029
Buggy source:
private void doReadObject(final SerialUnmarshaller serialUnmarshaller,final SerializableClass sc,final Object subject) throws ClassNotFoundException, IOException {
  final SerialObjectInputStream ois=serialUnmarshaller.getObjectInputStream();
  final SerialObjectInputStream.State oldState=ois.saveState();
  final PlainDescriptor oldDescriptor=ois.saveCurrentDescriptor(this);
  final SerializableClass oldSerializableClass=ois.saveCurrentSerializableClass(sc);
  final Object oldSubject=ois.saveCurrentSubject(subject);
  try {
    final BlockUnmarshaller blockUnmarshaller=serialUnmarshaller.getBlockUnmarshaller();
    blockUnmarshaller.unblock();
    sc.callReadObject(subject,ois);
    if (ois.restoreState(oldState) != SerialObjectInputStream.State.ON) {
      throw new StreamCorruptedException("String_Node_Str");
    }
  }
  finally {
    ois.restoreState(oldState);
    ois.setCurrentDescriptor(oldDescriptor);
    ois.setCurrentSerializableClass(oldSerializableClass);
    ois.setCurrentSubject(oldSubject);
  }
}

Fixed version (ground truth):
private void doReadObject(final SerialUnmarshaller serialUnmarshaller,final SerializableClass sc,final Object subject) throws ClassNotFoundException, IOException {
  final SerialObjectInputStream ois=serialUnmarshaller.getObjectInputStream();
  final SerialObjectInputStream.State oldState=ois.saveState();
  final PlainDescriptor oldDescriptor=ois.saveCurrentDescriptor(this);
  final SerializableClass oldSerializableClass=ois.saveCurrentSerializableClass(sc);
  final Object oldSubject=ois.saveCurrentSubject(subject);
  try {
    sc.callReadObject(subject,ois);
    if (ois.restoreState(oldState) != SerialObjectInputStream.State.ON) {
      throw new StreamCorruptedException("String_Node_Str");
    }
  }
  finally {
    ois.restoreState(oldState);
    ois.setCurrentDescriptor(oldDescriptor);
    ois.setCurrentSerializableClass(oldSerializableClass);
    ois.setCurrentSubject(oldSubject);
  }
}
Program: 43031
Project: 43031
Buggy source:
private static void dumpFields(final ClassInfo info,final Map<Integer,ClassInfo> map,final AtomicInteger seq,final DataInputStream dis,final BufferedWriter w,final int depth) throws IOException {
  if ((info.flags & SC_EXTERNALIZABLE) != 0) {
    printf(w,depth,"String_Node_Str");
    dumpBlockData(map,seq,dis,w,depth + 1);
  }
 else   if ((info.flags & SC_SERIALIZABLE) != 0) {
    if (info.parent != null) {
      dumpFields(info.parent,map,seq,dis,w,depth);
    }
    printf(w,depth,"String_Node_Str",info.name);
    for (    FieldInfo fieldInfo : info.info) {
      printf(w,depth + 1,"String_Node_Str",fieldInfo.name,fieldInfo.type.getValueString(dis));
      if (fieldInfo.type.isObject()) {
        dumpObject(map,seq,dis,w,depth + 2,dis.readUnsignedByte());
      }
    }
    if ((info.flags & SC_WRITE_METHOD) != 0) {
      printf(w,depth,"String_Node_Str",info.name);
      dumpBlockData(map,seq,dis,w,depth + 1);
    }
  }
 else {
    printf(w,depth,"String_Node_Str",info.name);
  }
}

Fixed version (ground truth):
private static void dumpFields(final ClassInfo info,final Map<Integer,ClassInfo> map,final AtomicInteger seq,final DataInputStream dis,final BufferedWriter w,final int depth) throws IOException {
  if ((info.flags & SC_EXTERNALIZABLE) != 0) {
    printf(w,depth,"String_Node_Str");
    dumpBlockData(map,seq,dis,w,depth + 1);
  }
 else   if ((info.flags & SC_SERIALIZABLE) != 0) {
    if (info.parent != null) {
      dumpFields(info.parent,map,seq,dis,w,depth);
    }
    printf(w,depth,"String_Node_Str",info.name);
    for (    FieldInfo fieldInfo : info.info) {
      printf(w,depth + 1,"String_Node_Str",fieldInfo.name,fieldInfo.type.getValueString(dis));
      if (fieldInfo.type.isObject()) {
        dumpObject(map,seq,dis,w,depth + 2,dis.readUnsignedByte());
      }
    }
    if ((info.flags & SC_WRITE_METHOD) != 0) {
      printf(w,depth,"String_Node_Str",info.name);
      dumpBlockData(map,seq,dis,w,depth + 1);
    }
  }
 else {
    if (info.parent != null) {
      dumpFields(info.parent,map,seq,dis,w,depth);
    }
    printf(w,depth,"String_Node_Str",info.name);
  }
}
Program: 43032
Project: 43032
Buggy source:
public SerialObjectOutputStream run() throws IOException {
  return new SerialObjectOutputStream(SerialMarshaller.this);
}

Fixed version (ground truth):
public SerialObjectOutputStream run() throws IOException {
  return new SerialObjectOutputStream(SerialMarshaller.this,blockMarshaller);
}
Program: 43033
Project: 43033
Buggy source:
public void writeFields() throws IOException {
  if (state == State.NEW) {
    marshaller.doWriteFields(currentSerializableClass,currentObject);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void writeFields() throws IOException {
  if (state == State.NEW) {
    serialMarshaller.doWriteFields(currentSerializableClass,currentObject);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 43034
Project: 43034
Buggy source:
/** 
 * Construct a new instance that delegates to the given marshaller.
 * @param marshaller the delegate marshaller
 * @throws java.io.IOException if an I/O error occurs
 * @throws SecurityException if the caller does not have permission to construct an instance of this class
 */
protected SerialObjectOutputStream(final SerialMarshaller marshaller) throws IOException, SecurityException {
  super(marshaller);
  this.marshaller=marshaller;
}

Fixed version (ground truth):
protected SerialObjectOutputStream(final SerialMarshaller serialMarshaller,final BlockMarshaller blockMarshaller) throws IOException, SecurityException {
  super(blockMarshaller);
  this.serialMarshaller=serialMarshaller;
}
Program: 43035
Project: 43035
Buggy source:
private void doReadSerialObject(final Descriptor descriptor,final Class<?> currentClass,final Object obj) throws ClassNotFoundException, IOException {
  descriptor.readSerial(this,registry.lookup(currentClass),obj);
}

Fixed version (ground truth):
private void doReadSerialObject(final Descriptor descriptor,final Object obj) throws ClassNotFoundException, IOException {
  final Descriptor parent=descriptor.getParent();
  if (parent != null) {
    doReadSerialObject(parent,obj);
  }
  descriptor.readSerial(this,registry.lookup(descriptor.getType()),obj);
}
Program: 43037
Project: 43037
Buggy source:
private OptionalDataExceptionCreateAction(){
  constructor=AccessController.doPrivileged(new PrivilegedAction<Constructor<OptionalDataException>>(){
    public Constructor<OptionalDataException> run(){
      try {
        final Constructor<OptionalDataException> constructor=OptionalDataException.class.getConstructor(boolean.class);
        constructor.setAccessible(true);
        return constructor;
      }
 catch (      NoSuchMethodException e) {
        throw new NoSuchMethodError(e.getMessage());
      }
    }
  }
);
}

Fixed version (ground truth):
private OptionalDataExceptionCreateAction(){
  constructor=AccessController.doPrivileged(new PrivilegedAction<Constructor<OptionalDataException>>(){
    public Constructor<OptionalDataException> run(){
      try {
        final Constructor<OptionalDataException> constructor=OptionalDataException.class.getDeclaredConstructor(boolean.class);
        constructor.setAccessible(true);
        return constructor;
      }
 catch (      NoSuchMethodException e) {
        throw new NoSuchMethodError(e.getMessage());
      }
    }
  }
);
}