nus-yam/ex-repair huggingface dataset:
Program: 54490
Project: 54490
Buggy source:
/** 
 * Decide whether, if <code>op</code> is printed followed by <code>arg</code>, there needs to be a space between the operator and expression.
 * @return <code>true</code> if a space needs to be printed
 */
private boolean _spaceCalc(JsOperator op,JsExpression arg){
  if (op.isKeyword()) {
    return true;
  }
  if (arg instanceof JsBinaryOperation) {
    JsBinaryOperation binary=(JsBinaryOperation)arg;
    if (binary.getOperator().getPrecedence() > op.getPrecedence()) {
      return _spaceCalc(op,binary.getArg1());
    }
    return false;
  }
  if (arg instanceof JsPrefixOperation) {
    JsOperator op2=((JsPrefixOperation)arg).getOperator();
    return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG) && (op2 == JsUnaryOperator.DEC || op2 == JsUnaryOperator.NEG) || (op == JsBinaryOperator.ADD && op2 == JsUnaryOperator.INC);
  }
  if (arg instanceof JsNumberLiteral) {
    JsNumberLiteral literal=(JsNumberLiteral)arg;
    return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG) && (literal.getValue() < 0);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Decide whether, if <code>op</code> is printed followed by <code>arg</code>, there needs to be a space between the operator and expression.
 * @return <code>true</code> if a space needs to be printed
 */
private boolean _spaceCalc(JsOperator op,JsExpression arg){
  if (op.isKeyword()) {
    return true;
  }
  if (arg instanceof JsBinaryOperation) {
    JsBinaryOperation binary=(JsBinaryOperation)arg;
    if (binary.getOperator().getPrecedence() > op.getPrecedence()) {
      return _spaceCalc(op,binary.getArg1());
    }
    return false;
  }
  if (arg instanceof JsPrefixOperation) {
    JsOperator op2=((JsPrefixOperation)arg).getOperator();
    return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG) && (op2 == JsUnaryOperator.DEC || op2 == JsUnaryOperator.NEG) || (op == JsBinaryOperator.ADD || op == JsUnaryOperator.POS) && (op2 == JsUnaryOperator.INC || op2 == JsUnaryOperator.POS);
  }
  if (arg instanceof JsNumberLiteral) {
    JsNumberLiteral literal=(JsNumberLiteral)arg;
    return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG) && (literal.getValue() < 0);
  }
  return false;
}
Program: 54491
Project: 54491
Buggy source:
public String getModuleName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getModuleName(){
  return "String_Node_Str";
}
Program: 54492
Project: 54492
Buggy source:
public double getUnitSizeInPixels(Element parent,Unit unit,boolean vertical){
  if (unit == null) {
    return 1;
  }
switch (unit) {
default :
case PX:
    return 1;
case PCT:
  return (vertical ? parent.getClientHeight() : parent.getClientWidth()) / 100.0;
case EM:
return relativeRuler.getOffsetWidth();
case EX:
return relativeRuler.getOffsetHeight();
case CM:
return fixedRuler.getOffsetWidth();
case MM:
return fixedRuler.getOffsetWidth() / 10.0;
case IN:
return fixedRuler.getOffsetWidth() / 2.54;
case PT:
return fixedRuler.getOffsetWidth() / 28.4;
case PC:
return fixedRuler.getOffsetWidth() / 2.36;
}
}

Fixed version (ground truth):
public double getUnitSizeInPixels(Element parent,Unit unit,boolean vertical){
  if (unit == null) {
    return 1;
  }
switch (unit) {
case PCT:
    return (vertical ? parent.getClientHeight() : parent.getClientWidth()) / 100.0;
case EM:
  return relativeRuler.getOffsetWidth();
case EX:
return relativeRuler.getOffsetHeight();
case CM:
return fixedRuler.getOffsetWidth();
case MM:
return fixedRuler.getOffsetWidth() / 10.0;
case IN:
return fixedRuler.getOffsetWidth() / 2.54;
case PT:
return fixedRuler.getOffsetWidth() / 28.4;
case PC:
return fixedRuler.getOffsetWidth() / 2.36;
default :
case PX:
return 1;
}
}
Program: 54493
Project: 54493
Buggy source:
private static String downloadGroup(int splitPoint){
  return "String_Node_Str" + splitPoint;
}

Fixed version (ground truth):
private String downloadGroup(int fragment){
  return (fragment == leftoversFragment()) ? LwmLabels.LEFTOVERS_DOWNLOAD : LwmLabels.downloadGroupForExclusive(fragment);
}
Program: 54494
Project: 54494
Buggy source:
private void logFragmentLoaded(int fragment){
  String logGroup=(fragment == leftoversFragment()) ? LwmLabels.LEFTOVERS_DOWNLOAD : LwmLabels.downloadGroup(fragment);
  logEventProgress(logGroup,LwmLabels.END,fragment,null);
}

Fixed version (ground truth):
private void logFragmentLoaded(int fragment){
  String logGroup=downloadGroup(fragment);
  logEventProgress(logGroup,LwmLabels.END,fragment,null);
}
Program: 54495
Project: 54495
Buggy source:
/** 
 * Start downloading the next fragment in the initial sequence, if there are any left.
 */
private void startLoadingNextInitial(){
  if (remainingInitialFragments == null) {
    remainingInitialFragments=new BoundedIntQueue(initialLoadSequence.length + 1);
    for (    int sp : initialLoadSequence) {
      remainingInitialFragments.add(sp);
    }
    remainingInitialFragments.add(leftoversFragment());
  }
  if (initialFragmentErrorHandlers.isEmpty() && waitingForInitialFragmentsErrorHandlers.isEmpty() && remainingInitialFragments.size() > 1) {
    initialFragmentsLoading=false;
    return;
  }
  if (remainingInitialFragments.size() > 0) {
    initialFragmentsLoading=true;
    int nextSplitPoint=remainingInitialFragments.peek();
    logEventProgress(LwmLabels.downloadGroup(nextSplitPoint),LwmLabels.BEGIN,nextSplitPoint,null);
    startLoadingFragment(nextSplitPoint,new InitialFragmentDownloadFailed());
    return;
  }
  initialFragmentsLoading=false;
  assert(haveInitialFragmentsLoaded());
  assert(waitingForInitialFragments.size() == waitingForInitialFragmentsErrorHandlers.size());
  while (waitingForInitialFragments.size() > 0) {
    startLoadingFragment(waitingForInitialFragments.remove(),waitingForInitialFragmentsErrorHandlers.remove());
  }
}

Fixed version (ground truth):
/** 
 * Start downloading the next fragment in the initial sequence, if there are any left.
 */
private void startLoadingNextInitial(){
  if (remainingInitialFragments == null) {
    remainingInitialFragments=new BoundedIntQueue(initialLoadSequence.length + 1);
    for (    int sp : initialLoadSequence) {
      remainingInitialFragments.add(sp);
    }
    remainingInitialFragments.add(leftoversFragment());
  }
  if (initialFragmentErrorHandlers.isEmpty() && waitingForInitialFragmentsErrorHandlers.isEmpty() && remainingInitialFragments.size() > 1) {
    initialFragmentsLoading=false;
    return;
  }
  if (remainingInitialFragments.size() > 0) {
    initialFragmentsLoading=true;
    int nextSplitPoint=remainingInitialFragments.peek();
    logDownloadStart(nextSplitPoint);
    startLoadingFragment(nextSplitPoint,new InitialFragmentDownloadFailed());
    return;
  }
  initialFragmentsLoading=false;
  assert(haveInitialFragmentsLoaded());
  assert(waitingForInitialFragments.size() == waitingForInitialFragmentsErrorHandlers.size());
  while (waitingForInitialFragments.size() > 0) {
    int nextSplitPoint=waitingForInitialFragments.remove();
    LoadErrorHandler handler=waitingForInitialFragmentsErrorHandlers.remove();
    logDownloadStart(nextSplitPoint);
    startLoadingFragment(nextSplitPoint,handler);
  }
}
Program: 54496
Project: 54496
Buggy source:
/** 
 * Loads the specified split point.
 * @param splitPoint the split point whose code needs to be loaded
 */
public void inject(int splitPoint,LoadErrorHandler loadErrorHandler){
  if (haveInitialFragmentsLoaded()) {
    logEventProgress(LwmLabels.downloadGroup(splitPoint),LwmLabels.BEGIN,splitPoint,null);
    startLoadingFragment(splitPoint,loadErrorHandler);
    return;
  }
  if (isInitial(splitPoint)) {
    initialFragmentErrorHandlers.put(splitPoint,loadErrorHandler);
  }
 else {
    assert(waitingForInitialFragments.size() == waitingForInitialFragmentsErrorHandlers.size());
    waitingForInitialFragments.add(splitPoint);
    waitingForInitialFragmentsErrorHandlers.add(loadErrorHandler);
  }
  if (!initialFragmentsLoading) {
    startLoadingNextInitial();
  }
}

Fixed version (ground truth):
/** 
 * Loads the specified split point.
 * @param splitPoint the split point whose code needs to be loaded
 */
public void inject(int splitPoint,LoadErrorHandler loadErrorHandler){
  if (haveInitialFragmentsLoaded()) {
    logDownloadStart(splitPoint);
    startLoadingFragment(splitPoint,loadErrorHandler);
    return;
  }
  if (isInitial(splitPoint)) {
    initialFragmentErrorHandlers.put(splitPoint,loadErrorHandler);
  }
 else {
    assert(waitingForInitialFragments.size() == waitingForInitialFragmentsErrorHandlers.size());
    waitingForInitialFragments.add(splitPoint);
    waitingForInitialFragmentsErrorHandlers.add(loadErrorHandler);
  }
  if (!initialFragmentsLoading) {
    startLoadingNextInitial();
  }
}
Program: 54497
Project: 54497
Buggy source:
/** 
 * This test catches a case in an earlier version of AsyncFragmentLoader where AsyncFragmentLoader.waitingForInitialFragments could exhaust its available space.
 */
public void testOverflowInWaitingForInitialFragments(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  int numEntries=6;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{1,2,3},reqs,NULL_LOGGER);
  for (int i=0; i < 10; i++) {
    MockErrorHandler error=new MockErrorHandler();
    loader.inject(4,error);
    reqs.assertFragmentsRequested(1);
    loadFailed(reqs,1);
    assertTrue(error.getWasCalled());
  }
}

Fixed version (ground truth):
/** 
 * This test catches a case in an earlier version of AsyncFragmentLoader where AsyncFragmentLoader.waitingForInitialFragments could exhaust its available space.
 */
public void testOverflowInWaitingForInitialFragments(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  MockProgressLogger progress=new MockProgressLogger();
  int numEntries=6;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{1,2,3},reqs,progress);
  for (int i=0; i < 10; i++) {
    MockErrorHandler error=new MockErrorHandler();
    loader.inject(4,error);
    reqs.assertFragmentsRequested(1);
    progress.assertEvent("String_Node_Str",BEGIN,1);
    loadFailed(reqs,1);
    assertTrue(error.getWasCalled());
    progress.assertNoEvents();
  }
}
Program: 54499
Project: 54499
Buggy source:
/** 
 * A thorough exercise of loading with an initial load sequence specified.
 */
public void testWithInitialLoadSequence(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  int numEntries=6;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{1,2,3},reqs,NULL_LOGGER);
  loader.inject(1,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(1);
  loader.inject(3,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested();
  loader.inject(5,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested();
  loader.fragmentHasLoaded(1);
  reqs.assertFragmentsRequested(2);
  loader.fragmentHasLoaded(2);
  reqs.assertFragmentsRequested(3);
  loader.fragmentHasLoaded(3);
  reqs.assertFragmentsRequested(numEntries);
  loader.leftoversFragmentHasLoaded();
  reqs.assertFragmentsRequested(5);
  loader.fragmentHasLoaded(5);
  reqs.assertFragmentsRequested();
  loader.inject(4,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(4);
  loader.fragmentHasLoaded(4);
  reqs.assertFragmentsRequested();
}

Fixed version (ground truth):
/** 
 * A thorough exercise of loading with an initial load sequence specified.
 */
public void testWithInitialLoadSequence(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  MockProgressLogger progress=new MockProgressLogger();
  int numEntries=6;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{1,2,3},reqs,progress);
  loader.inject(1,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(1);
  progress.assertEvent("String_Node_Str",BEGIN,1);
  loader.inject(3,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested();
  progress.assertNoEvents();
  loader.inject(5,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested();
  progress.assertNoEvents();
  loader.fragmentHasLoaded(1);
  reqs.assertFragmentsRequested(2);
  progress.assertEvent("String_Node_Str",END,1);
  progress.assertEvent("String_Node_Str",BEGIN,2);
  loader.fragmentHasLoaded(2);
  reqs.assertFragmentsRequested(3);
  progress.assertEvent("String_Node_Str",END,2);
  progress.assertEvent("String_Node_Str",BEGIN,3);
  loader.fragmentHasLoaded(3);
  reqs.assertFragmentsRequested(numEntries);
  progress.assertEvent("String_Node_Str",END,3);
  progress.assertEvent("String_Node_Str",BEGIN,numEntries);
  loader.leftoversFragmentHasLoaded();
  reqs.assertFragmentsRequested(5);
  progress.assertEvent("String_Node_Str",END,numEntries);
  progress.assertEvent("String_Node_Str",BEGIN,5);
  loader.fragmentHasLoaded(5);
  reqs.assertFragmentsRequested();
  progress.assertEvent("String_Node_Str",END,5);
  progress.assertNoEvents();
  loader.inject(4,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(4);
  progress.assertEvent("String_Node_Str",BEGIN,4);
  loader.fragmentHasLoaded(4);
  reqs.assertFragmentsRequested();
  progress.assertEvent("String_Node_Str",END,4);
  progress.assertNoEvents();
}
Program: 54500
Project: 54500
Buggy source:
public void logEventProgress(String eventGroup,String type,Integer fragment,Integer size){
}

Fixed version (ground truth):
public void logEventProgress(String eventGroup,String type,Integer fragment,Integer size){
  events.add(new MockProgressEvent(eventGroup,type,fragment));
}
Program: 54501
Project: 54501
Buggy source:
public void testBasics(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  int numEntries=5;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{},reqs,NULL_LOGGER);
  loader.inject(1,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(numEntries);
  loader.leftoversFragmentHasLoaded();
  reqs.assertFragmentsRequested(1);
  loader.fragmentHasLoaded(1);
  loader.inject(2,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(2);
  loader.fragmentHasLoaded(2);
}

Fixed version (ground truth):
public void testBasics(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  MockProgressLogger progress=new MockProgressLogger();
  int numEntries=5;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{},reqs,progress);
  loader.inject(1,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(numEntries);
  progress.assertEvent(LEFTOVERS_DOWNLOAD,BEGIN,numEntries);
  loader.leftoversFragmentHasLoaded();
  reqs.assertFragmentsRequested(1);
  progress.assertEvent(LEFTOVERS_DOWNLOAD,END,numEntries);
  progress.assertEvent("String_Node_Str",BEGIN,1);
  loader.fragmentHasLoaded(1);
  progress.assertEvent("String_Node_Str",END,1);
  loader.inject(2,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(2);
  progress.assertEvent("String_Node_Str",BEGIN,2);
  loader.fragmentHasLoaded(2);
  progress.assertEvent("String_Node_Str",END,2);
  progress.assertNoEvents();
}
Program: 54502
Project: 54502
Buggy source:
/** 
 * If only the first part of the initial load sequence is requested, then don't request more.
 */
public void testLoadingPartOfInitialSequence(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  int numEntries=6;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{1,2,3},reqs,NULL_LOGGER);
  loader.inject(1,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(1);
  loader.fragmentHasLoaded(1);
  reqs.assertFragmentsRequested();
  loader.inject(2,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(2);
  loader.fragmentHasLoaded(2);
  reqs.assertFragmentsRequested();
  loader.inject(3,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(3);
  loader.fragmentHasLoaded(3);
  reqs.assertFragmentsRequested(numEntries);
  loader.fragmentHasLoaded(numEntries);
  reqs.assertFragmentsRequested();
  loader.inject(5,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(5);
  loader.fragmentHasLoaded(5);
  reqs.assertFragmentsRequested();
}

Fixed version (ground truth):
/** 
 * If only the first part of the initial load sequence is requested, then don't request more.
 */
public void testLoadingPartOfInitialSequence(){
  MockLoadStrategy reqs=new MockLoadStrategy();
  MockProgressLogger progress=new MockProgressLogger();
  int numEntries=6;
  AsyncFragmentLoader loader=new AsyncFragmentLoader(numEntries,new int[]{1,2,3},reqs,progress);
  loader.inject(1,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(1);
  progress.assertEvent("String_Node_Str",BEGIN,1);
  loader.fragmentHasLoaded(1);
  reqs.assertFragmentsRequested();
  progress.assertEvent("String_Node_Str",END,1);
  loader.inject(2,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(2);
  progress.assertEvent("String_Node_Str",BEGIN,2);
  loader.fragmentHasLoaded(2);
  reqs.assertFragmentsRequested();
  progress.assertEvent("String_Node_Str",END,2);
  loader.inject(3,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(3);
  progress.assertEvent("String_Node_Str",BEGIN,3);
  loader.fragmentHasLoaded(3);
  reqs.assertFragmentsRequested(numEntries);
  progress.assertEvent("String_Node_Str",END,3);
  progress.assertEvent(LEFTOVERS_DOWNLOAD,BEGIN,numEntries);
  loader.fragmentHasLoaded(numEntries);
  reqs.assertFragmentsRequested();
  progress.assertEvent(LEFTOVERS_DOWNLOAD,END,numEntries);
  loader.inject(5,NULL_ERROR_HANDLER);
  reqs.assertFragmentsRequested(5);
  progress.assertEvent("String_Node_Str",BEGIN,5);
  loader.fragmentHasLoaded(5);
  reqs.assertFragmentsRequested();
  progress.assertEvent("String_Node_Str",END,5);
  progress.assertNoEvents();
}
Program: 54503
Project: 54503
Buggy source:
private void doGetModule(HttpServletRequest request,HttpServletResponse response,TreeLogger logger,RequestParts parts) throws IOException {
  String msg="String_Node_Str" + parts.moduleName + "String_Node_Str";
  logger=logger.branch(TreeLogger.TRACE,msg,null);
  try {
    getModuleDef(logger,parts.moduleName);
  }
 catch (  UnableToCompleteException e) {
    sendErrorResponse(response,HttpServletResponse.SC_NOT_FOUND,"String_Node_Str" + Util.escapeXml(parts.moduleName) + "String_Node_Str");
    return;
  }
  response.setContentType("String_Node_Str");
  PrintWriter writer=response.getWriter();
  writer.println("String_Node_Str");
  writer.print("String_Node_Str");
  writer.print(parts.moduleName);
  writer.println("String_Node_Str");
  Map<String,String[]> params=getParameterMap(request);
  for (  Map.Entry<String,String[]> entry : params.entrySet()) {
    String[] values=entry.getValue();
    if (values.length > 0) {
      writer.print("String_Node_Str");
      writer.print(entry.getKey());
      writer.print("String_Node_Str");
      writer.print(values[values.length - 1]);
      writer.println("String_Node_Str");
    }
  }
  writer.println("String_Node_Str");
  writer.println("String_Node_Str" + "String_Node_Str");
  writer.println("String_Node_Str");
}

Fixed version (ground truth):
private void doGetModule(HttpServletRequest request,HttpServletResponse response,TreeLogger logger,RequestParts parts) throws IOException {
  String msg="String_Node_Str" + parts.moduleName + "String_Node_Str";
  logger=logger.branch(TreeLogger.TRACE,msg,null);
  try {
    getModuleDef(logger,parts.moduleName);
  }
 catch (  UnableToCompleteException e) {
    sendErrorResponse(response,HttpServletResponse.SC_NOT_FOUND,"String_Node_Str" + Util.escapeXml(parts.moduleName) + "String_Node_Str");
    return;
  }
  response.setContentType("String_Node_Str");
  PrintWriter writer=response.getWriter();
  writer.println("String_Node_Str");
  writer.print("String_Node_Str");
  writer.print(parts.moduleName);
  writer.println("String_Node_Str");
  Map<String,String[]> params=getParameterMap(request);
  for (  Map.Entry<String,String[]> entry : params.entrySet()) {
    String[] values=entry.getValue();
    if (values.length > 0) {
      writer.print("String_Node_Str");
      writer.print(entry.getKey());
      writer.print("String_Node_Str");
      writer.print(values[values.length - 1]);
      writer.println("String_Node_Str");
    }
  }
  writer.println("String_Node_Str");
  writer.println("String_Node_Str" + "String_Node_Str");
  writer.println("String_Node_Str");
  writer.println("String_Node_Str");
  writer.println("String_Node_Str");
  writer.println("String_Node_Str");
  writer.println("String_Node_Str");
  writer.println("String_Node_Str");
}
Program: 54504
Project: 54504
Buggy source:
/** 
 * Returns the Object associated with the given key in the (key, value) mapping associated with the given Object instance.
 * @param instance the source Object.
 * @param key a String key.
 * @return an Object associated with that key on the given instance, or null.
 */
public static void set(Object instance,String key,Object value){
}

Fixed version (ground truth):
/** 
 * Associates a value with a given key in the (key, value) mapping associated with the given Object instance. Note that the key space is module-wide, so some care should be taken to choose sufficiently unique identifiers.
 * @param instance the source Object.
 * @param key a String key.
 * @param value the Object to associate with the key on the given sourceObject.
 */
public static void set(Object instance,String key,Object value){
}
Program: 54505
Project: 54505
Buggy source:
/** 
 * Associates a value with a given key in the (key, value) mapping associated with the given Object instance. Note that the key space is module-wide, so some care should be taken to choose sufficiently unique identifiers.
 * @param instance the source Object.
 * @param key a String key.
 * @param value the Object to associate with the key on the given sourceObject.
 */
public static native Object get(Object instance,String key);

Fixed version (ground truth):
/** 
 * Returns the Object associated with the given key in the (key, value) mapping associated with the given Object instance.
 * @param instance the source Object.
 * @param key a String key.
 * @return an Object associated with that key on the given instance, or null.
 */
public static native Object get(Object instance,String key);
Program: 54506
Project: 54506
Buggy source:
/** 
 * Forward link type.
 * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#adef-rel">W3C HTML Specification</a>
 */
public final native void setRel(String name);

Fixed version (ground truth):
/** 
 * Forward link type.
 * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#adef-rel">W3C HTML Specification</a>
 */
public final native void setRel(String rel);
Program: 54507
Project: 54507
Buggy source:
/** 
 * Timestamps have some non-obvious comparison semantics when compared to dates.
 */
public void testDateComparison(){
  long now=System.currentTimeMillis();
  Date d=new Date(now);
  Timestamp t=new Timestamp(d.getTime());
  if (now % 1000 == 0) {
    t.setNanos(1000001);
  }
 else {
    t.setNanos(1);
  }
  Date d2=new Date(t.getTime());
  assertFalse("String_Node_Str",d.equals(t));
  assertEquals("String_Node_Str",d2,t);
  assertEquals("String_Node_Str",d2.hashCode(),t.hashCode());
  assertFalse("String_Node_Str",t.equals(d2));
  if (GWT.isScript()) {
    try {
      t.compareTo(d2);
      fail("String_Node_Str");
    }
 catch (    ClassCastException e) {
    }
  }
  Timestamp t2=new Timestamp(d.getTime());
  t2.setNanos(2);
  assertFalse("String_Node_Str",t.equals(t2));
  assertEquals("String_Node_Str",t.hashCode(),t2.hashCode());
}

Fixed version (ground truth):
/** 
 * Timestamps have some non-obvious comparison semantics when compared to dates.
 */
public void testDateComparison(){
  long now=System.currentTimeMillis();
  Date d=new Date(now);
  Timestamp t=new Timestamp(d.getTime());
  if (now % 1000 == 0) {
    t.setNanos(1000001);
  }
 else {
    t.setNanos(1);
  }
  Date d2=new Date(t.getTime());
  assertFalse("String_Node_Str",d.equals(t));
  assertEquals("String_Node_Str",d2,t);
  assertEquals("String_Node_Str",d2.hashCode(),t.hashCode());
  assertFalse("String_Node_Str",t.equals(d2));
  if (GWT.isScript()) {
    try {
      t.compareTo(d2);
      fail("String_Node_Str");
    }
 catch (    ClassCastException e) {
    }
  }
  Timestamp t2=new Timestamp(d.getTime());
  t2.setNanos(t.getNanos() + 1);
  assertFalse("String_Node_Str",t.equals(t2));
  assertEquals("String_Node_Str",t.hashCode(),t2.hashCode());
}
Program: 54508
Project: 54508
Buggy source:
private void writeArtifactToFile(TreeLogger logger,EmittedArtifact artifact,File outFile,Set<String> createdDirs) throws UnableToCompleteException {
  if (!outFile.exists() || (outFile.lastModified() <= artifact.getLastModified())) {
    if (!mkdirs(outFile.getParentFile(),createdDirs)) {
      logger.log(TreeLogger.ERROR,"String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str");
    }
 else {
      try {
        FileOutputStream out=new FileOutputStream(outFile);
        artifact.writeTo(logger,out);
        out.close();
      }
 catch (      IOException e) {
        logger.log(TreeLogger.ERROR,"String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str",e);
        throw new UnableToCompleteException();
      }
      outFile.setLastModified(artifact.getLastModified());
    }
  }
}

Fixed version (ground truth):
private void writeArtifactToFile(TreeLogger logger,EmittedArtifact artifact,File outFile,Set<String> createdDirs) throws UnableToCompleteException {
  if (!outFile.exists() || (outFile.lastModified() < artifact.getLastModified())) {
    if (!mkdirs(outFile.getParentFile(),createdDirs)) {
      logger.log(TreeLogger.ERROR,"String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str");
    }
 else {
      try {
        FileOutputStream out=new FileOutputStream(outFile);
        artifact.writeTo(logger,out);
        out.close();
      }
 catch (      IOException e) {
        logger.log(TreeLogger.ERROR,"String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str",e);
        throw new UnableToCompleteException();
      }
      outFile.setLastModified(artifact.getLastModified());
    }
  }
}
Program: 54509
Project: 54509
Buggy source:
@Override public native Element eventGetToElement(Event evt);

Fixed version (ground truth):
@Override public Element eventGetToElement(Event evt){
  if (evt.getType().equals("String_Node_Str")) {
    return evt.getTarget().cast();
  }
  if (evt.getType().equals("String_Node_Str")) {
    return evt.getRelatedTarget().cast();
  }
  return null;
}
Program: 54510
Project: 54510
Buggy source:
@Override public native Element eventGetFromElement(Event evt);

Fixed version (ground truth):
@Override public Element eventGetFromElement(Event evt){
  if (evt.getType().equals("String_Node_Str")) {
    return evt.getRelatedTarget().cast();
  }
  if (evt.getType().equals("String_Node_Str")) {
    return evt.getTarget().cast();
  }
  return null;
}
Program: 54511
Project: 54511
Buggy source:
public void setText(String text){
  DOM.setElementProperty(getElement(),"String_Node_Str",text != null ? text : "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets this object's text.  Note that some browsers will manipulate the text before adding it to the widget.  For example, most browsers will strip all <code>\r</code> from the text, except IE which will add a <code>\r</code> before each <code>\n</code>.  Use   {@link #getText()} to get the textdirectly from the widget.
 * @param text the object's new text
 */
public void setText(String text){
  DOM.setElementProperty(getElement(),"String_Node_Str",text != null ? text : "String_Node_Str");
}
Program: 54512
Project: 54512
Buggy source:
@Override public native int getTextAreaCursorPos(Element elem);

Fixed version (ground truth):
/** 
 * The text reported in the text range does not include newline characters at the end of the selection. So, we need to create 2 ranges and subtract a character from one until the lengths are different. At that point, we know exactly how many \r\n were truncated from the selection.
 */
@Override public native int getTextAreaCursorPos(Element elem);
Program: 54513
Project: 54513
Buggy source:
@Override public native void setSelectionRange(Element elem,int pos,int length);

Fixed version (ground truth):
/** 
 * Moving the start 1 character will move across a \r\n, but \r\n counts as two characters, so we need to offset the position accordingly.
 */
@Override public native void setSelectionRange(Element elem,int pos,int length);
Program: 54514
Project: 54514
Buggy source:
/** 
 * Creates a JMultiExpression from a set of JExpressionStatements, optionally terminated by a JReturnStatement. If the method doesn't match this pattern, it returns <code>null</code>. If a method has a non-void return statement and can be represented as a multi-expression, the output of the multi-expression will be the return expression of the method. If the method is void, the output of the multi-expression should be considered undefined.
 */
private JMultiExpression createMultiExpressionFromBody(JMethodBody body,boolean ignoringReturnValue){
  JMultiExpression multi=new JMultiExpression(body.getSourceInfo());
  CloneCalleeExpressionVisitor cloner=new CloneCalleeExpressionVisitor();
  for (  JStatement stmt : body.getStatements()) {
    if (stmt instanceof JExpressionStatement) {
      JExpressionStatement exprStmt=(JExpressionStatement)stmt;
      JExpression expr=exprStmt.getExpr();
      JExpression clone=cloner.cloneExpression(expr);
      multi.exprs.add(clone);
    }
 else     if (stmt instanceof JReturnStatement) {
      JReturnStatement returnStatement=(JReturnStatement)stmt;
      JExpression expr=returnStatement.getExpr();
      if (expr != null) {
        if (!ignoringReturnValue || expr.hasSideEffects()) {
          JExpression clone=cloner.cloneExpression(expr);
          multi.exprs.add(clone);
        }
      }
      break;
    }
 else {
      return null;
    }
  }
  return multi;
}

Fixed version (ground truth):
/** 
 * Creates a JMultiExpression from a set of JExpressionStatements, optionally terminated by a JReturnStatement. If the method doesn't match this pattern, it returns <code>null</code>. If a method has a non-void return statement and can be represented as a multi-expression, the output of the multi-expression will be the return expression of the method. If the method is void, the output of the multi-expression should be considered undefined.
 */
private JMultiExpression createMultiExpressionFromBody(JMethodBody body,boolean ignoringReturnValue){
  JMultiExpression multi=new JMultiExpression(body.getSourceInfo());
  CloneCalleeExpressionVisitor cloner=new CloneCalleeExpressionVisitor();
  for (  JStatement stmt : body.getStatements()) {
    if (stmt instanceof JExpressionStatement) {
      JExpressionStatement exprStmt=(JExpressionStatement)stmt;
      JExpression expr=exprStmt.getExpr();
      JExpression clone=cloner.cloneExpression(expr);
      multi.exprs.add(clone);
    }
 else     if (stmt instanceof JReturnStatement) {
      JReturnStatement returnStatement=(JReturnStatement)stmt;
      JExpression expr=returnStatement.getExpr();
      if (expr != null) {
        if (!ignoringReturnValue || expr.hasSideEffects()) {
          JExpression clone=cloner.cloneExpression(expr);
          clone=maybeCast(clone,body.getMethod().getType());
          multi.exprs.add(clone);
        }
      }
      break;
    }
 else {
      return null;
    }
  }
  return multi;
}
Program: 54515
Project: 54515
Buggy source:
public void testImplicitCastToLong(){
  long l=10;
  l+=5;
  assertEquals(15,l);
  assertTrue(15 == l);
}

Fixed version (ground truth):
public void testImplicitCastToLong(){
  long l=10;
  l+=5;
  assertEquals(15,l);
  assertTrue(15 == l);
  IntegerWrapper wrap=new IntegerWrapper(20);
  assertEquals(400L,wrap.longValue() * wrap.longValue());
}
Program: 54516
Project: 54516
Buggy source:
/** 
 * Call the toSource() on the JSO
 */
public native String toSource();

Fixed version (ground truth):
/** 
 * Call the toSource() on the JSO.
 */
public native String toSource();
Program: 54517
Project: 54517
Buggy source:
/** 
 * Check whether the given date and time falls within a daylight savings time period
 * @param date and time to check.
 * @return true if daylight savings time is in effect.
 */
public boolean isDaylightTime(Date date){
  return getDaylightAdjustment(date) > 0;
}

Fixed version (ground truth):
/** 
 * Check whether the given date and time falls within a daylight savings time period.
 * @param date and time to check.
 * @return true if daylight savings time is in effect.
 */
public boolean isDaylightTime(Date date){
  return getDaylightAdjustment(date) > 0;
}
Program: 54520
Project: 54520
Buggy source:
public Precompilation newInstance(TreeLogger logger) throws UnableToCompleteException {
  Precompilation toReturn;
  try {
    toReturn=Util.readStreamAsObject(jarFile.getInputStream(zipEntry),Precompilation.class);
  }
 catch (  IOException e) {
    toReturn=null;
  }
catch (  ClassNotFoundException e) {
    logger.log(TreeLogger.ERROR,"String_Node_Str",e);
    throw new UnableToCompleteException();
  }
  if (toReturn == null) {
    logger.log(TreeLogger.ERROR,"String_Node_Str");
    throw new UnableToCompleteException();
  }
  return toReturn;
}

Fixed version (ground truth):
public Precompilation newInstance(TreeLogger logger) throws UnableToCompleteException {
  try {
    return Util.readStreamAsObject(jarFile.getInputStream(zipEntry),Precompilation.class);
  }
 catch (  IOException e) {
    logger.log(TreeLogger.ERROR,"String_Node_Str",e);
    throw new UnableToCompleteException();
  }
catch (  ClassNotFoundException e) {
    logger.log(TreeLogger.ERROR,"String_Node_Str",e);
    throw new UnableToCompleteException();
  }
}
Program: 54521
Project: 54521
Buggy source:
public <T>T readObject(long token,Class<T> type){
  try {
    byte[] bytes=readByteArray(token);
    ByteArrayInputStream in=new ByteArrayInputStream(bytes);
    return Util.readStreamAsObject(in,type);
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public <T>T readObject(long token,Class<T> type){
  try {
    byte[] bytes=readByteArray(token);
    ByteArrayInputStream in=new ByteArrayInputStream(bytes);
    return Util.readStreamAsObject(in,type);
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 54522
Project: 54522
Buggy source:
/** 
 * Construct a new instance of the object stored in the backing file.
 * @param logger a sink for error messages
 * @return a new instance of the object stored in the backing file
 * @throws UnableToCompleteException if the backing store does not contain anobject of type <code>T</code>
 */
public T newInstance(TreeLogger logger) throws UnableToCompleteException {
  try {
    T toReturn=Util.readFileAsObject(backingFile,clazz);
    if (toReturn == null) {
      logger.log(TreeLogger.ERROR,"String_Node_Str");
      throw new UnableToCompleteException();
    }
    return toReturn;
  }
 catch (  ClassNotFoundException e) {
    logger.log(TreeLogger.ERROR,"String_Node_Str",e);
    throw new UnableToCompleteException();
  }
}

Fixed version (ground truth):
/** 
 * Construct a new instance of the object stored in the backing file.
 * @param logger a sink for error messages
 * @return a new instance of the object stored in the backing file
 * @throws UnableToCompleteException if the backing store does not contain anobject of type <code>T</code>
 */
public T newInstance(TreeLogger logger) throws UnableToCompleteException {
  try {
    return Util.readFileAsObject(backingFile,clazz);
  }
 catch (  ClassNotFoundException e) {
    logger.log(TreeLogger.ERROR,"String_Node_Str",e);
    throw new UnableToCompleteException();
  }
catch (  IOException e) {
    logger.log(TreeLogger.ERROR,"String_Node_Str",e);
    throw new UnableToCompleteException();
  }
}
Program: 54523
Project: 54523
Buggy source:
public static <T>T readStreamAsObject(InputStream inputStream,Class<T> type) throws ClassNotFoundException {
  ObjectInputStream objectInputStream=null;
  try {
    objectInputStream=new ObjectInputStream(inputStream);
    return type.cast(objectInputStream.readObject());
  }
 catch (  IOException e) {
    return null;
  }
 finally {
    Utility.close(objectInputStream);
  }
}

Fixed version (ground truth):
public static <T>T readStreamAsObject(InputStream inputStream,Class<T> type) throws ClassNotFoundException, IOException {
  ObjectInputStream objectInputStream=null;
  try {
    objectInputStream=new ObjectInputStream(inputStream);
    return type.cast(objectInputStream.readObject());
  }
  finally {
    Utility.close(objectInputStream);
  }
}
Program: 54524
Project: 54524
Buggy source:
public static <T extends Serializable>T readFileAsObject(File file,Class<T> type) throws ClassNotFoundException {
  FileInputStream fileInputStream=null;
  try {
    fileInputStream=new FileInputStream(file);
    return readStreamAsObject(fileInputStream,type);
  }
 catch (  IOException e) {
    return null;
  }
 finally {
    Utility.close(fileInputStream);
  }
}

Fixed version (ground truth):
public static <T extends Serializable>T readFileAsObject(File file,Class<T> type) throws ClassNotFoundException, IOException {
  FileInputStream fileInputStream=null;
  try {
    fileInputStream=new FileInputStream(file);
    return readStreamAsObject(fileInputStream,type);
  }
  finally {
    Utility.close(fileInputStream);
  }
}
Program: 54525
Project: 54525
Buggy source:
/** 
 * Loads an image from the classpath, optionally prepending this package.
 * @param name name of an image file.
 * @param prependPackage true if {@link #PACKAGE_PATH} should be prepended tothis name.
 */
static ImageIcon loadImageIcon(String name,boolean prependPackage){
  ClassLoader cl=OophmHostedModeBase.class.getClassLoader();
  if (prependPackage) {
    name=PACKAGE_PATH + name;
  }
  URL url=cl.getResource(name);
  if (url != null) {
    ImageIcon image=new ImageIcon(url);
    return image;
  }
 else {
    return new ImageIcon();
  }
}

Fixed version (ground truth):
/** 
 * Loads an image from the classpath, optionally prepending this package.
 * @param name name of an image file.
 * @param prependPackage true if {@link #PACKAGE_PATH} should be prepended tothis name.
 */
static ImageIcon loadImageIcon(String name,boolean prependPackage){
  ClassLoader cl=OophmHostedModeBase.class.getClassLoader();
  if (prependPackage) {
    name=PACKAGE_PATH + name;
  }
  URL url=(name == null) ? null : cl.getResource(name);
  if (url != null) {
    ImageIcon image=new ImageIcon(url);
    return image;
  }
 else {
    return new ImageIcon();
  }
}
Program: 54526
Project: 54526
Buggy source:
static int compute(String str){
  int n=str.length();
  int inc=(n < 64) ? 1 : (n / 32);
  int hashCode=0;
  for (int i=0; i < n; i+=inc) {
    hashCode<<=1;
    hashCode+=str.charAt(i);
  }
  hashCode|=0;
  return hashCode;
}

Fixed version (ground truth):
static int compute(String str){
  int hashCode=0;
  int n=str.length();
  int nBatch=n - 4;
  int i=0;
  while (i < nBatch) {
    hashCode=(str.charAt(i + 3) + 31 * (str.charAt(i + 2) + 31 * (str.charAt(i + 1) + 31 * (str.charAt(i) + 31 * hashCode)))) | 0;
    i+=4;
  }
  while (i < n) {
    hashCode=hashCode * 31 + str.charAt(i++);
  }
  return hashCode | 0;
}
Program: 54527
Project: 54527
Buggy source:
/** 
 * Tests hashing with strings. The specific strings used in this test used to trigger failures because we use a JavaScript object as a hash map to cache the computed hash codes. This conflicts with built-in properties defined on objects -- see issue #631.
 */
public void testHashCode(){
  String[] testStrings={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  int[] savedHash=new int[testStrings.length];
  for (int i=0; i < testStrings.length; ++i) {
    savedHash[i]=testStrings[i].hashCode();
    String str=Integer.toString(savedHash[i]);
    for (int j=0; j < str.length(); ++j) {
      char ch=str.charAt(j);
      assertTrue("String_Node_Str" + ch + "String_Node_Str"+ Integer.toHexString(ch)+ "String_Node_Str",ch == '-' || ch == ' ' || Character.isDigit(ch));
    }
  }
  for (int i=0; i < testStrings.length; ++i) {
    assertEquals(savedHash[i],testStrings[i].hashCode());
  }
}

Fixed version (ground truth):
/** 
 * Tests hashing with strings. The specific strings used in this test used to trigger failures because we use a JavaScript object as a hash map to cache the computed hash codes. This conflicts with built-in properties defined on objects -- see issue #631.
 */
public void testHashCode(){
  String[] testStrings={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  int[] javaHashes={112903375,-274141738,-1776922004,-1781441930,3125404,231605032,-1588406278,2139739112,Integer.MIN_VALUE,3841,120,0};
  for (int i=0; i < testStrings.length; ++i) {
    String testString=testStrings[i];
    int expectedHash=javaHashes[i];
    assertEquals("String_Node_Str" + testString,expectedHash,testString.hashCode());
    String str=Integer.toString(expectedHash);
    for (int j=0; j < str.length(); ++j) {
      char ch=str.charAt(j);
      assertTrue("String_Node_Str" + ch + "String_Node_Str"+ Integer.toHexString(ch)+ "String_Node_Str",ch == '-' || ch == ' ' || Character.isDigit(ch));
    }
    assertEquals(expectedHash,testStrings[i].hashCode());
  }
}
Program: 54529
Project: 54529
Buggy source:
/** 
 * Performs rewriting transformations on a class.
 * @param ccl the ClassLoader requesting the rewrite
 * @param className the name of the class
 * @param classBytes the bytes of the class
 * @param anonymousClassMap a map between the anonymous class names of javacompiler used to compile code and jdt. Emma-specific.
 */
public byte[] rewrite(ClassLoader ccl,String className,byte[] classBytes,Map<String,String> anonymousClassMap){
  String desc=toDescriptor(className);
  assert(!jsoIntfDescs.contains(desc));
  ClassWriter writer=new ClassWriter(0);
  ClassVisitor v=writer;
  v=new RewriteSingleJsoImplDispatches(v,ccl,singleJsoImplTypes,mangledNamesToImplementations);
  v=new RewriteRefsToJsoClasses(v,jsoIntfDescs,mapper);
  if (jsoImplDescs.contains(desc)) {
    v=WriteJsoImpl.create(v,desc,jsoIntfDescs,mapper,mangledNamesToImplementations);
  }
  v=new RewriteJsniMethods(v,anonymousClassMap);
  if (Double.parseDouble(System.getProperty("String_Node_Str")) < Opcodes.V1_6) {
    v=new ForceClassVersion15(v);
  }
  new ClassReader(classBytes).accept(v,0);
  return writer.toByteArray();
}

Fixed version (ground truth):
/** 
 * Performs rewriting transformations on a class.
 * @param typeOracle a typeOracle modeling the user classes
 * @param className the name of the class
 * @param classBytes the bytes of the class
 * @param anonymousClassMap a map between the anonymous class names of javacompiler used to compile code and jdt. Emma-specific.
 */
public byte[] rewrite(TypeOracle typeOracle,String className,byte[] classBytes,Map<String,String> anonymousClassMap){
  String desc=toDescriptor(className);
  assert(!jsoIntfDescs.contains(desc));
  ClassWriter writer=new ClassWriter(0);
  ClassVisitor v=writer;
  v=new RewriteSingleJsoImplDispatches(v,typeOracle,singleJsoImplTypes,mangledNamesToImplementations);
  v=new RewriteRefsToJsoClasses(v,jsoIntfDescs,mapper);
  if (jsoImplDescs.contains(desc)) {
    v=WriteJsoImpl.create(v,desc,jsoIntfDescs,mapper,mangledNamesToImplementations);
  }
  v=new RewriteJsniMethods(v,anonymousClassMap);
  if (Double.parseDouble(System.getProperty("String_Node_Str")) < Opcodes.V1_6) {
    v=new ForceClassVersion15(v);
  }
  new ClassReader(classBytes).accept(v,0);
  return writer.toByteArray();
}
Program: 54530
Project: 54530
Buggy source:
public RewriteSingleJsoImplDispatches(ClassVisitor v,ClassLoader ccl,Set<String> singleJsoImplTypes,SortedMap<String,Method> mangledNamesToImplementations){
  super(v);
  this.ccl=ccl;
  this.singleJsoImplTypes=Collections.unmodifiableSet(singleJsoImplTypes);
  this.mangledNamesToImplementations=Collections.unmodifiableSortedMap(mangledNamesToImplementations);
}

Fixed version (ground truth):
public RewriteSingleJsoImplDispatches(ClassVisitor v,TypeOracle typeOracle,Set<String> singleJsoImplTypes,SortedMap<String,Method> mangledNamesToImplementations){
  super(v);
  this.typeOracle=typeOracle;
  this.singleJsoImplTypes=Collections.unmodifiableSet(singleJsoImplTypes);
  this.mangledNamesToImplementations=Collections.unmodifiableSortedMap(mangledNamesToImplementations);
}
Program: 54531
Project: 54531
Buggy source:
private Set<String> computeAllInterfaces(String... interfaces){
}

Fixed version (ground truth):
private Set<String> computeAllInterfaces(String[] interfaces){
  Set<String> toReturn=new HashSet<String>();
  for (  String intfName : interfaces) {
    toReturn.addAll(computeAllInterfaces(intfName));
  }
  return toReturn;
}
Program: 54532
Project: 54532
Buggy source:
public static String slurpSource(SourcePosition position){
  FileReader fr=null;
  try {
    fr=new FileReader(position.file());
    BufferedReader br=new BufferedReader(fr);
    for (int i=0, n=position.line() - 1; i < n; ++i) {
      br.readLine();
    }
    StringBuffer lines=new StringBuffer();
    String line=br.readLine();
    int braceDepth=0;
    int indent=-1;
    boolean seenSemiColonOrBrace=false;
    while (line != null) {
      if (indent == -1) {
        for (indent=0; Character.isWhitespace(line.charAt(indent)); ++indent) {
        }
      }
      if (line.length() >= indent) {
        line=line.substring(indent);
      }
      lines.append(line + "String_Node_Str");
      for (int i=0, n=line.length(); i < n; ++i) {
        char c=line.charAt(i);
        if (c == '{') {
          seenSemiColonOrBrace=true;
          ++braceDepth;
        }
 else         if (c == '}') {
          --braceDepth;
        }
 else         if (c == ';') {
          seenSemiColonOrBrace=true;
        }
      }
      if (braceDepth > 0 || !seenSemiColonOrBrace) {
        line=br.readLine();
      }
 else {
        break;
      }
    }
    String code=lines.toString();
    return code;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (fr != null) {
        fr.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public static String slurpSource(SourcePosition position){
  BufferedReader br=null;
  try {
    br=new BufferedReader(new FileReader(position.file()));
    for (int i=0, n=position.line() - 1; i < n; ++i) {
      br.readLine();
    }
    StringBuffer lines=new StringBuffer();
    String line=br.readLine();
    int braceDepth=0;
    int indent=-1;
    boolean seenSemiColonOrBrace=false;
    while (line != null) {
      if (indent == -1) {
        for (indent=0; Character.isWhitespace(line.charAt(indent)); ++indent) {
        }
      }
      if (line.length() >= indent) {
        line=line.substring(indent);
      }
      lines.append(line + "String_Node_Str");
      for (int i=0, n=line.length(); i < n; ++i) {
        char c=line.charAt(i);
        if (c == '{') {
          seenSemiColonOrBrace=true;
          ++braceDepth;
        }
 else         if (c == '}') {
          --braceDepth;
        }
 else         if (c == ';') {
          seenSemiColonOrBrace=true;
        }
      }
      if (braceDepth > 0 || !seenSemiColonOrBrace) {
        line=br.readLine();
      }
 else {
        break;
      }
    }
    String code=lines.toString();
    return code;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (br != null) {
        br.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return "String_Node_Str";
}
Program: 54533
Project: 54533
Buggy source:
public boolean copyFile(File in,File out){
  FileInputStream fis=null;
  FileOutputStream fos=null;
  try {
    fis=new FileInputStream(in);
    fos=new FileOutputStream(out);
    byte[] buf=new byte[4096];
    int i=0;
    while ((i=fis.read(buf)) != -1) {
      fos.write(buf,0,i);
    }
    return true;
  }
 catch (  Exception e) {
    return false;
  }
 finally {
    close(fis);
    close(fos);
  }
}

Fixed version (ground truth):
public boolean copyFile(File in,File out){
  FileInputStream fis=null;
  FileOutputStream fos=null;
  try {
    fis=new FileInputStream(in);
    fos=new FileOutputStream(out);
    byte[] buf=new byte[4096];
    int i=0;
    while ((i=fis.read(buf)) != -1) {
      fos.write(buf,0,i);
    }
    return true;
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    close(fis);
    close(fos);
  }
}