nus-yam/ex-repair huggingface dataset:
Program: 186403
Project: 186403
Buggy source:
public void kill(GameDownBuffer buffer) throws IllegalStateException {
  final Channel channel=ctx.getChannel();
  if (channel.isConnected()) {
    if (buffer != null) {
      ChannelBuffer channelBuffer=buffer.getChannelBuffer();
      if (channelBuffer.writable()) {
        throw new IllegalStateException("String_Node_Str" + channelBuffer.getShort(2));
      }
      ChannelFuture cf=channel.write(channelBuffer);
      cf.addListener(new ChannelFutureListener(){
        @Override public void operationComplete(        ChannelFuture future) throws Exception {
          kill();
        }
      }
);
    }
  }
 else   kill();
}

Fixed version (ground truth):
public void kill(GameDownBuffer buffer) throws IllegalStateException {
  final Channel channel=ctx.getChannel();
  if (channel.isConnected()) {
    if (buffer != null) {
      ChannelBuffer channelBuffer=buffer.getChannelBuffer();
      ProtocolCoder coder=GameBoss.getInstance().getProtocolCoder();
      if (coder != null) {
        coder.encode(channelBuffer.array(),GameBoss.getInstance().getWriteHeaderSize());
      }
      if (channelBuffer.writable()) {
        throw new IllegalStateException("String_Node_Str" + channelBuffer.getShort(2));
      }
      ChannelFuture cf=channel.write(channelBuffer);
      cf.addListener(new ChannelFutureListener(){
        @Override public void operationComplete(        ChannelFuture future) throws Exception {
          kill();
        }
      }
);
    }
  }
 else   kill();
}
Program: 186404
Project: 186404
Buggy source:
@Override protected Object decode(ChannelHandlerContext ctx,Channel channel,Object msg) throws Exception {
  if (msg instanceof ChannelBuffer) {
    ChannelBuffer cb=(ChannelBuffer)msg;
    if (cb.readableBytes() == 23 && cb.getShort(0) == 15472) {
      ChannelBuffer data=cb.readBytes(requestBuffer.readableBytes());
      if (data.equals(requestBuffer)) {
        if (logger.isDebugEnabled())         logger.debug("String_Node_Str" + channel.getRemoteAddress());
        channel.write(ChannelBuffers.wrappedBuffer(XML_REPLAY)).addListener(ChannelFutureListener.CLOSE);
        return null;
      }
    }
  }
  return msg;
}

Fixed version (ground truth):
@Override protected Object decode(ChannelHandlerContext ctx,Channel channel,Object msg) throws Exception {
  if (msg instanceof ChannelBuffer) {
    ChannelBuffer cb=(ChannelBuffer)msg;
    if (cb.readableBytes() == 23 && cb.getShort(0) == 15472) {
      ChannelBuffer data=cb.readBytes(requestBuffer.readableBytes());
      if (data.equals(requestBuffer)) {
        if (logger.isDebugEnabled())         logger.debug("String_Node_Str" + channel.getRemoteAddress());
        ctx.getPipeline().remove(GameEncoder.class);
        ctx.getPipeline().remove(GameDecoder.class);
        channel.write(ChannelBuffers.wrappedBuffer(XML_REPLAY)).addListener(ChannelFutureListener.CLOSE);
        return null;
      }
    }
  }
  return msg;
}
Program: 186405
Project: 186405
Buggy source:
public void kill(GameDownBuffer buffer) throws IllegalStateException {
  final Channel channel=ctx.getChannel();
  if (channel.isConnected()) {
    if (buffer != null) {
      ChannelBuffer channelBuffer=buffer.getChannelBuffer();
      if (channelBuffer.writableBytes() != 0)       throw new IllegalStateException("String_Node_Str" + channelBuffer.getShort(2));
      ChannelFuture cf=channel.write(buffer);
      cf.addListener(ChannelFutureListener.CLOSE);
    }
 else     ctx.getChannel().close();
  }
}

Fixed version (ground truth):
public void kill(GameDownBuffer buffer) throws IllegalStateException {
  final Channel channel=ctx.getChannel();
  if (channel.isConnected()) {
    if (buffer != null) {
      ChannelBuffer channelBuffer=buffer.getChannelBuffer();
      if (channelBuffer.writableBytes() != 0)       throw new IllegalStateException("String_Node_Str" + channelBuffer.getShort(2));
      ChannelFuture cf=channel.write(channelBuffer);
      cf.addListener(ChannelFutureListener.CLOSE);
    }
 else     ctx.getChannel().close();
  }
  ConnectionManager.getInstance().removeConnection(this);
}
Program: 186406
Project: 186406
Buggy source:
public Object getAttachment(){
  return attachment;
}

Fixed version (ground truth):
public Object getAttachment(){
synchronized (readWriteLock) {
    return attachment;
  }
}
Program: 186407
Project: 186407
Buggy source:
public void setAttachment(Object attachment){
  this.attachment=attachment;
}

Fixed version (ground truth):
public void setAttachment(Object attachment){
synchronized (readWriteLock) {
    this.attachment=attachment;
  }
}
Program: 186408
Project: 186408
Buggy source:
public String getUTFString(){
  int len=buffer.readShort();
  if (len <= 0)   throw new IllegalArgumentException("String_Node_Str");
  byte[] strData=new byte[len];
  String result=null;
  try {
    result=new String(strData,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    result=new String(strData);
    e.printStackTrace();
  }
  return result;
}

Fixed version (ground truth):
public String getUTFString(){
  int len=buffer.readShort();
  if (len <= 0)   throw new IllegalArgumentException("String_Node_Str");
  byte[] strData=new byte[len];
  if (buffer.readableBytes() < len) {
    throw new IllegalArgumentException("String_Node_Str" + len);
  }
  buffer.readBytes(strData);
  String result=null;
  try {
    result=new String(strData,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    result=new String(strData);
    e.printStackTrace();
  }
  return result;
}
Program: 186409
Project: 186409
Buggy source:
/** 
 * @param readSize
 * @param maxReadSize
 * @param hasReadSize 是否读取消息中的包含消息本身的大小
 * @param writeSize
 */
public GamePipeFactory(int readSize,int maxReadSize,boolean hasReadSize,int writeSize,boolean hasWriteSize){
  GameBufferFactory.setupGameBuffer(readSize,hasReadSize,writeSize,hasWriteSize);
  this.maxReadSize=maxReadSize;
  this.readOffset=hasReadSize ? 0 : 2;
}

Fixed version (ground truth):
/** 
 * @param readSize
 * @param maxReadSize
 * @param hasReadSize 是否读取消息中的包含消息本身的大小
 * @param writeSize
 */
public GamePipeFactory(int readSize,int maxReadSize,boolean hasReadSize,int writeSize,boolean hasWriteSize){
  GameBufferFactory.setupGameBuffer(readSize,hasReadSize,writeSize,hasWriteSize);
  this.maxReadSize=maxReadSize;
  this.readOffset=hasReadSize ? 0 : readSize;
}
Program: 186410
Project: 186410
Buggy source:
public void broadcast(GameDownBuffer buffer){
  channel.write(buffer);
}

Fixed version (ground truth):
public void broadcast(GameDownBuffer buffer){
  channel.write(buffer.getChannelBuffer());
}
Program: 186411
Project: 186411
Buggy source:
private HeadsetMode getActualHeadsetMode(){
  return actualMode;
}

Fixed version (ground truth):
private HeadsetMode getActualHeadsetMode(){
  return (actualMode != null) ? actualMode : desiredMode;
}
Program: 186412
Project: 186412
Buggy source:
public VadProcessor(int sampleRate,int lowThreshold,int highThreshold,int hangover,boolean enable){
  this.sampleRate=sampleRate;
  windowSize=round(sampleRate * windowTimeInterval);
  final float initialDbfs=(lowThreshold + highThreshold) / 2F;
  meanObserver=new LuenbergerObserver(0,0,meanObserverGain);
  energyObserver=new LuenbergerObserver(initialDbfs,0,energyObserverGain);
  trigger=new SchmittTrigger(false,initialDbfs,lowThreshold,highThreshold);
  hangoverMaxDuration=hangover;
  hangoverDuration=0;
  isEnabled=enable;
}

Fixed version (ground truth):
public VadProcessor(int sampleRate,int lowThreshold,int highThreshold,int hangover,boolean enable){
  this.sampleRate=sampleRate;
  windowSize=round(sampleRate * windowTimeInterval);
  final float initialDbfs=(lowThreshold + highThreshold) / 2F;
  energyObserver=new LuenbergerObserver(initialDbfs,0,energyObserverGain);
  trigger=new SchmittTrigger(false,initialDbfs,lowThreshold,highThreshold);
  hangoverMaxDuration=hangover;
  hangoverDuration=0;
  isEnabled=enable;
}
Program: 186413
Project: 186413
Buggy source:
private void processFrameInternal(short[] frame,int offset,int length,float windowDuration){
  short currentMean=mean(frame,offset,length);
  float currentRms=rms(frame,offset,length,currentMean);
  float currentDbfs=rms2dbfs(currentRms);
  currentMean=(short)meanObserver.smooth(currentMean);
  currentDbfs=energyObserver.smooth(currentDbfs);
  boolean currentState=trigger.state(currentDbfs);
  if (hangoverMaxDuration > 0) {
    if (!currentState) {
      hangoverDuration=min(hangoverMaxDuration,hangoverDuration + windowDuration);
      currentState=hangoverDuration < hangoverMaxDuration;
    }
 else {
      hangoverDuration=0;
    }
  }
  if (!currentState) {
    for (int i=offset; i < length; i++) {
      frame[i]=currentMean;
    }
  }
}

Fixed version (ground truth):
private void processFrameInternal(short[] frame,int offset,int length,float windowDuration){
  float currentRms=rms(frame,offset,length);
  float currentDbfs=rms2dbfs(currentRms,1e-10F,1F);
  currentDbfs=energyObserver.smooth(currentDbfs);
  boolean currentState=trigger.state(currentDbfs);
  if (hangoverMaxDuration > 0) {
    if (!currentState) {
      hangoverDuration=min(hangoverMaxDuration,hangoverDuration + windowDuration);
      currentState=hangoverDuration < hangoverMaxDuration;
    }
 else {
      hangoverDuration=0;
    }
  }
  if (!currentState) {
    for (int i=offset; i < offset + length; i++) {
      frame[i]=0;
    }
  }
}
Program: 186414
Project: 186414
Buggy source:
public void onWiredHeadsetOff(){
  if (getHeadsetMode() == HeadsetMode.WIRED_HEADSET && isThreadRunning()) {
    stopThread(false);
    if (listener != null) {
      listener.onServiceFailed();
    }
  }
}

Fixed version (ground truth):
public void onWiredHeadsetOff(){
  if (getActualHeadsetMode() == HeadsetMode.WIRED_HEADSET && isThreadRunning()) {
    stopThread(false);
    if (listener != null) {
      listener.onServiceFailed();
    }
  }
}
Program: 186415
Project: 186415
Buggy source:
@Override public void onCreate(){
  new Utils(this).log("String_Node_Str");
  super.onCreate();
  preferences=new Preferences(getApplicationContext());
  preferences.registerOnSharedPreferenceChangeListener(this);
  if (mode == null) {
    mode=preferences.getHeadsetMode();
  }
  if (headset == null) {
    headset=new HeadsetManager(this.getApplicationContext());
    headset.setListener(this);
    headset.registerHeadsetDetector();
  }
}

Fixed version (ground truth):
@Override public void onCreate(){
  new Utils(this).log("String_Node_Str");
  super.onCreate();
  preferences=new Preferences(getApplicationContext());
  preferences.registerOnSharedPreferenceChangeListener(this);
  if (desiredMode == null) {
    desiredMode=preferences.getHeadsetMode();
  }
  if (headset == null) {
    headset=new HeadsetManager(this.getApplicationContext());
    headset.setListener(this);
    headset.registerHeadsetDetector();
  }
}
Program: 186416
Project: 186416
Buggy source:
public void onBluetoothHeadsetOff(){
  if (getHeadsetMode() == HeadsetMode.BLUETOOTH_HEADSET && isThreadRunning()) {
    stopThread(false);
    if (listener != null) {
      listener.onServiceFailed();
    }
  }
}

Fixed version (ground truth):
public void onBluetoothHeadsetOff(){
  if (getActualHeadsetMode() == HeadsetMode.BLUETOOTH_HEADSET && isThreadRunning()) {
    stopThread(false);
    if (listener != null) {
      listener.onServiceFailed();
    }
  }
}
Program: 186417
Project: 186417
Buggy source:
public HeadsetMode getHeadsetMode(){
  return mode;
}

Fixed version (ground truth):
public HeadsetMode getHeadsetMode(){
  return desiredMode;
}
Program: 186418
Project: 186418
Buggy source:
public void setHeadsetMode(HeadsetMode mode){
  if (this.mode == mode)   return;
  preferences.setHeadsetMode(mode);
  if (isThreadRunning()) {
    stopThread(true);
    disposeAudioDevices();
    this.mode=mode;
    startThread();
  }
 else {
    disposeAudioDevices();
    this.mode=mode;
  }
}

Fixed version (ground truth):
public void setHeadsetMode(HeadsetMode mode){
  if (this.desiredMode == mode)   return;
  this.desiredMode=mode;
  preferences.setHeadsetMode(mode);
  if (isThreadRunning()) {
    stopThread(true);
    disposeAudioDevices();
    startThread();
  }
 else {
    disposeAudioDevices();
  }
}
Program: 186419
Project: 186419
Buggy source:
public void stopThread(boolean restarting){
  if (isThreadRunning())   thread.stop();
  if (!restarting) {
    new Utils(this).cancelAllNotifications();
  }
  headset.storeVolumeLevel(getHeadsetMode());
  if (headset.isBluetoothScoOn()) {
    headset.setBluetoothScoOn(false);
  }
  if (thread != null) {
    thread.dispose();
    thread=null;
  }
  disposeAudioDevices();
}

Fixed version (ground truth):
public void stopThread(boolean restarting){
  if (isThreadRunning())   thread.stop();
  if (!restarting) {
    new Utils(this).cancelAllNotifications();
  }
  headset.storeVolumeLevel(getActualHeadsetMode());
  if (headset.isBluetoothScoOn()) {
    headset.setBluetoothScoOn(false);
  }
  if (thread != null) {
    thread.dispose();
    thread=null;
  }
  disposeAudioDevices();
}
Program: 186420
Project: 186420
Buggy source:
public void startThread(){
  if (isThreadRunning())   return;
  HeadsetMode fallbackMode=getHeadsetMode();
  if (getHeadsetMode() == HeadsetMode.WIRED_HEADSET && !headset.isWiredHeadsetOn()) {
    if (listener != null) {
      listener.onServiceFailed();
    }
    return;
  }
  if (getHeadsetMode() == HeadsetMode.BLUETOOTH_HEADSET) {
    if (headset.isBluetoothHeadsetOn()) {
      if (!headset.isBluetoothScoOn()) {
        headset.setBluetoothScoOn(true);
        if (!headset.waitForBluetoothSco()) {
          headset.setBluetoothScoOn(false);
          fallbackMode=HeadsetMode.WIRED_HEADSET;
        }
      }
    }
 else {
      fallbackMode=HeadsetMode.WIRED_HEADSET;
    }
    if (fallbackMode == HeadsetMode.WIRED_HEADSET && !headset.isWiredHeadsetOn()) {
      if (listener != null) {
        listener.onServiceFailed();
      }
      return;
    }
  }
  if (!initAudioDevices(fallbackMode)) {
    if (listener != null) {
      listener.onServiceFailed();
    }
    return;
  }
  headset.restoreVolumeLevel(getHeadsetMode());
  thread=createAudioThread(input,output);
  if (threadParams != null) {
    thread.configure(threadParams);
  }
  thread.start();
}

Fixed version (ground truth):
public void startThread(){
  if (isThreadRunning())   return;
  setActualHeadsetMode(getHeadsetMode());
  if (getActualHeadsetMode() == HeadsetMode.BLUETOOTH_HEADSET) {
    if (headset.isBluetoothHeadsetOn()) {
      if (!headset.isBluetoothScoOn()) {
        headset.setBluetoothScoOn(true);
        if (!headset.waitForBluetoothSco()) {
          headset.setBluetoothScoOn(false);
          setActualHeadsetMode(HeadsetMode.WIRED_HEADSET);
        }
      }
    }
 else {
      setActualHeadsetMode(HeadsetMode.WIRED_HEADSET);
    }
  }
  if (getActualHeadsetMode() == HeadsetMode.WIRED_HEADSET && !headset.isWiredHeadsetOn()) {
    if (listener != null) {
      listener.onServiceFailed();
    }
    return;
  }
  if (!initAudioDevices(getActualHeadsetMode())) {
    if (listener != null) {
      listener.onServiceFailed();
    }
    return;
  }
  headset.restoreVolumeLevel(getActualHeadsetMode());
  thread=createAudioThread(input,output);
  if (threadParams != null) {
    thread.configure(threadParams);
  }
  thread.start();
}
Program: 186421
Project: 186421
Buggy source:
/** 
 * Returns the next entry in the tar file
 * @return TarEntry
 * @throws IOException
 */
public TarEntry getNextEntry() throws IOException {
  closeCurrentEntry();
  byte[] header=new byte[TarConstants.HEADER_BLOCK];
  byte[] theader=new byte[TarConstants.HEADER_BLOCK];
  int tr=0;
  while (tr < TarConstants.HEADER_BLOCK) {
    int res=read(theader,0,TarConstants.HEADER_BLOCK - tr);
    if (res < 0) {
      break;
    }
    System.arraycopy(theader,0,header,tr,res);
    tr+=res;
  }
  boolean eof=true;
  for (  byte b : header) {
    if (b != 0) {
      eof=false;
      break;
    }
  }
  if (!eof) {
    bytesRead+=header.length;
    currentEntry=new TarEntry(header);
  }
  return currentEntry;
}

Fixed version (ground truth):
/** 
 * Returns the next entry in the tar file
 * @return TarEntry
 * @throws IOException
 */
public TarEntry getNextEntry() throws IOException {
  closeCurrentEntry();
  byte[] header=new byte[TarConstants.HEADER_BLOCK];
  byte[] theader=new byte[TarConstants.HEADER_BLOCK];
  int tr=0;
  while (tr < TarConstants.HEADER_BLOCK) {
    int res=read(theader,0,TarConstants.HEADER_BLOCK - tr);
    if (res < 0) {
      break;
    }
    System.arraycopy(theader,0,header,tr,res);
    tr+=res;
  }
  boolean eof=true;
  for (  byte b : header) {
    if (b != 0) {
      eof=false;
      break;
    }
  }
  if (!eof) {
    currentEntry=new TarEntry(header);
  }
  return currentEntry;
}
Program: 186422
Project: 186422
Buggy source:
/** 
 * Skips 'n' bytes on the InputStream<br> Overrides default implementation of skip
 */
@Override public long skip(long n) throws IOException {
  if (defaultSkip) {
    return super.skip(n);
  }
  if (n <= 0) {
    return 0;
  }
  long left=n;
  byte[] sBuff=new byte[SKIP_BUFFER_SIZE];
  while (left > 0) {
    int res=read(sBuff,0,(int)(left < SKIP_BUFFER_SIZE ? left : SKIP_BUFFER_SIZE));
    if (res < 0) {
      break;
    }
    left-=res;
  }
  return n - left;
}

Fixed version (ground truth):
/** 
 * Skips 'n' bytes on the InputStream<br> Overrides default implementation of skip
 */
@Override public long skip(long n) throws IOException {
  if (defaultSkip) {
    long bs=super.skip(n);
    bytesRead+=bs;
    return bs;
  }
  if (n <= 0) {
    return 0;
  }
  long left=n;
  byte[] sBuff=new byte[SKIP_BUFFER_SIZE];
  while (left > 0) {
    int res=read(sBuff,0,(int)(left < SKIP_BUFFER_SIZE ? left : SKIP_BUFFER_SIZE));
    if (res < 0) {
      break;
    }
    left-=res;
  }
  return n - left;
}
Program: 186423
Project: 186423
Buggy source:
private Object handleObject(XMLEventReader parser,XMLEvent startEvent,ExtensionRegistry extensionRegistry,Message.Builder builder,FieldDescriptor field,ExtensionRegistry.ExtensionInfo extension) throws XMLStreamException {
}

Fixed version (ground truth):
private Object handleObject(XMLEventReader parser,XMLEvent startEvent,ExtensionRegistry extensionRegistry,Message.Builder builder,FieldDescriptor field,ExtensionRegistry.ExtensionInfo extension) throws XMLStreamException {
  Message.Builder subBuilder=createSubBuilder(builder,field,extension);
  XMLEvent event=startEvent;
  int depth=0;
  do {
    if (event.isStartElement()) {
      depth++;
      mergeField(parser,event,extensionRegistry,subBuilder);
      XMLEvent nextEvent=parser.nextTag();
      if (nextEvent.isEndElement()) {
        depth--;
        if (depth <= 0 && parser.peek().isEndElement()) {
          break;
        }
      }
 else       if (nextEvent.isStartElement()) {
        depth++;
      }
    }
 else {
      break;
    }
  }
 while (parser.hasNext() && (event=parser.nextTag()) != null);
  return subBuilder.build();
}
Program: 186424
Project: 186424
Buggy source:
/** 
 * If the next token is a string, consume it and return its (unescaped) value. Otherwise, throw a   {@link ParseException}.
 */
public String consumeString() throws ParseException {
  return consumeByteString().toStringUtf8();
}

Fixed version (ground truth):
/** 
 * If the next token is a string, consume it and return its (unescaped) value. Otherwise, throw a   {@link ParseException}.
 */
public String consumeString() throws ParseException {
  char quote=currentToken.length() > 0 ? currentToken.charAt(0) : '\0';
  if ((quote != '\"') && (quote != '\'')) {
    throw parseException("String_Node_Str");
  }
  if ((currentToken.length() < 2) || (currentToken.charAt(currentToken.length() - 1) != quote)) {
    throw parseException("String_Node_Str");
  }
  try {
    String escaped=currentToken.substring(1,currentToken.length() - 1);
    String result=unescapeText(escaped);
    nextToken();
    return result;
  }
 catch (  InvalidEscapeSequence e) {
    throw parseException(e.getMessage());
  }
}
Program: 186425
Project: 186425
Buggy source:
/** 
 * Like   {@link #escapeBytes(com.google.protobuf.ByteString)}, but escapes a text string. Non-ASCII characters are first encoded as UTF-8, then each byte is escaped individually as a 3-digit octal escape. Yes, it's weird.
 */
static String escapeText(String input){
  return escapeBytes(ByteString.copyFromUtf8(input));
}

Fixed version (ground truth):
/** 
 * Implements JSON string escaping as specified <a href="http://www.ietf.org/rfc/rfc4627.txt">here</a>. <ul> <li>The following characters are escaped by prefixing them with a '\' : \b,\f,\n,\r,\t,\,"</li>  <li>Other control characters in the range 0x0000-0x001F are escaped using the \\uXXXX notation</li> <li>UTF-16 surrogate pairs are encoded using the \\uXXXX\\uXXXX notation</li> <li>any other character is printed as-is</li> </ul>
 */
static String escapeText(String input){
  StringBuilder builder=new StringBuilder(input.length());
  CharacterIterator iter=new StringCharacterIterator(input);
  for (char c=iter.first(); c != CharacterIterator.DONE; c=iter.next()) {
switch (c) {
case '\b':
      builder.append("String_Node_Str");
    break;
case '\f':
  builder.append("String_Node_Str");
break;
case '\n':
builder.append("String_Node_Str");
break;
case '\r':
builder.append("String_Node_Str");
break;
case '\t':
builder.append("String_Node_Str");
break;
case '\\':
builder.append("String_Node_Str");
break;
case '"':
builder.append("String_Node_Str");
break;
default :
if (c >= 0x0000 && c <= 0x001F) {
appendEscapedUnicode(builder,c);
}
 else if (Character.isHighSurrogate(c)) {
appendEscapedUnicode(builder,c);
c=iter.next();
if (c == CharacterIterator.DONE) throw new IllegalArgumentException("String_Node_Str");
appendEscapedUnicode(builder,c);
}
 else {
builder.append(c);
}
break;
}
}
return builder.toString();
}
Program: 186426
Project: 186426
Buggy source:
private static void printSingleField(FieldDescriptor field,Object value,JsonGenerator generator) throws IOException {
  if (field.isExtension()) {
    generator.print("String_Node_Str");
    generator.print("String_Node_Str");
    if (field.getContainingType().getOptions().getMessageSetWireFormat() && (field.getType() == FieldDescriptor.Type.MESSAGE) && (field.isOptional())&& (field.getExtensionScope() == field.getMessageType())) {
      generator.print(field.getMessageType().getFullName());
    }
 else {
      generator.print(field.getFullName());
    }
    generator.print("String_Node_Str");
    generator.print("String_Node_Str");
  }
 else {
    generator.print("String_Node_Str");
    if (field.getType() == FieldDescriptor.Type.GROUP) {
      generator.print(field.getMessageType().getName());
    }
 else {
      generator.print(field.getName());
    }
    generator.print("String_Node_Str");
  }
  if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
    generator.print("String_Node_Str");
    generator.indent();
  }
 else {
    generator.print("String_Node_Str");
  }
  if (field.isRepeated()) {
    generator.print("String_Node_Str");
    for (Iterator<?> iter=((List<?>)value).iterator(); iter.hasNext(); ) {
      printFieldValue(field,iter.next(),generator);
      if (iter.hasNext()) {
        generator.print("String_Node_Str");
      }
    }
    generator.print("String_Node_Str");
  }
 else {
    printFieldValue(field,value,generator);
    if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
      generator.outdent();
    }
  }
}

Fixed version (ground truth):
private static void printSingleField(FieldDescriptor field,Object value,JsonGenerator generator) throws IOException {
  if (field.isExtension()) {
    generator.print("String_Node_Str");
    if (field.getContainingType().getOptions().getMessageSetWireFormat() && (field.getType() == FieldDescriptor.Type.MESSAGE) && (field.isOptional())&& (field.getExtensionScope() == field.getMessageType())) {
      generator.print(field.getMessageType().getFullName());
    }
 else {
      generator.print(field.getFullName());
    }
    generator.print("String_Node_Str");
  }
 else {
    generator.print("String_Node_Str");
    if (field.getType() == FieldDescriptor.Type.GROUP) {
      generator.print(field.getMessageType().getName());
    }
 else {
      generator.print(field.getName());
    }
    generator.print("String_Node_Str");
  }
  if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
    generator.print("String_Node_Str");
    generator.indent();
  }
 else {
    generator.print("String_Node_Str");
  }
  if (field.isRepeated()) {
    generator.print("String_Node_Str");
    for (Iterator<?> iter=((List<?>)value).iterator(); iter.hasNext(); ) {
      printFieldValue(field,iter.next(),generator);
      if (iter.hasNext()) {
        generator.print("String_Node_Str");
      }
    }
    generator.print("String_Node_Str");
  }
 else {
    printFieldValue(field,value,generator);
    if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
      generator.outdent();
    }
  }
}
Program: 186428
Project: 186428
Buggy source:
/** 
 * Un-escape a text string as escaped using   {@link #escapeText(String)}. Two-digit hex escapes (starting with "\x") are also recognized.
 */
static String unescapeText(String input) throws InvalidEscapeSequence {
  return unescapeBytes(input).toStringUtf8();
}

Fixed version (ground truth):
/** 
 * Un-escape a text string as escaped using   {@link #escapeText(String)}.
 */
static String unescapeText(String input) throws InvalidEscapeSequence {
  StringBuilder builder=new StringBuilder();
  char[] array=input.toCharArray();
  for (int i=0; i < array.length; i++) {
    char c=array[i];
    if (c == '\\') {
      if (i + 1 < array.length) {
        ++i;
        c=array[i];
switch (c) {
case 'b':
          builder.append('\b');
        break;
case 'f':
      builder.append('\f');
    break;
case 'n':
  builder.append('\n');
break;
case 'r':
builder.append('\r');
break;
case 't':
builder.append('\t');
break;
case '\\':
builder.append('\\');
break;
case '"':
builder.append('\"');
break;
case '\'':
builder.append('\'');
break;
case 'u':
if (i + 4 < array.length) {
++i;
int code=Integer.parseInt(new String(array,i,4),16);
builder.append((char)code);
i+=3;
}
 else {
throw new InvalidEscapeSequence("String_Node_Str");
}
break;
default :
throw new InvalidEscapeSequence("String_Node_Str" + c + "String_Node_Str");
}
}
 else {
throw new InvalidEscapeSequence("String_Node_Str");
}
}
 else {
builder.append(c);
}
}
return builder.toString();
}
Program: 186430
Project: 186430
Buggy source:
public void testPrintToString() throws Exception {
}

Fixed version (ground truth):
public void testPrintToString() throws Exception {
  String javaText=JsonFormat.printToString(TestUtil.getAllSet());
}
Program: 186432
Project: 186432
Buggy source:
/** 
 * Sets the max value
 * @param < W > the widget type
 * @param max the max value
 * @return this, for chaining
 */
@SuppressWarnings("String_Node_Str") public <W extends AbstractSlider<T>>W setMax(Integer max){
  this.options.set("String_Node_Str",max);
  return (W)this;
}

Fixed version (ground truth):
/** 
 * Sets the max value
 * @param < W > the widget type
 * @param max the max value
 * @return this, for chaining
 */
public AbstractSlider<T> setMax(Integer max){
  this.options.set("String_Node_Str",max);
  return this;
}
Program: 186433
Project: 186433
Buggy source:
/** 
 * Sets the   {@link Orientation}
 * @param < W > the widget type
 * @param orientation the {@code Orientation}
 * @return this, for chaining
 */
@SuppressWarnings("String_Node_Str") public <W extends AbstractSlider<T>>W setOrientation(Orientation orientation){
  this.options.set("String_Node_Str",orientation);
  return (W)this;
}

Fixed version (ground truth):
/** 
 * Sets the   {@link Orientation}
 * @param < W > the widget type
 * @param orientation the {@code Orientation}
 * @return this, for chaining
 */
public AbstractSlider<T> setOrientation(Orientation orientation){
  this.options.set("String_Node_Str",orientation);
  return this;
}
Program: 186434
Project: 186434
Buggy source:
/** 
 * Adds a   {@link RangeValidator} so slider value(s) are valid only if comprised between minimum and maximum.<br><br> <b>Warning:</b> it does not define the minimum and maximum values the slider can slide on, but only valid ones.<br> To define the minimum and maximum values the slider can slide on, use  {@link #setMin(Integer)} and {@link #setMax(Integer)}<br> <br> <b>Dev note:</b> this method is masked abstract to make sure the developer that will add the validator to the right input(s) in   {@link #onInitialize()}
 * @param < W > the widget type
 * @param validator the {@link RangeValidator}
 * @return this
 */
public abstract <W extends AbstractSlider<T>>W setRangeValidator(RangeValidator<Integer> validator);

Fixed version (ground truth):
/** 
 * Adds a   {@link RangeValidator} so slider value(s) are valid only if comprised between minimum and maximum.<br><br> <b>Warning:</b> it does not define the minimum and maximum values the slider can slide on, but only valid ones.<br> To define the minimum and maximum values the slider can slide on, use  {@link #setMin(Integer)} and {@link #setMax(Integer)}<br> <br> <b>Dev note:</b> this method is masked abstract to make sure the developer that will add the validator to the right input(s) in   {@link #onInitialize()}
 * @param < W > the widget type
 * @param validator the {@link RangeValidator}
 * @return this
 */
public abstract AbstractSlider<T> setRangeValidator(RangeValidator<Integer> validator);
Program: 186435
Project: 186435
Buggy source:
/** 
 * Sets the min value
 * @param < W > the widget type
 * @param min the min value
 * @return this, for chaining
 */
@SuppressWarnings("String_Node_Str") public <W extends AbstractSlider<T>>W setMin(Integer min){
  this.options.set("String_Node_Str",min);
  return (W)this;
}

Fixed version (ground truth):
/** 
 * Sets the min value
 * @param < W > the widget type
 * @param min the min value
 * @return this, for chaining
 */
public AbstractSlider<T> setMin(Integer min){
  this.options.set("String_Node_Str",min);
  return this;
}
Program: 186436
Project: 186436
Buggy source:
/** 
 * Sets the step value
 * @param < W > the widget type
 * @param step the step value
 * @return this, for chaining
 */
@SuppressWarnings("String_Node_Str") public <W extends AbstractSlider<T>>W setStep(Integer step){
  this.options.set("String_Node_Str",step);
  return (W)this;
}

Fixed version (ground truth):
/** 
 * Sets the step value
 * @param < W > the widget type
 * @param step the step value
 * @return this, for chaining
 */
public AbstractSlider<T> setStep(Integer step){
  this.options.set("String_Node_Str",step);
  return this;
}
Program: 186437
Project: 186437
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public <W extends AbstractSlider<RangeValue>>W setRangeValidator(RangeValidator<Integer> validator){
  this.rangeValidator=validator;
  return (W)this;
}

Fixed version (ground truth):
@Override public AbstractSlider<RangeValue> setRangeValidator(RangeValidator<Integer> validator){
  this.rangeValidator=validator;
  return this;
}
Program: 186438
Project: 186438
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public <W extends AbstractSlider<Integer>>W setRangeValidator(RangeValidator<Integer> validator){
  this.rangeValidator=validator;
  return (W)this;
}

Fixed version (ground truth):
@Override public Slider setRangeValidator(RangeValidator<Integer> validator){
  this.rangeValidator=validator;
  return this;
}
Program: 186439
Project: 186439
Buggy source:
/** 
 * Gets the CSS class to be applied on the button<br/> <b>Caution:</b>   {@code super.getCSSClass()} should be called when overridden
 * @return the CSS class
 */
public String getCSSClass(){
  return this.isEnabled() ? "String_Node_Str" : "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets the CSS class to be applied on the button<br> <b>Caution:</b>   {@code super.getCSSClass()} should be called when overridden
 * @return the CSS class
 */
public String getCSSClass(){
  return this.isEnabled() ? "String_Node_Str" : "String_Node_Str";
}
Program: 186440
Project: 186440
Buggy source:
/** 
 * Constructor
 * @param name the button's name
 * @param text the button's text
 * @param property the property used to retrieve the row's object value
 */
public SecuredCommandButton(String name,IModel<String> text,String property,String[] roles,IJQuerySecurityProvider provider){
  super(name,text,property);
  this.roles=roles;
  this.provider=provider;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param name the button's name
 * @param text the button's text
 * @param property the property used to retrieve the row's object value
 * @param roles list of roles allowed to enable the button
 * @param provider the {@link IJQuerySecurityProvider}
 */
public SecuredCommandButton(String name,IModel<String> text,String property,String[] roles,IJQuerySecurityProvider provider){
  super(name,text,property);
  this.roles=roles;
  this.provider=provider;
}
Program: 186441
Project: 186441
Buggy source:
/** 
 * Gets a new   {@link JQueryAjaxBehavior} that will be wired to the 'eventResize' event, triggered when the user resizes an event
 * @param source the {@link IJQueryAjaxAware}
 * @return a new {@code OnEventResizeAjaxBehavior} by default
 */
protected JQueryAjaxBehavior newOnEventResizeAjaxBehavior(IJQueryAjaxAware source,CharSequence precondition){
  return new OnEventResizeAjaxBehavior(source,precondition);
}

Fixed version (ground truth):
/** 
 * Gets a new   {@link JQueryAjaxBehavior} that will be wired to the 'eventResize' event, triggered when the user resizes an event
 * @param source the {@link IJQueryAjaxAware}
 * @param precondition the JavaScript precondition
 * @return a new {@code OnEventResizeAjaxBehavior} by default
 */
protected JQueryAjaxBehavior newOnEventResizeAjaxBehavior(IJQueryAjaxAware source,CharSequence precondition){
  return new OnEventResizeAjaxBehavior(source,precondition);
}
Program: 186442
Project: 186442
Buggy source:
/** 
 * Gets a new   {@link JQueryAjaxBehavior} that will be wired to the 'eventDrop' event, triggered when the user moves (drag & drop) an event
 * @param source the {@link IJQueryAjaxAware}
 * @return a new {@code OnEventDropAjaxBehavior} by default
 */
protected JQueryAjaxBehavior newOnEventDropAjaxBehavior(IJQueryAjaxAware source,CharSequence precondition){
  return new OnEventDropAjaxBehavior(source,precondition);
}

Fixed version (ground truth):
/** 
 * Gets a new   {@link JQueryAjaxBehavior} that will be wired to the 'eventDrop' event, triggered when the user moves (drag &#38; drop) an event
 * @param source the {@link IJQueryAjaxAware}
 * @param precondition the JavaScript precondition
 * @return a new {@code OnEventDropAjaxBehavior} by default
 */
protected JQueryAjaxBehavior newOnEventDropAjaxBehavior(IJQueryAjaxAware source,CharSequence precondition){
  return new OnEventDropAjaxBehavior(source,precondition);
}
Program: 186443
Project: 186443
Buggy source:
/** 
 * Visitor accept method
 * @param visitor
 */
public final void accept(ICalendarVisitor visitor){
  visitor.visit(this);
}

Fixed version (ground truth):
/** 
 * Visitor accept method
 * @param visitor the {@link ICalendarVisitor}
 */
public final void accept(ICalendarVisitor visitor){
  visitor.visit(this);
}
Program: 186444
Project: 186444
Buggy source:
/** 
 * Indicates whether the   {@link #onViewRender(AjaxRequestTarget,CalendarView,LocalDateTime,LocalDateTime)} event will be triggered
 * @return false by default
 */
boolean isViewRenderEnabled();

Fixed version (ground truth):
/** 
 * Indicates whether the   {@link #onViewRender(AjaxRequestTarget,CalendarView,LocalDate,LocalDate)} event will be triggered
 * @return false by default
 */
boolean isViewRenderEnabled();
Program: 186445
Project: 186445
Buggy source:
/** 
 * Gets a behavior option, referenced by its key
 * @param key the option key
 * @return null if the key does not exists
 */
public <T>T getOption(String key){
  return this.options.get(key);
}

Fixed version (ground truth):
/** 
 * Gets a behavior option, referenced by its key
 * @param < T > the object type
 * @param key the option key
 * @return {@code null} if the key does not exists
 */
public <T>T getOption(String key){
  return this.options.get(key);
}
Program: 186446
Project: 186446
Buggy source:
/** 
 * In addition to   {@link #set(String,Object)} this enables to build trees of Options.<p> Example: <pre> Options o = new Options(); o.set("foo", new Options("foo1", "value1"), new Options("foo2", Options.asString("value2"))); results in json: { "foo": [ { "foo1": value1 }, { "foo2": "value2" } ] } </pre> </p>
 * @param key - key with which the specified value is to be associated
 * @param values - values to be associated with the specified key
 * @return this, for chaining
 */
public final Options set(String key,List<?> values){
  return this.set(key,values.toString());
}

Fixed version (ground truth):
/** 
 * In addition to   {@link #set(String,Object)} this enables to build trees of Options.<br><br> Example: <pre><code> Options o = new Options(); o.set("foo", new Options("foo1", "value1"), new Options("foo2", Options.asString("value2"))); results in json: { "foo": [ { "foo1": value1 }, { "foo2": "value2" } ] } </code></pre>
 * @param key - key with which the specified value is to be associated
 * @param values - values to be associated with the specified key
 * @return this, for chaining
 */
public final Options set(String key,List<?> values){
  return this.set(key,values.toString());
}
Program: 186447
Project: 186447
Buggy source:
/** 
 * Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
 * @param key the key whose associated value is to be returned
 * @return the value to which the specified key is mapped, or null if this map contains no mapping for the key
 */
@SuppressWarnings("String_Node_Str") public <T extends Object>T get(String key){
  Object value=this.map.get(key);
  if (value != null) {
    return (T)value;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
 * @param < T > the object type
 * @param key the key whose associated value is to be returned
 * @return the value to which the specified key is mapped, or null if this map contains no mapping for the key
 */
@SuppressWarnings("String_Node_Str") public <T extends Object>T get(String key){
  Object value=this.map.get(key);
  if (value != null) {
    return (T)value;
  }
  return null;
}
Program: 186448
Project: 186448
Buggy source:
/** 
 * Renders the object. This typically returns a JSON body (without brackets)
 */
String render(T object);

Fixed version (ground truth):
/** 
 * Renders the object. This typically returns a JSON body (without brackets)
 * @param object the object to render
 * @return the rendered object
 */
String render(T object);
Program: 186449
Project: 186449
Buggy source:
/** 
 * Constructor
 * @param scope the scope
 * @param the function, i.e.: the name of the '.js' file without the extension
 * @param variables the variable {@code Map} to supply to the file
 */
public JavaScriptPackageHeaderItem(Class<?> scope,String function,Map<String,Object> variables){
  super(new TextTemplateResourceReference(scope,function + "String_Node_Str",Model.ofMap(variables)),null,function,false,null,null);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param scope the scope
 * @param function the function, i.e.: the name of the '.js' file without the extension
 * @param variables the variable {@code Map} to supply to the file
 */
public JavaScriptPackageHeaderItem(Class<?> scope,String function,Map<String,Object> variables){
  super(new TextTemplateResourceReference(scope,function + "String_Node_Str",Model.ofMap(variables)),null,function,false,null,null);
}
Program: 186450
Project: 186450
Buggy source:
/** 
 * Converts the object to its string representation using the appropriate converter, if defined.
 * @param object the object
 * @return the string representation using the appropriate converter, if defined. #toString() otherwise.
 */
public static <T>String toString(T object){
  String value=null;
  @SuppressWarnings("String_Node_Str") IConverter<T> converter=(IConverter<T>)Application.get().getConverterLocator().getConverter(object.getClass());
  if (converter != null) {
    value=converter.convertToString(object,Session.get().getLocale());
  }
 else {
    value=object.toString();
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Converts the object to its string representation using the appropriate converter, if defined.
 * @param < T > the object type
 * @param object the object
 * @return the string representation using the appropriate converter, if defined. #toString() otherwise.
 */
public static <T>String toString(T object){
  String value=null;
  @SuppressWarnings("String_Node_Str") IConverter<T> converter=(IConverter<T>)Application.get().getConverterLocator().getConverter(object.getClass());
  if (converter != null) {
    value=converter.convertToString(object,Session.get().getLocale());
  }
 else {
    value=object.toString();
  }
  return value;
}
Program: 186451
Project: 186451
Buggy source:
/** 
 * Gets the current timezone offset
 * @param time
 * @return the timezone offset
 * @see TimeZone#getRawOffset()
 */
public static long offset(long time){
  return TimeZone.getDefault().getOffset(time);
}

Fixed version (ground truth):
/** 
 * Gets the current timezone offset
 * @param time the timestamp
 * @return the timezone offset
 * @see TimeZone#getRawOffset()
 */
public static long offset(long time){
  return TimeZone.getDefault().getOffset(time);
}
Program: 186452
Project: 186452
Buggy source:
/** 
 * Converts a ISO8601 string date to an   {@code UTC} {@link Date}
 * @param date the date to convert
 * @return the UTC date
 * @throws ParseException
 */
public static long utc(String date) throws ParseException {
  return DateUtils.utc(DateUtils.parse(date).getTime());
}

Fixed version (ground truth):
/** 
 * Converts a ISO8601 string date to an   {@code UTC} {@link Date}
 * @param date the date to convert
 * @return the UTC date
 * @throws ParseException if the string cannot be parsed
 */
public static long utc(String date) throws ParseException {
  return DateUtils.utc(DateUtils.parse(date).getTime());
}
Program: 186453
Project: 186453
Buggy source:
/** 
 * Converts a ISO8601 string date (without timezone) to a   {@link Date}
 * @param date ISO8601 string date
 * @return the {@code Date}
 * @throws ParseException
 */
public static Date parse(String date) throws ParseException {
  return new SimpleDateFormat(ISO8601).parse(date);
}

Fixed version (ground truth):
/** 
 * Converts a ISO8601 string date (without timezone) to a   {@link Date}
 * @param date ISO8601 string date
 * @return the {@code Date}
 * @throws ParseException if the string cannot be parsed
 */
public static Date parse(String date) throws ParseException {
  return new SimpleDateFormat(ISO8601).parse(date);
}
Program: 186454
Project: 186454
Buggy source:
/** 
 * Gets the statement that detaches the element matching the current selector from the DOM.<br> The   {@code #detach} method is the same as {@code #remove}, except that   {@code #detach} keeps all jQuery data associated with the removed elements.<br>This method is useful when removed elements are to be reinserted into the DOM at a later time.
 * @param selector the jQuery selector
 * @return the statement
 * @see #remove(AjaxRequestTarget)
 */
public static String detach(String selector){
  return String.format("String_Node_Str",selector);
}

Fixed version (ground truth):
/** 
 * Gets the statement that detaches the element matching the current selector from the DOM.<br> The   {@code #detach} method is the same as {@code #remove}, except that   {@code #detach} keeps all jQuery data associated with the removed elements.<br>This method is useful when removed elements are to be reinserted into the DOM at a later time.
 * @param selector the jQuery selector
 * @return the statement
 * @see #remove(String)
 */
public static String detach(String selector){
  return String.format("String_Node_Str",selector);
}
Program: 186455
Project: 186455
Buggy source:
/** 
 * Gets the statement that removes the element matching the current selector from the DOM.<br> Use   {@code #remove} when you want to remove the element itself, as well as everything inside it.<br>In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.<br> To remove the elements without removing data and events, use  {@code #detach} instead.
 * @param selector the jQuery selector
 * @return the statement
 * @see #detach(AjaxRequestTarget)
 */
public static String remove(String selector){
  return String.format("String_Node_Str",selector);
}

Fixed version (ground truth):
/** 
 * Gets the statement that removes the element matching the current selector from the DOM.<br> Use   {@code #remove} when you want to remove the element itself, as well as everything inside it.<br>In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.<br> To remove the elements without removing data and events, use  {@code #detach} instead.
 * @param selector the jQuery selector
 * @return the statement
 * @see #detach(String)
 */
public static String remove(String selector){
  return String.format("String_Node_Str",selector);
}
Program: 186456
Project: 186456
Buggy source:
/** 
 * Gets the list-item matching the given hash against the list
 * @param hash the hashcode to match
 * @param list the {@link List} to search in
 * @return the list-item or {@code null} if not found
 */
public static synchronized <T>T fromHash(int hash,List<T> list){
  int index=ListUtils.indexOf(hash,list);
  if (index > -1) {
    return list.get(index);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the list-item matching the given hash against the list
 * @param < T > the object type
 * @param hash the hashcode to match
 * @param list the {@link List} to search in
 * @return the list-item or {@code null} if not found
 */
public static synchronized <T>T fromHash(int hash,List<T> list){
  int index=ListUtils.indexOf(hash,list);
  if (index > -1) {
    return list.get(index);
  }
  return null;
}
Program: 186457
Project: 186457
Buggy source:
/** 
 * Utility method to move a list-item at a new position in the specified list<br> This method will use the hashcode of the list-item to retrieve it against the list.
 * @param list the {@link List}
 * @param item the item
 * @param index the position to move to
 */
public static synchronized <T>void move(final T item,int index,final List<T> list){
  if (index < list.size()) {
    list.add(index,list.remove(ListUtils.indexOf(item.hashCode(),list)));
  }
}

Fixed version (ground truth):
/** 
 * Utility method to move a list-item at a new position in the specified list<br> This method will use the hashcode of the list-item to retrieve it against the list.
 * @param < T > the object type
 * @param list the {@link List}
 * @param item the item
 * @param index the position to move to
 */
public static synchronized <T>void move(final T item,int index,final List<T> list){
  if (index < list.size()) {
    list.add(index,list.remove(ListUtils.indexOf(item.hashCode(),list)));
  }
}