nus-yam/ex-repair huggingface dataset:
Program: 153563
Project: 153563
Buggy source:
boolean await(long timeout,TimeUnit unit) throws InterruptedException ;

Fixed version (ground truth):
void await() throws InterruptedException ;
Program: 153564
Project: 153564
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  ChannelPipeline pipeline=e.getChannel().getPipeline();
  try {
    Object receive=e.getMessage();
    if (LOG.isDebugEnabled()) {
      LOG.debug(Markers.DETAIL,Messages.Receive,n,receive);
    }
    if (handler.handle(receive)) {
      pipeline.remove(name);
      CompletionSupport.this.progress.decrementAndGet();
    }
    e.getFuture().addListener(CompletionSupport.this);
  }
 catch (  Exception ex) {
    pipeline.remove(name);
    throw ex;
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  try {
    Object receive=e.getMessage();
    if (LOG.isDebugEnabled()) {
      LOG.debug(Markers.DETAIL,Messages.Receive,this.name,receive);
    }
    if (this.handler.handle(receive)) {
      this.future.setSuccess();
      CompletionSupport.this.inProgress.remove(this.name);
      invokeNext();
    }
    e.getFuture().addListener(CompletionSupport.this);
  }
 catch (  Exception ex) {
    LOG.error(ex.getMessage(),ex);
    this.future.setFailure(ex);
    invokeNext();
    throw ex;
  }
}
Program: 153565
Project: 153565
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,final ExceptionEvent e) throws Exception {
  this.users.onError(new AbstractRiakResponse(){
    @Override public String getMessage(){
      return e.getCause().getMessage();
    }
    @Override public void operationComplete(){
      complete();
    }
  }
);
  LOG.error(e.getCause().getMessage(),e.getCause());
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,final ExceptionEvent e) throws Exception {
  CompletionSupport.this.inProgress.remove(this.name);
  this.future.setFailure(e.getCause());
  LOG.error(e.getCause().getMessage(),e.getCause());
  this.users.onError(new AbstractRiakResponse(){
    @Override public String getMessage(){
      return e.getCause().getMessage();
    }
    @Override public void operationComplete(){
      complete();
    }
  }
);
  invokeNext();
}
Program: 153566
Project: 153566
Buggy source:
public <T>RiakFuture handle(final String n,Object send,final RiakResponseHandler<T> users,final NettyUtil.MessageHandler handler){
  if (LOG.isDebugEnabled()) {
    LOG.debug(Messages.SendTo,n,this.channel.getRemoteAddress());
  }
  int prog=this.progress.incrementAndGet();
  final String name=n + prog;
  ChannelPipeline pipeline=this.channel.getPipeline();
  pipeline.addLast(name,new UpstreamHandler<T>(users){
    @Override public void messageReceived(    ChannelHandlerContext ctx,    MessageEvent e) throws Exception {
      ChannelPipeline pipeline=e.getChannel().getPipeline();
      try {
        Object receive=e.getMessage();
        if (LOG.isDebugEnabled()) {
          LOG.debug(Markers.DETAIL,Messages.Receive,n,receive);
        }
        if (handler.handle(receive)) {
          pipeline.remove(name);
          CompletionSupport.this.progress.decrementAndGet();
        }
        e.getFuture().addListener(CompletionSupport.this);
      }
 catch (      Exception ex) {
        pipeline.remove(name);
        throw ex;
      }
    }
  }
);
  try {
    ChannelFuture cf=this.channel.write(send);
    return new NettyUtil.FutureAdapter(cf);
  }
 catch (  Exception e) {
    pipeline.remove(name);
    complete();
    this.channel.close();
    throw new RiakException(e);
  }
}

Fixed version (ground truth):
public <T>RiakFuture handle(String name,Object send,final RiakResponseHandler<T> users,final NettyUtil.MessageHandler handler){
  if (LOG.isDebugEnabled()) {
    LOG.debug(Messages.SendTo,name,this.channel.getRemoteAddress());
  }
  ChannelPipeline pipeline=this.channel.getPipeline();
  CountDownRiakFuture future=new CountDownRiakFuture(name,pipeline);
  Command cmd=new Command(this.channel,send,name,new UpstreamHandler<T>(name,users,handler,future));
  try {
    if (this.inProgress.add(cmd.name)) {
      cmd.execute();
    }
 else {
      this.waitQueue.add(cmd);
    }
    return future;
  }
 catch (  Exception e) {
    pipeline.remove(name);
    complete();
    this.channel.close();
    throw new RiakException(e);
  }
}
Program: 153567
Project: 153567
Buggy source:
public UpstreamHandler(RiakResponseHandler<T> users){
  this.users=users;
}

Fixed version (ground truth):
public UpstreamHandler(String name,RiakResponseHandler<T> users,NettyUtil.MessageHandler handler,CountDownRiakFuture future){
  this.name=name;
  this.users=users;
  this.handler=handler;
  this.future=future;
}
Program: 153568
Project: 153568
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  try {
    Object receive=e.getMessage();
    if (LOG.isDebugEnabled()) {
      LOG.debug(Markers.DETAIL,Messages.Receive,this.name,receive);
    }
    if (this.handler.handle(receive)) {
      this.future.setSuccess();
      this.support.remove(this.name);
      this.support.invokeNext();
    }
    e.getFuture().addListener(this.support);
  }
 catch (  Exception ex) {
    setFailure(ex);
    throw ex;
  }
catch (  Error ex) {
    setFailure(ex);
    throw ex;
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  try {
    Object receive=e.getMessage();
    if (LOG.isDebugEnabled()) {
      LOG.debug(Markers.DETAIL,Messages.Receive,this.name,receive);
    }
    if (this.handler.handle(receive)) {
      this.future.setSuccess();
      this.support.remove(this.name);
      this.support.invokeNext();
    }
    e.getFuture().addListener(this.support);
  }
 catch (  Exception ex) {
    throw ex;
  }
catch (  Error ex) {
    setFailure(ex);
    throw ex;
  }
}
Program: 153570
Project: 153570
Buggy source:
protected void dispatchToGetSibling(Location location,final PutOptions options,SiblingHandler handler){
  get(location,new GetOptions(){
    @Override public Quorum getReadQuorum(){
      return options.getReadQuorum();
    }
    @Override public String getIfNoneMatch(){
      return options.getIfNoneMatch();
    }
    @Override public String getIfMatch(){
      return options.getIfMatch();
    }
    @Override public Date getIfModifiedSince(){
      return options.getIfModifiedSince();
    }
  }
,handler);
}

Fixed version (ground truth):
protected void dispatchToGetSibling(final Location location,final PutOptions options,final SiblingHandler handler,final CountDownRiakFuture future){
  LOG.debug(Markers.DETAIL,"String_Node_Str");
  GetOptions go=new GetOptions(){
    @Override public Quorum getReadQuorum(){
      return options.getReadQuorum();
    }
    @Override public String getIfNoneMatch(){
      return options.getIfNoneMatch();
    }
    @Override public String getIfMatch(){
      return options.getIfMatch();
    }
    @Override public Date getIfModifiedSince(){
      return options.getIfModifiedSince();
    }
  }
;
  HttpRequest request=this.factory.newGetRequst(location,go);
  request.setHeader(HttpHeaders.Names.ACCEPT,RiakHttpHeaders.MULTI_PART);
  final String procedure="String_Node_Str";
  future.setName(procedure);
  ChannelHandler internal=new AbstractCompletionChannelHandler<RiakObject<byte[]>>(this.support,procedure,handler,future){
    String vclock;
    @Override public void messageReceived(    ChannelHandlerContext ctx,    MessageEvent e) throws Exception {
      Object receive=e.getMessage();
      if (receive instanceof HttpResponse) {
        HttpResponse response=(HttpResponse)receive;
        if (NettyUtil.isError(response.getStatus())) {
          handler.onError(new RestErrorResponse(response,RestRiakOperations.this.support));
          future.finished();
        }
 else {
          this.vclock=response.getHeader(RiakHttpHeaders.VECTOR_CLOCK);
          handler.begin();
        }
      }
 else       if (receive instanceof PartMessage) {
        PartMessage part=(PartMessage)receive;
        boolean done=part.isLast();
        part.setHeader(RiakHttpHeaders.VECTOR_CLOCK,this.vclock);
        if (done) {
          handler.end(RestRiakOperations.this.support.newResponse());
          future.setSuccess();
        }
 else {
          RiakObject<byte[]> ro=RestRiakOperations.this.factory.convert(part,part.getContent(),location);
          handler.handle(RestRiakOperations.this.support.newResponse(ro));
        }
      }
    }
  }
;
  this.support.handle(procedure,request,handler,internal,future);
}
Program: 153571
Project: 153571
Buggy source:
public <T>RiakFuture handle(String name,Object send,RiakResponseHandler<T> users,NettyUtil.MessageHandler handler){
  CountDownRiakFuture future=newRiakFuture(name);
  ChannelHandler ch=new UpstreamHandler<T>(name,users,handler,future);
  return handle(name,send,users,ch,future);
}

Fixed version (ground truth):
public <T>RiakFuture handle(String name,Object send,RiakResponseHandler<T> users,ChannelHandler handler,RiakFuture future){
  if (LOG.isDebugEnabled()) {
    LOG.debug(Messages.SendTo,name,this.channel.getRemoteAddress());
  }
  ChannelPipeline pipeline=this.channel.getPipeline();
  Command cmd=new Command(this.channel,send,name,handler);
  try {
    if (this.inProgress.add(cmd.name)) {
      cmd.execute();
    }
 else {
      this.waitQueue.add(cmd);
    }
    return future;
  }
 catch (  Exception e) {
    complete(name,pipeline);
    throw new RiakException(e);
  }
catch (  Error e) {
    complete(name,pipeline);
    throw e;
  }
}
Program: 153572
Project: 153572
Buggy source:
public CountDownRiakFuture newRiakFuture(String name){
  ChannelPipeline pipeline=this.channel.getPipeline();
  CountDownRiakFuture future=new CountDownRiakFuture(name,pipeline);
  return future;
}

Fixed version (ground truth):
public CountDownRiakFuture newRiakFuture(String name){
  ChannelPipeline pipeline=this.channel.getPipeline();
  return new CountDownRiakFuture(name,pipeline);
}
Program: 153573
Project: 153573
Buggy source:
protected void finished(){
  LOG.debug(Markers.DETAIL,"String_Node_Str",this.name);
  this.pipeline.remove(this.name);
  this.latch.countDown();
}

Fixed version (ground truth):
public void finished(){
  LOG.debug(Markers.DETAIL,"String_Node_Str",this.name);
  this.pipeline.remove(this.name);
  this.latch.countDown();
}
Program: 153574
Project: 153574
Buggy source:
@Override public RiakFuture getStream(String key,Range range,StreamResponseHandler handler){
  notNull(key,"String_Node_Str");
  notNull(range,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  HttpRequest request=buildGetStreamRequest(key);
  request.setHeader(HttpHeaders.Names.RANGE,range.toRangeSpec());
  final String procedure="String_Node_Str";
  return _getStream(procedure,request,handler);
}

Fixed version (ground truth):
@Override public RiakFuture getStream(String key,Range range,StreamResponseHandler handler){
  notNull(key,"String_Node_Str");
  notNull(range,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  HttpRequest request=buildGetStreamRequest(key);
  request.setHeader(HttpHeaders.Names.RANGE,range.toRangeSpec());
  LOG.debug(Markers.BOUNDARY,request.toString());
  final String procedure="String_Node_Str";
  return _getStream(procedure,request,handler);
}
Program: 153575
Project: 153575
Buggy source:
public static Range ranges(final Range... ranges){
  notNull(ranges,"String_Node_Str");
  if (ranges.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  StringBuilder stb=new StringBuilder();
  stb.append(BytesUnit);
  for (int i=0, l=ranges.length; i < l; i++) {
    stb.append(ranges[i].toByteRange());
    if (i + 1 < l) {
      stb.append(',');
    }
  }
  final String s=stb.toString();
  return new Range(null,null){
    @Override public String toString(){
      return s;
    }
  }
;
}

Fixed version (ground truth):
public static Range ranges(final Range... ranges){
  notNull(ranges,"String_Node_Str");
  if (ranges.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  StringBuilder stb=new StringBuilder();
  stb.append(BytesUnit);
  for (int i=0, l=ranges.length; i < l; i++) {
    stb.append(ranges[i].toByteRange());
    if (i + 1 < l) {
      stb.append(',');
    }
  }
  final String s=stb.toString();
  return new Range(null,null){
    @Override public String toRangeSpec(){
      return s;
    }
  }
;
}
Program: 153576
Project: 153576
Buggy source:
private void readHeaders(ChannelBuffer buffer,DefaultPartMessage message){
  String line=readLine(buffer);
  String name=null;
  String value=null;
  do {
    char firstChar=line.charAt(0);
    if (name != null && (firstChar == ' ' || firstChar == '\t')) {
      value=value + ' ' + line.trim();
    }
 else {
      if (name != null) {
        message.addHeader(name,value);
      }
      String[] header=splitHeader(line);
      name=header[0];
      value=header[1];
    }
    line=readLine(buffer);
  }
 while (line.isEmpty() == false && buffer.readable());
  if (name != null) {
    message.addHeader(name,value);
  }
}

Fixed version (ground truth):
private void readHeaders(ChannelBuffer buffer,DefaultPartMessage message){
  String line=readLine(buffer);
  String name=null;
  String value=null;
  do {
    char firstChar=line.charAt(0);
    if (name != null && (firstChar == ' ' || firstChar == '\t')) {
      value=value + ' ' + line.trim();
    }
 else {
      if (name != null) {
        message.addHeader(name,value);
      }
      String[] header=splitHeader(line);
      name=header[0];
      value=header[1];
    }
    line=readLine(buffer);
  }
 while (line.isEmpty() == false && buffer.readable());
  if (name != null) {
    message.addHeader(name,value);
  }
  String rangeHeader=message.getHeader(HttpHeaders.Names.CONTENT_RANGE);
  if (StringUtil.isEmpty(rangeHeader)) {
    state=State.READ_CONTENT;
  }
 else {
    ContentRange cr=parseRange(rangeHeader);
    if (cr == null) {
      state=State.READ_CONTENT;
    }
 else {
      this.contentRange=cr;
      state=State.READ_CHUNKD_CONTENT;
    }
  }
}
Program: 153577
Project: 153577
Buggy source:
private State readBoundary(ChannelBuffer buffer){
  String line=readLine(buffer);
  if (this.dashBoundary.equals(line)) {
    return State.READ_HEADERS;
  }
 else   if (line.equals(this.closeBoundary)) {
    return State.EPILOGUE;
  }
  throw new UnknownBoundaryException(line);
}

Fixed version (ground truth):
private State readBoundary(ChannelBuffer buffer){
  String line=readLine(buffer);
  if (this.dashBoundary.equals(line)) {
    return State.READ_HEADERS;
  }
 else   if (line.equals(this.closeBoundary)) {
    return State.EPILOGUE;
  }
  LOG.debug(Markers.DETAIL,line);
  LOG.debug(Markers.DETAIL,this.dashBoundary);
  throw new UnknownBoundaryException(line);
}
Program: 153578
Project: 153578
Buggy source:
public PartMessage parse(ChannelBuffer buffer){
  DefaultPartMessage multipart=new DefaultPartMessage();
  State state=State.SKIP_CONTROL_CHARS;
  for (; ; ) {
switch (state) {
case SKIP_CONTROL_CHARS:
{
        skipControlCharacters(buffer);
        state=State.READ_BOUNDARY;
        break;
      }
case READ_BOUNDARY:
{
      state=readBoundary(buffer);
      break;
    }
case READ_HEADERS:
{
    readHeaders(buffer,multipart);
    state=State.READ_CONTENT;
    break;
  }
case READ_CONTENT:
{
  State[] next=new State[1];
  int length=seekNextBoundary(buffer,next);
  multipart.setContent(buffer.readBytes(length));
  state=next[0];
  return multipart;
}
case EPILOGUE:
{
multipart.setLast(true);
return multipart;
}
default :
{
throw new IllegalStateException("String_Node_Str" + state);
}
}
}
}

Fixed version (ground truth):
public PartMessage parse(ChannelBuffer buffer){
  DefaultPartMessage multipart=new DefaultPartMessage();
  for (; ; ) {
switch (state) {
case SKIP_CONTROL_CHARS:
{
        skipControlCharacters(buffer);
        state=State.READ_BOUNDARY;
        break;
      }
case READ_BOUNDARY:
{
      state=readBoundary(buffer);
      break;
    }
case READ_HEADERS:
{
    readHeaders(buffer,multipart);
    break;
  }
case READ_CHUNKD_CONTENT:
{
  return multipart;
}
case READ_CONTENT:
{
int length=seekNextBoundary(buffer);
multipart.setContent(buffer.readBytes(length));
return multipart;
}
case EPILOGUE:
{
multipart.setLast(true);
state=State.SKIP_CONTROL_CHARS;
return multipart;
}
default :
{
throw new IllegalStateException("String_Node_Str" + state);
}
}
}
}
Program: 153579
Project: 153579
Buggy source:
public boolean setUpBoundary(HttpMessage response){
  String b=getBoundary(response);
  if (b != null) {
    this.dashBoundary="String_Node_Str" + b;
    this.closeBoundary=this.dashBoundary + "String_Node_Str";
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean setUpBoundary(HttpMessage response){
  String b=getBoundary(response);
  if (b != null) {
    this.dashBoundary="String_Node_Str" + b;
    this.closeBoundary=this.dashBoundary + "String_Node_Str";
    state=State.SKIP_CONTROL_CHARS;
    return true;
  }
  return false;
}
Program: 153580
Project: 153580
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object o=e.getMessage();
  if (o instanceof HttpResponse) {
    this.dashBoundary=null;
    this.closeBoundary=null;
    HttpResponse response=(HttpResponse)o;
    if (response.isChunked()) {
      setUpBoundary(response);
    }
 else     if (setUpBoundary(response)) {
      ChannelBuffer buffer=response.getContent().copy();
      response.setContent(ChannelBuffers.EMPTY_BUFFER);
      Channels.fireMessageReceived(ctx,response,e.getRemoteAddress());
      splitMultipart(ctx,e,buffer);
      return;
    }
  }
 else   if (o instanceof HttpChunk) {
    HttpChunk chunk=(HttpChunk)o;
    if (this.dashBoundary != null) {
      if (chunk.isLast()) {
        clearBoudndary();
      }
 else {
        ChannelBuffer buffer=chunk.getContent();
        splitMultipart(ctx,e,buffer);
      }
      return;
    }
  }
  ctx.sendUpstream(e);
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object o=e.getMessage();
  if (o instanceof HttpResponse) {
    this.dashBoundary=null;
    this.closeBoundary=null;
    HttpResponse response=(HttpResponse)o;
    if (response.isChunked()) {
      setUpBoundary(response);
    }
 else     if (setUpBoundary(response)) {
      ChannelBuffer buffer=response.getContent().copy();
      response.setContent(ChannelBuffers.EMPTY_BUFFER);
      Channels.fireMessageReceived(ctx,response,e.getRemoteAddress());
      splitMultipart(ctx,e,buffer);
      return;
    }
  }
 else   if (o instanceof HttpChunk) {
    HttpChunk chunk=(HttpChunk)o;
    if (this.contentRange != null && State.READ_CHUNKD_CONTENT.equals(state)) {
      if (this.contentRange.pass(chunk.getContent())) {
        ctx.sendUpstream(e);
      }
 else {
        this.contentRange=null;
        this.state=State.SKIP_CONTROL_CHARS;
      }
    }
    if (this.dashBoundary != null) {
      if (chunk.isLast()) {
        clearBoudndary();
      }
 else {
        ChannelBuffer buffer=chunk.getContent();
        if (2 < buffer.readableBytes()) {
          splitMultipart(ctx,e,buffer);
        }
      }
      return;
    }
  }
  ctx.sendUpstream(e);
}
Program: 153581
Project: 153581
Buggy source:
protected void splitMultipart(ChannelHandlerContext ctx,MessageEvent e,ChannelBuffer buffer){
  while (buffer.readable()) {
    PartMessage msg=parse(buffer);
    Channels.fireMessageReceived(ctx,msg,e.getRemoteAddress());
  }
}

Fixed version (ground truth):
protected void splitMultipart(ChannelHandlerContext ctx,MessageEvent e,ChannelBuffer buffer){
  while (buffer.readable()) {
    PartMessage msg=parse(buffer);
    Channels.fireMessageReceived(ctx,msg,e.getRemoteAddress());
    if (State.READ_CHUNKD_CONTENT.equals(state)) {
      break;
    }
  }
}
Program: 153582
Project: 153582
Buggy source:
private void skipControlCharacters(ChannelBuffer buffer){
  for (; ; ) {
    char c=(char)buffer.readUnsignedByte();
    if (!Character.isISOControl(c) && !Character.isWhitespace(c)) {
      buffer.readerIndex(buffer.readerIndex() - 1);
      break;
    }
  }
}

Fixed version (ground truth):
private void skipControlCharacters(ChannelBuffer buffer){
  while (buffer.readable()) {
    char c=(char)buffer.readUnsignedByte();
    if (Character.isISOControl(c) == false && Character.isWhitespace(c) == false) {
      buffer.readerIndex(buffer.readerIndex() - 1);
      break;
    }
  }
}
Program: 153583
Project: 153583
Buggy source:
private int seekNextBoundary(ChannelBuffer buffer,State[] next){
  int readerIndex=buffer.readerIndex();
  int length=0;
  String line="String_Node_Str";
  while (buffer.readable()) {
    line=readLine(buffer);
    if (line.isEmpty() && buffer.readable() == false) {
      next[0]=State.EPILOGUE;
      break;
    }
 else     if (this.dashBoundary.equals(line)) {
      length-=this.dashBoundary.length();
      length-=4;
      next[0]=State.READ_BOUNDARY;
      break;
    }
 else     if (this.closeBoundary.equals(line)) {
      length-=this.closeBoundary.length();
      length-=4;
      next[0]=State.READ_BOUNDARY;
      break;
    }
  }
  length+=(buffer.readerIndex() - readerIndex);
  buffer.readerIndex(readerIndex);
  return length;
}

Fixed version (ground truth):
private int seekNextBoundary(ChannelBuffer buffer){
  int readerIndex=buffer.readerIndex();
  int length=0;
  String line="String_Node_Str";
  while (buffer.readable()) {
    line=readLine(buffer);
    if (line.isEmpty() && buffer.readable() == false) {
      state=State.EPILOGUE;
      break;
    }
 else     if (this.dashBoundary.equals(line)) {
      length-=this.dashBoundary.length();
      length-=4;
      state=State.SKIP_CONTROL_CHARS;
      break;
    }
 else     if (this.closeBoundary.equals(line)) {
      length-=this.closeBoundary.length();
      length-=4;
      state=State.SKIP_CONTROL_CHARS;
      break;
    }
  }
  length+=(buffer.readerIndex() - readerIndex);
  if (LOG.isDebugEnabled()) {
    LOG.debug(Markers.DETAIL,"String_Node_Str" + length + "String_Node_Str"+ state);
  }
  buffer.readerIndex(readerIndex);
  return length;
}
Program: 153584
Project: 153584
Buggy source:
@Override public void end() throws Exception {
  System.out.println("String_Node_Str");
  out.close();
  is[0]=true;
  waiter.compareAndSet(false,true);
}

Fixed version (ground truth):
@Override public void end() throws Exception {
  out.close();
  is[0]=true;
  waiter.compareAndSet(false,true);
}
Program: 153585
Project: 153585
Buggy source:
@Test public void testLuwak() throws Exception {
  for (int i=0; i < 1; i++) {
    String key=testPostStream();
    try {
      System.out.println("String_Node_Str");
      Thread.sleep(150);
      testGetStream(key);
    }
  finally {
      System.err.println(i);
    }
  }
}

Fixed version (ground truth):
@Test public void testLuwak() throws Exception {
  for (int i=0; i < 1; i++) {
    String key=testPostStream();
    try {
      System.out.println("String_Node_Str");
      Thread.sleep(150);
      testGetStream(key);
      testGetRangeStream(key);
    }
  finally {
      testDeleteFromLuwak(key);
      System.err.println(i);
    }
  }
}
Program: 153586
Project: 153586
Buggy source:
protected void wait(final AtomicBoolean waiter,final boolean[] is) throws InterruptedException {
  int counter=0;
  while (waiter.get() == false) {
    Thread.sleep(10);
    if (300 < counter++) {
    }
  }
  assertTrue(is[0]);
}

Fixed version (ground truth):
protected void wait(final AtomicBoolean waiter,final boolean[] is) throws InterruptedException {
  int counter=0;
  while (waiter.get() == false) {
    Thread.sleep(10);
    if (300 < counter++) {
      fail("String_Node_Str");
    }
  }
  assertTrue(is[0]);
}
Program: 153587
Project: 153587
Buggy source:
/** 
 * at the beginning of streaming.
 */
void begin() throws Exception ;

Fixed version (ground truth):
/** 
 * at the beginning of streaming.
 */
void begin(RiakObject<_> headers) throws Exception ;
Program: 153588
Project: 153588
Buggy source:
@Override public RiakFuture getStream(String key,Range range,StreamResponseHandler handler){
  return null;
}

Fixed version (ground truth):
@Override public RiakFuture getStream(String key,Range range,StreamResponseHandler handler){
  notNull(key,"String_Node_Str");
  notNull(range,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  HttpRequest request=buildGetStreamRequest(key);
  request.setHeader(HttpHeaders.Names.RANGE,range.toRangeSpec());
  final String procedure="String_Node_Str";
  return _getStream(procedure,request,handler);
}
Program: 153589
Project: 153589
Buggy source:
public String testPostStream() throws Exception {
  final AtomicBoolean waiter=new AtomicBoolean(false);
  final boolean[] is={false};
  URL url=getClass().getClassLoader().getResource(LARGEFILE);
  final File file=new File(url.getFile());
  final String[] key=new String[1];
  RiakObject<InputStreamHandler> ro=new AbstractRiakObject<InputStreamHandler>(){
    @Override public InputStreamHandler getContent(){
      return new InputStreamHandler(){
        @Override public InputStream open() throws IOException {
          return new BufferedInputStream(new FileInputStream(file));
        }
        @Override public long getContentLength(){
          return file.length();
        }
      }
;
    }
  }
;
  ro.setContentType("String_Node_Str");
  target.postStream(ro,new RiakResponseHandler<String>(){
    @Override public void onError(    RiakResponse response) throws Exception {
      waiter.compareAndSet(false,true);
      fail(response.getMessage());
    }
    @Override public void handle(    RiakContentsResponse<String> response) throws Exception {
      try {
        key[0]=response.getContents();
        assertNotNull(key[0]);
        is[0]=true;
      }
  finally {
        waiter.compareAndSet(false,true);
      }
    }
  }
);
  wait(waiter,is);
  return key[0];
}

Fixed version (ground truth):
public String testPostStream() throws Exception {
  final AtomicBoolean waiter=new AtomicBoolean(false);
  final boolean[] is={false};
  URL url=getClass().getClassLoader().getResource(LARGEFILE);
  final File file=new File(url.getFile());
  final String[] key=new String[1];
  RiakObject<InputStreamHandler> ro=new AbstractRiakObject<InputStreamHandler>(){
    @Override public InputStreamHandler getContent(){
      return new InputStreamHandler(){
        @Override public InputStream open() throws IOException {
          return new BufferedInputStream(new FileInputStream(file));
        }
        @Override public long getContentLength(){
          return file.length();
        }
      }
;
    }
  }
;
  ro.setContentType("String_Node_Str");
  Map<String,String> map=new HashMap<String,String>();
  map.put("String_Node_Str","String_Node_Str");
  ro.setUserMetadata(map);
  List<Link> links=new ArrayList<Link>();
  links.add(new Link(new Location("String_Node_Str","String_Node_Str"),"String_Node_Str"));
  ro.setLinks(links);
  target.postStream(ro,new RiakResponseHandler<String>(){
    @Override public void onError(    RiakResponse response) throws Exception {
      waiter.compareAndSet(false,true);
      fail(response.getMessage());
    }
    @Override public void handle(    RiakContentsResponse<String> response) throws Exception {
      try {
        key[0]=response.getContents();
        assertNotNull(key[0]);
        is[0]=true;
      }
  finally {
        waiter.compareAndSet(false,true);
      }
    }
  }
);
  wait(waiter,is);
  return key[0];
}
Program: 153590
Project: 153590
Buggy source:
public void testGetStream(String key) throws Exception {
  final AtomicBoolean waiter=new AtomicBoolean(false);
  final boolean[] is={false};
  final File download=new File("String_Node_Str");
  if (download.exists()) {
    download.delete();
  }
  target.getStream(key,new StreamResponseHandler(){
    FileOutputStream out;
    @Override public void onError(    RiakResponse response) throws Exception {
      waiter.compareAndSet(false,true);
      fail(response.getMessage());
    }
    @Override public void begin() throws Exception {
      out=new FileOutputStream(download);
    }
    @Override public void handle(    RiakContentsResponse<ChannelBuffer> response) throws Exception {
      System.out.println("String_Node_Str");
      ChannelBuffer buffer=response.getContents();
      out.write(buffer.array());
      out.flush();
    }
    @Override public void end() throws Exception {
      System.out.println("String_Node_Str");
      out.close();
      is[0]=true;
      waiter.compareAndSet(false,true);
    }
  }
);
  wait(waiter,is);
  URL url=getClass().getClassLoader().getResource(LARGEFILE);
  final File file=new File(url.getFile());
  assertEquals("String_Node_Str",file.length(),download.length());
}

Fixed version (ground truth):
public void testGetStream(String key) throws Exception {
  final AtomicBoolean waiter=new AtomicBoolean(false);
  final boolean[] is={false};
  final File download=new File("String_Node_Str");
  if (download.exists()) {
    download.delete();
  }
  target.getStream(key,new StreamResponseHandler(){
    FileOutputStream out;
    @Override public void onError(    RiakResponse response) throws Exception {
      waiter.compareAndSet(false,true);
      fail(response.getMessage());
    }
    @Override public void begin(    RiakObject<_> header) throws Exception {
      Map<String,String> map=header.getUserMetadata();
      assertEquals("String_Node_Str",map.get("String_Node_Str"));
      out=new FileOutputStream(download);
    }
    @Override public void handle(    RiakContentsResponse<ChannelBuffer> response) throws Exception {
      System.out.println("String_Node_Str");
      ChannelBuffer buffer=response.getContents();
      out.write(buffer.array());
      out.flush();
    }
    @Override public void end() throws Exception {
      System.out.println("String_Node_Str");
      out.close();
      is[0]=true;
      waiter.compareAndSet(false,true);
    }
  }
);
  wait(waiter,is);
  URL url=getClass().getClassLoader().getResource(LARGEFILE);
  final File file=new File(url.getFile());
  assertEquals("String_Node_Str",file.length(),download.length());
}
Program: 153591
Project: 153591
Buggy source:
public void testDeleteAllFromLuwak() throws Exception {
  final AtomicBoolean waiter=new AtomicBoolean(false);
  final boolean[] is={true};
  final List<String> list=new ArrayList<String>();
  target.listKeys("String_Node_Str",new RiakResponseHandler<KeyResponse>(){
    @Override public void onError(    RiakResponse response) throws Exception {
      System.err.println(response.getMessage());
      waiter.compareAndSet(false,true);
    }
    @Override public void handle(    RiakContentsResponse<KeyResponse> response) throws Exception {
      KeyResponse keys=response.getContents();
      for (      String s : keys.getKeys()) {
        list.add(s);
      }
      if (keys.getDone()) {
        waiter.compareAndSet(false,true);
      }
    }
  }
);
  wait(waiter,is);
  for (  String s : list) {
    testDeleteFromLuwak(s);
  }
}

Fixed version (ground truth):
@Test public void testDeleteAllFromLuwak() throws Exception {
  final AtomicBoolean waiter=new AtomicBoolean(false);
  final boolean[] is={true};
  final List<String> list=new ArrayList<String>();
  target.listKeys("String_Node_Str",new RiakResponseHandler<KeyResponse>(){
    @Override public void onError(    RiakResponse response) throws Exception {
      System.err.println(response.getMessage());
      waiter.compareAndSet(false,true);
    }
    @Override public void handle(    RiakContentsResponse<KeyResponse> response) throws Exception {
      KeyResponse keys=response.getContents();
      for (      String s : keys.getKeys()) {
        list.add(s);
      }
      if (keys.getDone()) {
        waiter.compareAndSet(false,true);
      }
    }
  }
);
  wait(waiter,is);
  for (  String s : list) {
    testDeleteFromLuwak(s);
  }
}
Program: 153592
Project: 153592
Buggy source:
@Test public void testLuwak() throws Exception {
  for (int i=0; i < 10; i++) {
    String key=testPostStream();
    try {
      System.out.println("String_Node_Str");
      Thread.sleep(150);
      testGetStream(key);
    }
  finally {
      testDeleteFromLuwak(key);
      System.err.println(i);
    }
  }
}

Fixed version (ground truth):
@Test public void testLuwak() throws Exception {
  for (int i=0; i < 1; i++) {
    String key=testPostStream();
    try {
      System.out.println("String_Node_Str");
      Thread.sleep(150);
      testGetStream(key);
    }
  finally {
      System.err.println(i);
    }
  }
}
Program: 153593
Project: 153593
Buggy source:
@Override public void begin() throws Exception {
  out=new FileOutputStream(download);
}

Fixed version (ground truth):
@Override public void begin(RiakObject<_> header) throws Exception {
  Map<String,String> map=header.getUserMetadata();
  assertEquals("String_Node_Str",map.get("String_Node_Str"));
  out=new FileOutputStream(download);
}
Program: 153594
Project: 153594
Buggy source:
private void start(){
  try {
    TServerSocket serverTransport=new TServerSocket(10289);
    MaryJane.Processor processor=new MaryJane.Processor(new MaryJaneServerImpl(writer));
    Factory protFactory=new TBinaryProtocol.Factory(true,true);
    TServer server=new TThreadPoolServer(processor,serverTransport,protFactory);
    log.info("String_Node_Str");
    server.serve();
  }
 catch (  TTransportException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void start(){
  try {
    TServerSocket serverTransport=new TServerSocket(port);
    MaryJane.Processor processor=new MaryJane.Processor(new MaryJaneServerImpl(writer));
    Factory protFactory=new TBinaryProtocol.Factory(true,true);
    TServer server=new TThreadPoolServer(processor,serverTransport,protFactory);
    log.info("String_Node_Str" + port);
    server.serve();
  }
 catch (  TTransportException e) {
    e.printStackTrace();
  }
}
Program: 153595
Project: 153595
Buggy source:
public StreamHandler(String myName,FileUploader myUploader,String myPrefix,boolean compress,File localDir,boolean noBuffer,RemoteLocation myRemoteLocation) throws IOException {
  name=myName;
  uploader=myUploader;
  namePrefix=myPrefix;
  useCompression=compress;
  noMemoryBuffer=noBuffer;
  remoteLocation=myRemoteLocation;
  if (!localDir.exists())   throw new IOException("String_Node_Str" + localDir + "String_Node_Str");
  localPath=new File(localDir,namePrefix);
  localPath.mkdirs();
  localDataPath=new File(localPath,"String_Node_Str");
  localDataPath.mkdirs();
  localStagingPath=new File(localPath,"String_Node_Str");
  localStagingPath.mkdirs();
  newBufferFile();
}

Fixed version (ground truth):
public StreamHandler(String myName,FileUploader myUploader,String myPrefix,boolean compress,File localDir,boolean noBuffer,RemoteLocation myRemoteLocation) throws IOException {
  name=myName;
  uploader=myUploader;
  namePrefix=myPrefix;
  useCompression=compress;
  noMemoryBuffer=noBuffer;
  remoteLocation=myRemoteLocation;
  if (!localDir.exists())   throw new IOException("String_Node_Str" + localDir + "String_Node_Str");
  localPath=new File(localDir,myName);
  localPath.mkdirs();
  localDataPath=new File(localPath,"String_Node_Str");
  localDataPath.mkdirs();
  localStagingPath=new File(localPath,"String_Node_Str");
  localStagingPath.mkdirs();
  newBufferFile();
}
Program: 153596
Project: 153596
Buggy source:
void stop(){
  if (userCache != null)   userCache.removeAll();
  if (groupCache != null)   groupCache.removeAll();
}

Fixed version (ground truth):
void stop(){
  if (userCache != null) {
    userCache.removeAll();
  }
  if (groupCache != null) {
    groupCache.removeAll();
  }
}
Program: 153597
Project: 153597
Buggy source:
@Override protected Map<String,Principal> getMembersMap(){
  if (mMembers == null) {
    mMembers=new ConcurrentHashMap<String,Principal>(myProvider.getGroupMembers(getGroupname(),isDynamic()));
    preloadedGroups=true;
  }
  return mMembers;
}

Fixed version (ground truth):
@Override protected Set<Principal> getMembersMap(){
  if (mMembers == null) {
    mMembers=new HashSet<Principal>(myProvider.getGroupMembers(getGroupname(),isDynamic()).values());
    preloadedGroups=true;
  }
  return mMembers;
}
Program: 153598
Project: 153598
Buggy source:
/** 
 * @throws JahiaException This class need to access the Services Registry and the DB PoolService. If any of this services can't be accessed, a JahiaException is thrown.
 * @param siteID The site id
 * @param dynamic
 */
protected JahiaLDAPGroup(int id,String groupname,String groupKey,int siteID,Map<String,Principal> members,Properties properties,boolean dynamic,boolean preloadedGroups,JahiaGroupManagerLDAPProvider provider) throws JahiaException {
  ServicesRegistry registry=ServicesRegistry.getInstance();
  if (registry == null) {
    throw new JahiaException("String_Node_Str","String_Node_Str",JahiaException.SERVICE_ERROR,JahiaException.CRITICAL_SEVERITY);
  }
  mID=id;
  mGroupname=groupname;
  mGroupKey="String_Node_Str" + provider.getKey() + "String_Node_Str"+ groupKey;
  mSiteID=siteID;
  if (preloadedGroups || members != null && members.size() > 0) {
    mMembers=members != null ? (members instanceof ConcurrentHashMap ? members : new ConcurrentHashMap<String,Principal>(members)) : new ConcurrentHashMap<String,Principal>();
  }
  if (properties != null) {
    mProperties=properties;
  }
  this.dynamic=dynamic;
  this.preloadedGroups=preloadedGroups;
  this.myProvider=provider;
}

Fixed version (ground truth):
/** 
 * @throws JahiaException This class need to access the Services Registry and the DB PoolService. If any of this services can't be accessed, a JahiaException is thrown.
 * @param siteID The site id
 * @param dynamic
 */
protected JahiaLDAPGroup(int id,String groupname,String groupKey,int siteID,Map<String,Principal> members,Properties properties,boolean dynamic,boolean preloadedGroups,JahiaGroupManagerLDAPProvider provider) throws JahiaException {
  ServicesRegistry registry=ServicesRegistry.getInstance();
  if (registry == null) {
    throw new JahiaException("String_Node_Str","String_Node_Str",JahiaException.SERVICE_ERROR,JahiaException.CRITICAL_SEVERITY);
  }
  mID=id;
  mGroupname=groupname;
  mGroupKey="String_Node_Str" + provider.getKey() + "String_Node_Str"+ groupKey;
  mSiteID=siteID;
  if (preloadedGroups || members != null && members.size() > 0) {
    mMembers=members != null ? new HashSet<Principal>(members.values()) : new HashSet<Principal>();
  }
  if (properties != null) {
    mProperties=properties;
  }
  this.dynamic=dynamic;
  this.preloadedGroups=preloadedGroups;
  this.myProvider=provider;
}
Program: 153599
Project: 153599
Buggy source:
public String toString(){
  StringBuffer output=new StringBuffer("String_Node_Str" + mGroupname + "String_Node_Str");
  output.append("String_Node_Str" + Integer.toString(mID) + "String_Node_Str");
  output.append("String_Node_Str");
  @SuppressWarnings("String_Node_Str") Iterator<String> names=new EnumerationIterator(mProperties.propertyNames());
  String name;
  if (names.hasNext()) {
    output.append("String_Node_Str");
    while (names.hasNext()) {
      name=(String)names.next();
      output.append("String_Node_Str" + name + "String_Node_Str"+ (String)mProperties.getProperty(name)+ "String_Node_Str");
    }
  }
 else {
    output.append("String_Node_Str");
  }
  output.append("String_Node_Str");
  if (mMembers != null) {
    if (mMembers.size() > 0) {
      for (      String member : mMembers.keySet()) {
        output.append(member + "String_Node_Str");
      }
    }
 else {
      output.append("String_Node_Str");
    }
  }
 else {
    output.append("String_Node_Str");
  }
  return output.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuffer output=new StringBuffer("String_Node_Str" + mGroupname + "String_Node_Str");
  output.append("String_Node_Str" + Integer.toString(mID) + "String_Node_Str");
  output.append("String_Node_Str");
  @SuppressWarnings("String_Node_Str") Iterator<String> names=new EnumerationIterator(mProperties.propertyNames());
  String name;
  if (names.hasNext()) {
    output.append("String_Node_Str");
    while (names.hasNext()) {
      name=(String)names.next();
      output.append("String_Node_Str" + name + "String_Node_Str"+ (String)mProperties.getProperty(name)+ "String_Node_Str");
    }
  }
 else {
    output.append("String_Node_Str");
  }
  output.append("String_Node_Str");
  if (mMembers != null) {
    if (mMembers.size() > 0) {
      for (      Principal member : mMembers) {
        output.append((member != null ? member.getName() : null) + "String_Node_Str");
      }
    }
 else {
      output.append("String_Node_Str");
    }
  }
 else {
    output.append("String_Node_Str");
  }
  return output.toString();
}
Program: 153600
Project: 153600
Buggy source:
public void updateSlides(String chapterName,Chapter chapter){
  index=0;
  this.chapterName=chapterName;
  this.chapter=chapter;
  slidesPanel.clear();
  for (  Presentable presentable : chapter) {
    slidesPanel.add(presentable.asWidget());
  }
}

Fixed version (ground truth):
public void updateSlides(String chapterName,Chapter chapter){
  index=0;
  this.chapterName=chapterName;
  this.chapter=chapter;
  slidesPanel.clear();
  for (  Presentable presentable : chapter) {
    Widget slideWidget=presentable.asWidget();
    slideWidget.setStyleName("String_Node_Str");
    slidesPanel.add(slideWidget);
  }
}
Program: 153601
Project: 153601
Buggy source:
@Override protected void buildSlides(){
  addSlide(GWT.create(Titre.class));
  addSlide(GWT.create(AQuoi.class));
  addSlide(GWT.create(Fonctionnement.class));
  addSlide(GWT.create(Compilation.class));
  addPresentable(new TropSimple());
  addSlide(FormationGwt.PLAN);
}

Fixed version (ground truth):
@Override protected void buildSlides(){
  addSlide(GWT.create(Titre.class));
  addSlide(GWT.create(AQuoi.class));
  addSlide(GWT.create(Fonctionnement.class));
  addSlide(GWT.create(Compilation.class));
  addPresentable(new TropSimple(GWT.<UiBinder<Widget,CodeSlide>>create(TropSimpleBinder.class)));
  addSlide(FormationGwt.PLAN);
}
Program: 153602
Project: 153602
Buggy source:
public TropSimple(){
  initWidget(uiBinder.createAndBindUi(this));
  sourceCode.setText(codeSample.getInnerText());
}

Fixed version (ground truth):
public TropSimple(UiBinder<Widget,CodeSlide> uiBinder){
  super(uiBinder);
}
Program: 153603
Project: 153603
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  BluetoothDevice bd=getItem(position);
  LinearLayout row=new LinearLayout(myContext);
  row.setOrientation(LinearLayout.VERTICAL);
  LinearLayout name_and_icon=new LinearLayout(myContext);
  name_and_icon.setOrientation(LinearLayout.HORIZONTAL);
  TextView friendly_name_tv=new TextView(myContext);
  friendly_name_tv.setText(bd.getFriendlyName());
  friendly_name_tv.setTextSize(TypedValue.COMPLEX_UNIT_MM,12f);
  name_and_icon.addView(friendly_name_tv);
  ImageView saved_img=new ImageView(myContext);
  Bitmap orig=BitmapFactory.decodeResource(myContext.getResources(),android.R.drawable.ic_menu_save);
  saved_img.setImageBitmap(Bitmap.createScaledBitmap(orig,(int)((friendly_name_tv.getTextSize() / orig.getHeight()) * orig.getWidth()),(int)friendly_name_tv.getTextSize(),false));
  if (bd.isSaved())   name_and_icon.addView(saved_img);
  ImageView view_img=new ImageView(myContext);
  orig=BitmapFactory.decodeResource(myContext.getResources(),android.R.drawable.ic_menu_view);
  view_img.setImageBitmap(Bitmap.createScaledBitmap(orig,(int)((friendly_name_tv.getTextSize() / orig.getHeight()) * orig.getWidth()),(int)friendly_name_tv.getTextSize(),false));
  if (bd.getSeenRound() > last_seen_round - 1)   name_and_icon.addView(view_img);
  row.addView(name_and_icon);
  TextView addr_tv=new TextView(myContext);
  addr_tv.setText(bd.getAddr());
  addr_tv.setTextSize(TypedValue.COMPLEX_UNIT_MM,6f);
  row.addView(addr_tv);
  return row;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BluetoothDevice bd=getItem(position);
  LinearLayout row=new LinearLayout(myContext);
  row.setOrientation(LinearLayout.VERTICAL);
  LinearLayout name_and_icon=new LinearLayout(myContext);
  name_and_icon.setOrientation(LinearLayout.HORIZONTAL);
  TextView friendly_name_tv=new TextView(myContext);
  friendly_name_tv.setText(bd.getFriendlyName());
  friendly_name_tv.setTextSize(TypedValue.COMPLEX_UNIT_MM,12f);
  name_and_icon.addView(friendly_name_tv);
  ImageView saved_img=new ImageView(myContext);
  Bitmap orig=BitmapFactory.decodeResource(myContext.getResources(),android.R.drawable.ic_menu_save);
  saved_img.setImageBitmap(Bitmap.createScaledBitmap(orig,(int)((friendly_name_tv.getTextSize() / orig.getHeight()) * orig.getWidth()),(int)friendly_name_tv.getTextSize(),false));
  if (bd.isSaved())   name_and_icon.addView(saved_img);
  ImageView view_img=new ImageView(myContext);
  orig=BitmapFactory.decodeResource(myContext.getResources(),android.R.drawable.ic_menu_view);
  view_img.setImageBitmap(Bitmap.createScaledBitmap(orig,(int)((friendly_name_tv.getTextSize() / orig.getHeight()) * orig.getWidth()),(int)friendly_name_tv.getTextSize(),false));
  if (bd.getSeenRound() > Math.max(last_seen_round - 1,0))   name_and_icon.addView(view_img);
  row.addView(name_and_icon);
  TextView addr_tv=new TextView(myContext);
  addr_tv.setText(bd.getAddr());
  addr_tv.setTextSize(TypedValue.COMPLEX_UNIT_MM,6f);
  row.addView(addr_tv);
  return row;
}
Program: 153608
Project: 153608
Buggy source:
public Boolean doInJCR(JCRSessionWrapper session) throws RepositoryException {
  workflowService.startProcess(from.getNode(session),"String_Node_Str","String_Node_Str",args);
  return true;
}

Fixed version (ground truth):
public Boolean doInJCR(JCRSessionWrapper session) throws RepositoryException {
  workflowService.startProcess(Arrays.asList(from.getNode(session).getIdentifier()),session,"String_Node_Str","String_Node_Str",args,null);
  return true;
}