nus-yam/ex-repair huggingface dataset:
Program: 54173
Project: 54173
Buggy source:
/** 
 * Inform the views of the new data.
 * @param start the start index
 * @param length the length of the data
 * @param values the data values
 */
protected void updateViewData(int start,int length,List<T> values){
  int end=start + length;
  for (  DefaultListRegistration reg : registrations) {
    int curStart=reg.getStart();
    int curLength=reg.getLength();
    int curEnd=curStart + curLength;
    if (curStart < end && curEnd > start) {
      int realStart=curStart < start ? start : curStart;
      int realEnd=curEnd > end ? end : curEnd;
      int realLength=realEnd - realStart;
      List<T> realValues=values.subList(0,realLength);
      ListEvent<T> event=new ListEvent<T>(realStart,realLength,realValues);
      reg.getHandler().onDataChanged(event);
    }
  }
}

Fixed version (ground truth):
/** 
 * Inform the views of the new data.
 * @param start the start index
 * @param length the length of the data
 * @param values the data values
 */
protected void updateViewData(int start,int length,List<T> values){
  int end=start + length;
  for (  DefaultListRegistration reg : registrations) {
    int curStart=reg.getStart();
    int curLength=reg.getLength();
    int curEnd=curStart + curLength;
    if (curStart < end && curEnd > start) {
      int realStart=curStart < start ? start : curStart;
      int realEnd=curEnd > end ? end : curEnd;
      int realLength=realEnd - realStart;
      List<T> realValues=values.subList(realStart - start,realStart - start + realLength);
      ListEvent<T> event=new ListEvent<T>(realStart,realLength,realValues);
      reg.getHandler().onDataChanged(event);
    }
  }
}
Program: 54174
Project: 54174
Buggy source:
public void execute(){
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  if (modified) {
    int length=maxModified - minModified;
    updateViewData(minModified,length,list.subList(minModified,maxModified));
    modified=false;
  }
  minModified=Integer.MAX_VALUE;
  maxModified=Integer.MIN_VALUE;
  flushPending=false;
}

Fixed version (ground truth):
public void execute(){
  flushPending=false;
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  if (modified) {
    int length=maxModified - minModified;
    updateViewData(minModified,length,list.subList(minModified,maxModified));
    modified=false;
  }
  minModified=Integer.MAX_VALUE;
  maxModified=Integer.MIN_VALUE;
}
Program: 54175
Project: 54175
Buggy source:
@Override protected void moveSelectionUp(){
  if (isSuggestionListShowing()) {
    suggestionMenu.selectItem(suggestionMenu.getSelectedItemIndex() - 1);
  }
}

Fixed version (ground truth):
@Override protected void moveSelectionUp(){
  if (isSuggestionListShowing()) {
    if (suggestionMenu.getSelectedItemIndex() == -1) {
      suggestionMenu.selectItem(suggestionMenu.getNumItems() - 1);
    }
 else {
      suggestionMenu.selectItem(suggestionMenu.getSelectedItemIndex() - 1);
    }
  }
}
Program: 54176
Project: 54176
Buggy source:
@Override public synchronized void launchModule(String moduleName){
  String domain="String_Node_Str" + getLocalHostName() + "String_Node_Str"+ shell.getPort()+ "String_Node_Str";
  for (  SeleniumWrapper remote : remotes) {
    try {
      String url=shell.getModuleUrl(moduleName);
      shell.getTopLogger().log(TreeLogger.TRACE,"String_Node_Str" + domain + "String_Node_Str"+ url);
      remote.createSelenium(domain);
      remote.getSelenium().start();
      remote.getSelenium().open(url);
    }
 catch (    Exception e) {
      shell.getTopLogger().log(TreeLogger.ERROR,"String_Node_Str" + remote.getSpecifier(),e);
    }
  }
}

Fixed version (ground truth):
@Override public void launchModule(String moduleName){
  String domain="String_Node_Str" + getLocalHostName() + "String_Node_Str"+ shell.getPort()+ "String_Node_Str";
synchronized (lock) {
    for (    SeleniumWrapper remote : remotes) {
      try {
        String url=shell.getModuleUrl(moduleName);
        shell.getTopLogger().log(TreeLogger.TRACE,"String_Node_Str" + domain + "String_Node_Str"+ url);
        remote.createSelenium(domain);
        remote.getSelenium().start();
        remote.getSelenium().open(url);
      }
 catch (      Exception e) {
        shell.getTopLogger().log(TreeLogger.ERROR,"String_Node_Str" + remote.getSpecifier(),e);
      }
    }
  }
}
Program: 54177
Project: 54177
Buggy source:
private synchronized boolean doKeepAlives(){
  if (remotes != null) {
    for (    SeleniumWrapper remote : remotes) {
      try {
        if (remote.getSelenium() != null) {
          remote.getSelenium().getTitle();
        }
      }
 catch (      Throwable e) {
synchronized (wasInterruptedLock) {
          if (interruptedHosts == null) {
            interruptedHosts=new HashSet<String>();
          }
          interruptedHosts.add(remote.getSpecifier());
        }
      }
    }
  }
  return interruptedHosts == null;
}

Fixed version (ground truth):
private boolean doKeepAlives(){
synchronized (lock) {
    if (remotes != null) {
      if (stopped) {
        return false;
      }
      for (      SeleniumWrapper remote : remotes) {
        try {
          if (remote.getSelenium() != null) {
            remote.getSelenium().getTitle();
          }
        }
 catch (        Throwable e) {
          String message=e.getMessage();
          if (message != null && message.toLowerCase().contains("String_Node_Str")) {
            if (interruptedHosts == null) {
              interruptedHosts=new HashSet<String>();
            }
            interruptedHosts.add(remote.getSpecifier());
          }
        }
      }
    }
    return interruptedHosts == null;
  }
}
Program: 54178
Project: 54178
Buggy source:
@Override public String[] getInterruptedHosts(){
synchronized (wasInterruptedLock) {
    if (interruptedHosts == null) {
      return null;
    }
    return interruptedHosts.toArray(new String[interruptedHosts.size()]);
  }
}

Fixed version (ground truth):
@Override public String[] getInterruptedHosts(){
synchronized (lock) {
    if (interruptedHosts == null) {
      return null;
    }
    return interruptedHosts.toArray(new String[interruptedHosts.size()]);
  }
}
Program: 54179
Project: 54179
Buggy source:
@Override public int initialize(String args){
  if (args == null || args.length() == 0) {
    getLogger().log(TreeLogger.ERROR,"String_Node_Str");
    return -1;
  }
  String[] targetsIn=args.split("String_Node_Str");
  SeleniumWrapper targets[]=new SeleniumWrapper[targetsIn.length];
  for (int i=0; i < targets.length; ++i) {
    try {
      targets[i]=createSeleniumWrapper(targetsIn[i]);
    }
 catch (    IllegalArgumentException e) {
      getLogger().log(TreeLogger.ERROR,e.getMessage());
      return -1;
    }
  }
  this.remotes=targets;
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
      for (      SeleniumWrapper remote : remotes) {
        if (remote.getSelenium() != null) {
          try {
            remote.getSelenium().stop();
          }
 catch (          SeleniumException se) {
            shell.getTopLogger().log(TreeLogger.WARN,"String_Node_Str",se);
          }
        }
      }
    }
  }
);
  start();
  return targets.length;
}

Fixed version (ground truth):
@Override public int initialize(String args){
  if (args == null || args.length() == 0) {
    getLogger().log(TreeLogger.ERROR,"String_Node_Str");
    return -1;
  }
  String[] targetsIn=args.split("String_Node_Str");
  SeleniumWrapper targets[]=new SeleniumWrapper[targetsIn.length];
  for (int i=0; i < targets.length; ++i) {
    try {
      targets[i]=createSeleniumWrapper(targetsIn[i]);
    }
 catch (    IllegalArgumentException e) {
      getLogger().log(TreeLogger.ERROR,e.getMessage());
      return -1;
    }
  }
  this.remotes=targets;
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
synchronized (lock) {
        stopped=true;
        for (        SeleniumWrapper remote : remotes) {
          if (remote.getSelenium() != null) {
            try {
              remote.getSelenium().stop();
            }
 catch (            SeleniumException se) {
              shell.getTopLogger().log(TreeLogger.WARN,"String_Node_Str",se);
            }
          }
        }
      }
    }
  }
);
  start();
  return targets.length;
}
Program: 54180
Project: 54180
Buggy source:
/** 
 * Intended to be used to pull the value out of a CSS length. We rely on the behavior of parseFloat to ignore non-numeric chars in its input. If the value is "auto" or "inherit", 0 will be returned.
 * @param s The CSS length string to extract
 * @return The leading numeric portion of <code>s</code>, or 0 if "auto" or"inherit" are passed in.
 */
private native double extractLengthValue(String s);

Fixed version (ground truth):
/** 
 * Intended to be used to pull the value out of a CSS length. If the value is "auto" or "inherit", 0 will be returned.
 * @param s The CSS length string to extract
 * @return The leading numeric portion of <code>s</code>, or 0 if "auto" or"inherit" are passed in.
 */
private native double extractLengthValue(String s);
Program: 54181
Project: 54181
Buggy source:
public void testParse(){
  assertTrue(0 == Double.parseDouble("String_Node_Str"));
  assertTrue(-1.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(3.0 == Double.parseDouble("String_Node_Str"));
  assertTrue(0.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.98e8 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.98e-8 == Double.parseDouble("String_Node_Str"));
  assertTrue(+2.98E+8 == Double.parseDouble("String_Node_Str"));
  assertTrue("String_Node_Str",Double.MIN_VALUE == Double.parseDouble(String.valueOf(Double.MIN_VALUE)));
  assertTrue("String_Node_Str",Double.MAX_VALUE == Double.parseDouble(String.valueOf(Double.MAX_VALUE)));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
}

Fixed version (ground truth):
public void testParse(){
  assertTrue(0 == Double.parseDouble("String_Node_Str"));
  assertTrue(100 == Double.parseDouble("String_Node_Str"));
  assertTrue(-100 == Double.parseDouble("String_Node_Str"));
  assertTrue(-1.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(3.0 == Double.parseDouble("String_Node_Str"));
  assertTrue(0.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.98e8 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.98e-8 == Double.parseDouble("String_Node_Str"));
  assertTrue(+2.98E+8 == Double.parseDouble("String_Node_Str"));
  assertTrue("String_Node_Str",Double.MIN_VALUE == Double.parseDouble(String.valueOf(Double.MIN_VALUE)));
  assertTrue("String_Node_Str",Double.MAX_VALUE == Double.parseDouble(String.valueOf(Double.MAX_VALUE)));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
}
Program: 54182
Project: 54182
Buggy source:
public void testBadStrings(){
  try {
    new Double("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.valueOf("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
}

Fixed version (ground truth):
public void testBadStrings(){
  try {
    new Double("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.valueOf("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
}
Program: 54183
Project: 54183
Buggy source:
public void onSizeChanged(SizeChangeEvent event){
  int size=event.getSize();
  if (size > maxSize) {
    showMoreElem.getStyle().clearDisplay();
  }
 else {
    showMoreElem.getStyle().setDisplay(Display.NONE);
  }
  int dataSize=data.size();
  if (size < dataSize) {
    while (size < dataSize) {
      data.remove(dataSize - 1);
      dataSize--;
    }
  }
 else {
    data.ensureCapacity(size);
    while (dataSize < size) {
      data.add(null);
      dataSize++;
    }
  }
  gc(size);
}

Fixed version (ground truth):
public void onSizeChanged(SizeChangeEvent event){
  size=event.getSize();
  showOrHide(showMoreElem,size > maxSize);
  showOrHide(showFewerElem,maxSize > initialMaxSize);
}
Program: 54184
Project: 54184
Buggy source:
@Override protected void onLoad(){
  super.onLoad();
  this.reg=model.addListHandler(new ListHandler<T>(){
    public void onDataChanged(    ListEvent<T> event){
      int start=event.getStart(), len=event.getLength();
      List<T> values=event.getValues();
      for (int i=0; i < len; ++i) {
        data.set(start + i,values.get(i));
      }
      render(start,len,values);
    }
    public void onSizeChanged(    SizeChangeEvent event){
      int size=event.getSize();
      if (size > maxSize) {
        showMoreElem.getStyle().clearDisplay();
      }
 else {
        showMoreElem.getStyle().setDisplay(Display.NONE);
      }
      int dataSize=data.size();
      if (size < dataSize) {
        while (size < dataSize) {
          data.remove(dataSize - 1);
          dataSize--;
        }
      }
 else {
        data.ensureCapacity(size);
        while (dataSize < size) {
          data.add(null);
          dataSize++;
        }
      }
      gc(size);
    }
  }
);
  reg.setRangeOfInterest(0,maxSize);
}

Fixed version (ground truth):
@Override protected void onLoad(){
  super.onLoad();
  this.reg=model.addListHandler(new ListHandler<T>(){
    public void onDataChanged(    ListEvent<T> event){
      int start=event.getStart();
      int len=event.getLength();
      List<T> values=event.getValues();
      StringBuilder sb=new StringBuilder();
      for (int i=0; i < len; i++) {
        sb.append("String_Node_Str" + (start + i) + "String_Node_Str"+ seq+++ "String_Node_Str");
        cell.render(values.get(i),null,sb);
        sb.append("String_Node_Str");
      }
      Element parent=getElement().getFirstChildElement();
      if (start == 0 && len == maxSize) {
        parent.setInnerHTML(sb.toString());
      }
 else {
        makeElements();
        tmpElem.setInnerHTML(sb.toString());
        for (int i=0; i < len; i++) {
          Element child=parent.getChild(start + i).cast();
          parent.replaceChild(tmpElem.getChild(0),child);
        }
      }
    }
    public void onSizeChanged(    SizeChangeEvent event){
      size=event.getSize();
      showOrHide(showMoreElem,size > maxSize);
      showOrHide(showFewerElem,maxSize > initialMaxSize);
    }
    private void makeElements(){
      Element parent=getElement().getFirstChildElement();
      int childCount=parent.getChildCount();
      int actualSize=Math.min(size,maxSize);
      if (actualSize > childCount) {
        StringBuilder sb=new StringBuilder();
        int newElements=actualSize - childCount;
        for (int i=0; i < newElements; i++) {
          sb.append("String_Node_Str" + (childCount + i) + "String_Node_Str");
        }
        if (childCount == 0) {
          parent.setInnerHTML(sb.toString());
        }
 else {
          tmpElem.setInnerHTML(sb.toString());
          for (int i=0; i < newElements; i++) {
            parent.appendChild(tmpElem.getChild(0));
          }
        }
      }
 else       if (actualSize < childCount) {
        while (actualSize < childCount) {
          parent.getChild(--childCount).removeFromParent();
        }
      }
    }
  }
);
  reg.setRangeOfInterest(0,maxSize);
}
Program: 54185
Project: 54185
Buggy source:
public SimpleCellList(ListModel<T> model,Cell<T,Void> cell,int maxSize,int increment){
  this.maxSize=maxSize;
  this.increment=increment;
  this.model=model;
  this.cell=cell;
  tmpElem=Document.get().createDivElement();
  showMoreElem=Document.get().createDivElement();
  showMoreElem.setInnerHTML("String_Node_Str" + increment + "String_Node_Str");
  showMoreElem.getStyle().setDisplay(Display.NONE);
  DivElement outerDiv=Document.get().createDivElement();
  DivElement innerDiv=Document.get().createDivElement();
  outerDiv.appendChild(innerDiv);
  outerDiv.appendChild(showMoreElem);
  setElement(outerDiv);
  sinkEvents(Event.ONCLICK);
  sinkEvents(Event.ONCHANGE);
}

Fixed version (ground truth):
public SimpleCellList(ListModel<T> model,Cell<T,Void> cell,int maxSize,int increment){
  this.initialMaxSize=this.maxSize=maxSize;
  this.increment=increment;
  this.model=model;
  this.cell=cell;
  this.seq=0;
  tmpElem=Document.get().createDivElement();
  showMoreElem=Document.get().createDivElement();
  showMoreElem.setInnerHTML("String_Node_Str");
  showFewerElem=Document.get().createDivElement();
  showFewerElem.setInnerHTML("String_Node_Str");
  showOrHide(showMoreElem,false);
  showOrHide(showFewerElem,false);
  DivElement outerDiv=Document.get().createDivElement();
  DivElement innerDiv=Document.get().createDivElement();
  outerDiv.appendChild(innerDiv);
  outerDiv.appendChild(showFewerElem);
  outerDiv.appendChild(showMoreElem);
  setElement(outerDiv);
  sinkEvents(Event.ONCLICK);
  sinkEvents(Event.ONCHANGE);
}
Program: 54186
Project: 54186
Buggy source:
@Override public void onBrowserEvent(Event event){
  Element target=event.getEventTarget().cast();
  String idxString="String_Node_Str";
  while ((target != null) && ((idxString=target.getAttribute("String_Node_Str")).length() == 0)) {
    target=target.getParentElement();
  }
  if (idxString.length() > 0) {
    int idx=Integer.parseInt(idxString);
    cell.onBrowserEvent(target,data.get(idx),null,event,valueUpdater);
  }
}

Fixed version (ground truth):
@Override public void onBrowserEvent(Event event){
  Element target=event.getEventTarget().cast();
  if (target.getParentElement() == showMoreElem) {
    this.maxSize+=increment;
    reg.setRangeOfInterest(0,maxSize);
  }
 else   if (target.getParentElement() == showFewerElem) {
    this.maxSize=Math.max(initialMaxSize,maxSize - increment);
    reg.setRangeOfInterest(0,maxSize);
  }
 else {
    String idxString="String_Node_Str";
    while ((target != null) && ((idxString=target.getAttribute("String_Node_Str")).length() == 0)) {
      target=target.getParentElement();
    }
    if (idxString.length() > 0) {
      int idx=Integer.parseInt(idxString);
      cell.onBrowserEvent(target,data.get(idx),null,event,valueUpdater);
    }
  }
}
Program: 54187
Project: 54187
Buggy source:
public void onDataChanged(ListEvent<T> event){
  int start=event.getStart(), len=event.getLength();
  List<T> values=event.getValues();
  for (int i=0; i < len; ++i) {
    data.set(start + i,values.get(i));
  }
  render(start,len,values);
}

Fixed version (ground truth):
public void onDataChanged(ListEvent<T> event){
  int start=event.getStart();
  int len=event.getLength();
  List<T> values=event.getValues();
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < len; i++) {
    sb.append("String_Node_Str" + (start + i) + "String_Node_Str"+ seq+++ "String_Node_Str");
    cell.render(values.get(i),null,sb);
    sb.append("String_Node_Str");
  }
  Element parent=getElement().getFirstChildElement();
  if (start == 0 && len == maxSize) {
    parent.setInnerHTML(sb.toString());
  }
 else {
    makeElements();
    tmpElem.setInnerHTML(sb.toString());
    for (int i=0; i < len; i++) {
      Element child=parent.getChild(start + i).cast();
      parent.replaceChild(tmpElem.getChild(0),child);
    }
  }
}
Program: 54188
Project: 54188
Buggy source:
public boolean remove(Object o){
  return flush(list.remove(o));
}

Fixed version (ground truth):
public boolean remove(Object o){
  int index=indexOf(o);
  if (index == -1) {
    return false;
  }
  remove(index);
  return true;
}
Program: 54189
Project: 54189
Buggy source:
public boolean removeAll(Collection<?> c){
  return flush(list.removeAll(c));
}

Fixed version (ground truth):
public boolean removeAll(Collection<?> c){
  boolean toRet=list.removeAll(c);
  minModified=0;
  maxModified=size();
  modified=true;
  return flush(toRet);
}
Program: 54190
Project: 54190
Buggy source:
public boolean add(T e){
  return flush(list.add(e));
}

Fixed version (ground truth):
public boolean add(T e){
  boolean toRet=list.add(e);
  minModified=Math.min(minModified,size() - 1);
  maxModified=size();
  modified=true;
  return flush(toRet);
}
Program: 54191
Project: 54191
Buggy source:
public T set(int index,T element){
  T toRet=list.set(index,element);
  flush();
  return toRet;
}

Fixed version (ground truth):
public T set(int index,T element){
  T toRet=list.set(index,element);
  minModified=Math.min(minModified,index);
  maxModified=Math.max(maxModified,index + 1);
  modified=true;
  flush();
  return toRet;
}
Program: 54192
Project: 54192
Buggy source:
public void clear(){
  list.clear();
  flush();
}

Fixed version (ground truth):
public void clear(){
  list.clear();
  minModified=maxModified=0;
  modified=true;
  flush();
}
Program: 54193
Project: 54193
Buggy source:
public ListWrapper(List<T> list){
  this.list=list;
}

Fixed version (ground truth):
public ListWrapper(List<T> list){
  this.list=list;
  minModified=0;
  maxModified=list.size();
  modified=true;
}
Program: 54194
Project: 54194
Buggy source:
public void execute(){
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  updateViewData(0,list.size(),list);
  flushPending=false;
}

Fixed version (ground truth):
public void execute(){
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  if (modified) {
    int length=maxModified - minModified;
    updateViewData(minModified,length,list.subList(minModified,maxModified));
    modified=false;
  }
  minModified=Integer.MAX_VALUE;
  maxModified=Integer.MIN_VALUE;
  flushPending=false;
}
Program: 54195
Project: 54195
Buggy source:
public boolean addAll(int index,Collection<? extends T> c){
  return flush(list.addAll(index,c));
}

Fixed version (ground truth):
public boolean addAll(int index,Collection<? extends T> c){
  try {
    boolean toRet=list.addAll(index,c);
    minModified=Math.min(minModified,index);
    maxModified=size();
    modified=true;
    return flush(toRet);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(e.getMessage());
  }
}
Program: 54196
Project: 54196
Buggy source:
public boolean retainAll(Collection<?> c){
  return flush(list.retainAll(c));
}

Fixed version (ground truth):
public boolean retainAll(Collection<?> c){
  boolean toRet=list.retainAll(c);
  minModified=0;
  maxModified=size();
  modified=true;
  return flush(toRet);
}
Program: 54197
Project: 54197
Buggy source:
public void execute(){
  p.animate(100,new AnimationCallback(){
    public void onLayout(    Layer layer,    double progress){
    }
    public void onAnimationComplete(){
      finishTest();
    }
  }
);
}

Fixed version (ground truth):
public void execute(){
  int offsetWidth=lp.getOffsetWidth();
  int offsetHeight=lp.getOffsetHeight();
  assertTrue(offsetWidth > 0);
  assertTrue(offsetHeight > 0);
  finishTest();
}
Program: 54198
Project: 54198
Buggy source:
/** 
 * Testing for public void java.util.Date.setHours(int). 
 */
public void testSetHours(){
  for (int i=0; i < 24; i++) {
    Date accum0=create();
    accum0.setHours(i);
    assertEquals(accum0.getHours(),i);
  }
}

Fixed version (ground truth):
/** 
 * Testing for public void java.util.Date.setHours(int). 
 */
public void testSetHours(){
  for (int i=0; i < 24; i++) {
    Date accum0=create();
    if (isDst(accum0)) {
      return;
    }
    accum0.setHours(i);
    assertEquals(accum0.getHours(),i);
  }
}
Program: 54199
Project: 54199
Buggy source:
@Override public void render(String value,StringBuilder sb){
  sb.append("String_Node_Str");
  if (value.charAt(0) == '-') {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
  }
  sb.append(value);
  sb.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public void render(String value,StringBuilder sb){
  if (value == null || value.length() == 0) {
    return;
  }
  sb.append("String_Node_Str");
  if (value.charAt(0) == '-') {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
  }
  sb.append(value);
  sb.append("String_Node_Str");
}
Program: 54200
Project: 54200
Buggy source:
@Override public void render(String value,StringBuilder sb){
  sb.append("String_Node_Str");
  if (highlightRegex == null || highlightRegex.length() == 0) {
    sb.append(value);
    sb.append("String_Node_Str");
    return;
  }
  RegExp regExp=RegExp.compile(highlightRegex,"String_Node_Str");
  int fromIndex=0;
  int length=value.length();
  MatchResult result;
  while (fromIndex < length) {
    result=regExp.exec(value);
    if (result == null) {
      break;
    }
    int index=result.getIndex();
    String match=result.getGroup(0);
    sb.append(value.substring(fromIndex,index));
    sb.append("String_Node_Str");
    sb.append(match);
    sb.append("String_Node_Str");
    fromIndex=index + match.length();
    regExp.setLastIndex(fromIndex);
  }
  if (fromIndex < length) {
    sb.append(value.substring(fromIndex));
  }
  sb.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public void render(String value,StringBuilder sb){
  sb.append("String_Node_Str");
  if (highlightRegex == null) {
    sb.append(value);
    sb.append("String_Node_Str");
    return;
  }
  int fromIndex=0;
  int length=value.length();
  MatchResult result;
  highlightRegex.setLastIndex(0);
  while (fromIndex < length) {
    result=highlightRegex.exec(value);
    if (result == null) {
      break;
    }
    int index=result.getIndex();
    String match=result.getGroup(0);
    sb.append(value.substring(fromIndex,index));
    sb.append("String_Node_Str");
    sb.append(match);
    sb.append("String_Node_Str");
    fromIndex=index + match.length();
    highlightRegex.setLastIndex(fromIndex);
  }
  if (fromIndex < length) {
    sb.append(value.substring(fromIndex));
  }
  sb.append("String_Node_Str");
}
Program: 54201
Project: 54201
Buggy source:
public void setHighlightRegex(String highlightRegex){
  this.highlightRegex=highlightRegex;
}

Fixed version (ground truth):
public void setHighlightRegex(String highlightText){
  if (highlightText != null && highlightText.length() > 0) {
    highlightRegex=RegExp.compile(highlightText,"String_Node_Str");
  }
 else {
    highlightRegex=null;
  }
}
Program: 54202
Project: 54202
Buggy source:
private Result getQuotes(SortedSet<String> symbols,Range range){
  int start=range.getStart();
  int end=Math.min(start + range.getLength(),symbols.size());
  if (end <= start) {
    return new Result(new StockQuoteList(0),0);
  }
  SortedSet<String> symbolsInRange=new TreeSet<String>();
  int idx=0;
  for (  String symbol : symbols) {
    if (idx >= start && idx < end) {
      symbolsInRange.add(symbol);
    }
    idx++;
  }
  SortedSet<String> symbolsToQuery=new TreeSet<String>();
  long now=System.currentTimeMillis();
  for (  String symbol : symbolsInRange) {
    Quote quote=QUOTES.get(symbol);
    if (quote == null || now - quote.getCreatedTime() >= 5000) {
      symbolsToQuery.add(symbol);
    }
 else {
    }
  }
  if (symbolsToQuery.size() > 0) {
    GoogleFinance.queryServer(symbolsToQuery,QUOTES);
  }
  StockQuoteList toRet=new StockQuoteList(start);
  for (  String symbol : symbolsInRange) {
    Quote quote=QUOTES.get(symbol);
    if (quote == null) {
      System.out.println("String_Node_Str" + symbol);
    }
 else {
      String name=Stocks.companyNamesBySymbol.get(symbol);
      PlayerStatus player=ensurePlayer();
      Integer sharesOwned=player.getSharesOwned(symbol);
      boolean favorite=player.isFavorite(symbol);
      int totalPaid=player.getAverageCostBasis(symbol);
      toRet.add(new StockQuote(symbol,name,quote.getPrice(),quote.getChange(),sharesOwned == null ? 0 : sharesOwned.intValue(),favorite,totalPaid));
    }
  }
  return new Result(toRet,symbols.size());
}

Fixed version (ground truth):
private Result getQuotes(SortedSet<String> symbols,Range range){
  int start=range.getStart();
  int end=Math.min(start + range.getLength(),symbols.size());
  if (end <= start) {
    return new Result(new StockQuoteList(0),0);
  }
  SortedSet<String> symbolsInRange=new TreeSet<String>();
  int idx=0;
  for (  String symbol : symbols) {
    if (idx >= start && idx < end) {
      symbolsInRange.add(symbol);
    }
    idx++;
  }
  SortedSet<String> symbolsToQuery=new TreeSet<String>();
  long now=System.currentTimeMillis();
  for (  String symbol : symbolsInRange) {
    Quote quote=QUOTES.get(symbol);
    if (quote == null || now - quote.getCreatedTime() >= 5000) {
      symbolsToQuery.add(symbol);
    }
 else {
    }
  }
  if (symbolsToQuery.size() > 0) {
    GoogleFinance.queryServer(symbolsToQuery,QUOTES);
  }
  StockQuoteList toRet=new StockQuoteList(start);
  for (  String symbol : symbolsInRange) {
    Quote quote=QUOTES.get(symbol);
    if (quote == null) {
      System.out.println("String_Node_Str" + symbol);
    }
 else {
      String name=Stocks.companyNamesBySymbol.get(symbol);
      PlayerStatus player=ensurePlayer();
      Integer sharesOwned=player.getSharesOwned(symbol);
      boolean favorite=player.isFavorite(symbol);
      int totalPaid=player.getAverageCostBasis(symbol);
      toRet.add(new StockQuote(symbol,name,quote.getPrice(),quote.getChange(),sharesOwned == null ? 0 : sharesOwned.intValue(),favorite,totalPaid));
    }
  }
  return new Result(toRet,toRet.size());
}
Program: 54203
Project: 54203
Buggy source:
private Result getSearchQuotes(String query,Range searchRange){
  SortedSet<String> symbols=new TreeSet<String>();
  boolean queryIsAlpha=true;
  for (int i=0; i < query.length(); i++) {
    char c=query.charAt(i);
    if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) {
      queryIsAlpha=false;
      break;
    }
  }
  query=query.toUpperCase(Locale.US);
  if (queryIsAlpha) {
    getTickersByPrefix(query,symbols);
  }
  Pattern pattern=compile("String_Node_Str" + query + "String_Node_Str");
  if (pattern != null) {
    if (!queryIsAlpha) {
      getTickersBySymbolRegex(pattern,symbols);
    }
    getTickersByNameRegex(pattern,symbols);
  }
  return getQuotes(symbols,searchRange);
}

Fixed version (ground truth):
private Result getSearchQuotes(String query,Range searchRange){
  SortedSet<String> symbols=new TreeSet<String>();
  boolean queryIsAlpha=true;
  for (int i=0; i < query.length(); i++) {
    char c=query.charAt(i);
    if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) {
      queryIsAlpha=false;
      break;
    }
  }
  query=query.toUpperCase(Locale.US);
  if (queryIsAlpha) {
    getTickersByPrefix(query,symbols);
  }
  Pattern pattern=compile("String_Node_Str" + query + "String_Node_Str");
  if (pattern != null) {
    if (!queryIsAlpha) {
      getTickersBySymbolRegex(pattern,symbols);
    }
    if (query.length() > 2) {
      getTickersByNameRegex(pattern,symbols);
    }
  }
  return getQuotes(symbols,searchRange);
}
Program: 54204
Project: 54204
Buggy source:
/** 
 * Returns the precision of this   {@code BigDecimal}. The precision is the number of decimal digits used to represent this decimal. It is equivalent to the number of digits of the unscaled value. The precision of   {@code 0}is   {@code 1} (independent of the scale).
 * @return the precision of this {@code BigDecimal}.
 */
public int precision(){
  if (precision > 0) {
    return precision;
  }
  int decimalDigits=1;
  double doubleUnsc=1;
  if (bitLength < 1024) {
    if (bitLength >= 54) {
      doubleUnsc=getUnscaledValue().doubleValue();
    }
 else     if (bitLength >= 1) {
      doubleUnsc=smallValue;
    }
    decimalDigits+=(int)Math.log10(Math.abs(doubleUnsc));
  }
 else {
    decimalDigits+=(bitLength - 1) * LOG10_2;
    if (getUnscaledValue().divide(Multiplication.powerOf10(decimalDigits)).signum() != 0) {
      decimalDigits++;
    }
  }
  precision=decimalDigits;
  return precision;
}

Fixed version (ground truth):
/** 
 * Returns the precision of this   {@code BigDecimal}. The precision is the number of decimal digits used to represent this decimal. It is equivalent to the number of digits of the unscaled value. The precision of   {@code 0}is   {@code 1} (independent of the scale).
 * @return the precision of this {@code BigDecimal}.
 */
public int precision(){
  if (precision > 0) {
    return precision;
  }
  double decimalDigits=1;
  double doubleUnsc=1;
  if (bitLength < SMALL_VALUE_BITS) {
    if (bitLength >= 1) {
      doubleUnsc=smallValue;
    }
    decimalDigits+=Math.log10(Math.abs(doubleUnsc));
  }
 else {
    decimalDigits+=(bitLength - 1) * LOG10_2;
    if (getUnscaledValue().divide(Multiplication.powerOf10(decimalDigits)).signum() != 0) {
      decimalDigits++;
    }
  }
  precision=(int)decimalDigits;
  return precision;
}
Program: 54205
Project: 54205
Buggy source:
private static BigDecimal addAndMult10(BigDecimal thisValue,BigDecimal augend,double diffScale){
  if (diffScale < DOUBLE_TEN_POW.length && Math.max(thisValue.bitLength,augend.bitLength + DOUBLE_TEN_POW_BIT_LENGTH[(int)diffScale]) + 1 < 54) {
    return valueOf(thisValue.smallValue + augend.smallValue * DOUBLE_TEN_POW[(int)diffScale],thisValue.scale);
  }
  return new BigDecimal(thisValue.getUnscaledValue().add(Multiplication.multiplyByTenPow(augend.getUnscaledValue(),(int)diffScale)),thisValue.scale);
}

Fixed version (ground truth):
private static BigDecimal addAndMult10(BigDecimal thisValue,BigDecimal augend,double diffScale){
  if (diffScale < DOUBLE_TEN_POW.length && Math.max(thisValue.bitLength,augend.bitLength + DOUBLE_TEN_POW_BIT_LENGTH[(int)diffScale]) + 1 < SMALL_VALUE_BITS) {
    return valueOf(thisValue.smallValue + augend.smallValue * DOUBLE_TEN_POW[(int)diffScale],thisValue.scale);
  }
  return new BigDecimal(thisValue.getUnscaledValue().add(Multiplication.multiplyByTenPow(augend.getUnscaledValue(),(int)diffScale)),thisValue.scale);
}
Program: 54207
Project: 54207
Buggy source:
/** 
 * Returns the sign of this   {@code BigDecimal}.
 * @return {@code -1} if {@code this < 0},   {@code 0} if {@code this == 0},  {@code 1} if {@code this > 0}.
 */
public int signum(){
  if (bitLength < 54) {
    return this.smallValue < 0 ? -1 : this.smallValue > 0 ? 1 : 0;
  }
  return getUnscaledValue().signum();
}

Fixed version (ground truth):
/** 
 * Returns the sign of this   {@code BigDecimal}.
 * @return {@code -1} if {@code this < 0},   {@code 0} if {@code this == 0},  {@code 1} if {@code this > 0}.
 */
public int signum(){
  if (bitLength < SMALL_VALUE_BITS) {
    return this.smallValue < 0 ? -1 : this.smallValue > 0 ? 1 : 0;
  }
  return getUnscaledValue().signum();
}
Program: 54208
Project: 54208
Buggy source:
/** 
 * It does all rounding work of the public method   {@code round(MathContext)}, performing an inplace rounding without creating a new object.
 * @param mc the {@code MathContext} for perform the rounding.
 * @see #round(MathContext)
 */
private void inplaceRound(MathContext mc){
  int mcPrecision=mc.getPrecision();
  if (approxPrecision() - mcPrecision <= 0 || mcPrecision == 0) {
    return;
  }
  int discardedPrecision=precision() - mcPrecision;
  if ((discardedPrecision <= 0)) {
    return;
  }
  if (this.bitLength < 54) {
    smallRound(mc,discardedPrecision);
    return;
  }
  BigInteger sizeOfFraction=Multiplication.powerOf10(discardedPrecision);
  BigInteger[] integerAndFraction=getUnscaledValue().divideAndRemainder(sizeOfFraction);
  double newScale=scale - discardedPrecision;
  int compRem;
  BigDecimal tempBD;
  if (integerAndFraction[1].signum() != 0) {
    compRem=(integerAndFraction[1].abs().shiftLeftOneBit().compareTo(sizeOfFraction));
    compRem=roundingBehavior(integerAndFraction[0].testBit(0) ? 1 : 0,integerAndFraction[1].signum() * (5 + compRem),mc.getRoundingMode());
    if (compRem != 0) {
      integerAndFraction[0]=integerAndFraction[0].add(BigInteger.valueOf(compRem));
    }
    tempBD=new BigDecimal(integerAndFraction[0]);
    if (tempBD.precision() > mcPrecision) {
      integerAndFraction[0]=integerAndFraction[0].divide(BigInteger.TEN);
      newScale--;
    }
  }
  scale=toIntScale(newScale);
  precision=mcPrecision;
  setUnscaledValue(integerAndFraction[0]);
}

Fixed version (ground truth):
/** 
 * It does all rounding work of the public method   {@code round(MathContext)}, performing an inplace rounding without creating a new object.
 * @param mc the {@code MathContext} for perform the rounding.
 * @see #round(MathContext)
 */
private void inplaceRound(MathContext mc){
  int mcPrecision=mc.getPrecision();
  if (approxPrecision() - mcPrecision < 0 || mcPrecision == 0) {
    return;
  }
  int discardedPrecision=precision() - mcPrecision;
  if ((discardedPrecision <= 0)) {
    return;
  }
  if (this.bitLength < SMALL_VALUE_BITS) {
    smallRound(mc,discardedPrecision);
    return;
  }
  BigInteger sizeOfFraction=Multiplication.powerOf10(discardedPrecision);
  BigInteger[] integerAndFraction=getUnscaledValue().divideAndRemainder(sizeOfFraction);
  double newScale=scale - discardedPrecision;
  int compRem;
  BigDecimal tempBD;
  if (integerAndFraction[1].signum() != 0) {
    compRem=(integerAndFraction[1].abs().shiftLeftOneBit().compareTo(sizeOfFraction));
    compRem=roundingBehavior(integerAndFraction[0].testBit(0) ? 1 : 0,integerAndFraction[1].signum() * (5 + compRem),mc.getRoundingMode());
    if (compRem != 0) {
      integerAndFraction[0]=integerAndFraction[0].add(BigInteger.valueOf(compRem));
    }
    tempBD=new BigDecimal(integerAndFraction[0]);
    if (tempBD.precision() > mcPrecision) {
      integerAndFraction[0]=integerAndFraction[0].divide(BigInteger.TEN);
      newScale--;
    }
  }
  scale=toIntScale(newScale);
  precision=mcPrecision;
  setUnscaledValue(integerAndFraction[0]);
}
Program: 54211
Project: 54211
Buggy source:
/** 
 * Returns a hash code for this   {@code BigDecimal}.
 * @return hash code for {@code this}.
 */
@Override public int hashCode(){
  if (hashCode != 0) {
    return hashCode;
  }
  if (bitLength < 54) {
    long longValue=(long)smallValue;
    hashCode=(int)(longValue & 0xffffffff);
    hashCode=33 * hashCode + (int)((longValue >> 32) & 0xffffffff);
    hashCode=17 * hashCode + (int)scale;
    return hashCode;
  }
  hashCode=17 * intVal.hashCode() + (int)scale;
  return hashCode;
}

Fixed version (ground truth):
/** 
 * Returns a hash code for this   {@code BigDecimal}.
 * @return hash code for {@code this}.
 */
@Override public int hashCode(){
  if (hashCode != 0) {
    return hashCode;
  }
  if (bitLength < SMALL_VALUE_BITS) {
    long longValue=(long)smallValue;
    hashCode=(int)(longValue & 0xffffffff);
    hashCode=33 * hashCode + (int)((longValue >> 32) & 0xffffffff);
    hashCode=17 * hashCode + (int)scale;
    return hashCode;
  }
  hashCode=17 * intVal.hashCode() + (int)scale;
  return hashCode;
}
Program: 54212
Project: 54212
Buggy source:
/** 
 * Returns a new   {@code BigDecimal} whose value is {@code this} 10^{@code n}. The scale of the result is   {@code this.scale()} - {@code n}. The precision of the result is the precision of   {@code this}. <p> This method has the same effect as   {@link #movePointRight}, except that the precision is not changed.
 * @param n number of places the decimal point has to be moved.
 * @return {@code this * 10^n}
 */
public BigDecimal scaleByPowerOfTen(int n){
  double newScale=scale - n;
  if (bitLength < 54) {
    if (smallValue == 0) {
      return zeroScaledBy(newScale);
    }
    return valueOf(smallValue,toIntScale(newScale));
  }
  return new BigDecimal(getUnscaledValue(),toIntScale(newScale));
}

Fixed version (ground truth):
/** 
 * Returns a new   {@code BigDecimal} whose value is {@code this} 10^{@code n}. The scale of the result is   {@code this.scale()} - {@code n}. The precision of the result is the precision of   {@code this}. <p> This method has the same effect as   {@link #movePointRight}, except that the precision is not changed.
 * @param n number of places the decimal point has to be moved.
 * @return {@code this * 10^n}
 */
public BigDecimal scaleByPowerOfTen(int n){
  double newScale=scale - n;
  if (bitLength < SMALL_VALUE_BITS) {
    if (smallValue == 0) {
      return zeroScaledBy(newScale);
    }
    return valueOf(smallValue,toIntScale(newScale));
  }
  return new BigDecimal(getUnscaledValue(),toIntScale(newScale));
}
Program: 54213
Project: 54213
Buggy source:
private void setUnscaledValue(BigInteger unscaledValue){
  this.intVal=unscaledValue;
  this.bitLength=unscaledValue.bitLength();
  if (this.bitLength < 54) {
    this.smallValue=unscaledValue.longValue();
  }
}

Fixed version (ground truth):
private void setUnscaledValue(BigInteger unscaledValue){
  this.intVal=unscaledValue;
  this.bitLength=unscaledValue.bitLength();
  if (this.bitLength < SMALL_VALUE_BITS) {
    this.smallValue=unscaledValue.longValue();
  }
}
Program: 54214
Project: 54214
Buggy source:
private static BigDecimal divideBigIntegers(BigInteger scaledDividend,BigInteger scaledDivisor,int scale,RoundingMode roundingMode){
  BigInteger[] quotAndRem=scaledDividend.divideAndRemainder(scaledDivisor);
  BigInteger quotient=quotAndRem[0];
  BigInteger remainder=quotAndRem[1];
  if (remainder.signum() == 0) {
    return new BigDecimal(quotient,scale);
  }
  int sign=scaledDividend.signum() * scaledDivisor.signum();
  int compRem;
  if (scaledDivisor.bitLength() < 54) {
    long rem=remainder.longValue();
    long divisor=scaledDivisor.longValue();
    compRem=longCompareTo(Math.abs(rem) << 1,Math.abs(divisor));
    compRem=roundingBehavior(quotient.testBit(0) ? 1 : 0,sign * (5 + compRem),roundingMode);
  }
 else {
    compRem=remainder.abs().shiftLeftOneBit().compareTo(scaledDivisor.abs());
    compRem=roundingBehavior(quotient.testBit(0) ? 1 : 0,sign * (5 + compRem),roundingMode);
  }
  if (compRem != 0) {
    if (quotient.bitLength() < 54) {
      return valueOf(quotient.longValue() + compRem,scale);
    }
    quotient=quotient.add(BigInteger.valueOf(compRem));
    return new BigDecimal(quotient,scale);
  }
  return new BigDecimal(quotient,scale);
}

Fixed version (ground truth):
private static BigDecimal divideBigIntegers(BigInteger scaledDividend,BigInteger scaledDivisor,int scale,RoundingMode roundingMode){
  BigInteger[] quotAndRem=scaledDividend.divideAndRemainder(scaledDivisor);
  BigInteger quotient=quotAndRem[0];
  BigInteger remainder=quotAndRem[1];
  if (remainder.signum() == 0) {
    return new BigDecimal(quotient,scale);
  }
  int sign=scaledDividend.signum() * scaledDivisor.signum();
  int compRem;
  if (scaledDivisor.bitLength() < SMALL_VALUE_BITS) {
    long rem=remainder.longValue();
    long divisor=scaledDivisor.longValue();
    compRem=longCompareTo(Math.abs(rem) << 1,Math.abs(divisor));
    compRem=roundingBehavior(quotient.testBit(0) ? 1 : 0,sign * (5 + compRem),roundingMode);
  }
 else {
    compRem=remainder.abs().shiftLeftOneBit().compareTo(scaledDivisor.abs());
    compRem=roundingBehavior(quotient.testBit(0) ? 1 : 0,sign * (5 + compRem),roundingMode);
  }
  if (compRem != 0) {
    if (quotient.bitLength() < SMALL_VALUE_BITS) {
      return valueOf(quotient.longValue() + compRem,scale);
    }
    quotient=quotient.add(BigInteger.valueOf(compRem));
    return new BigDecimal(quotient,scale);
  }
  return new BigDecimal(quotient,scale);
}
Program: 54215
Project: 54215
Buggy source:
private BigDecimal movePoint(double newScale){
  if (isZero()) {
    return zeroScaledBy(Math.max(newScale,0));
  }
  if (newScale >= 0) {
    if (bitLength < 54) {
      return valueOf(smallValue,toIntScale(newScale));
    }
    return new BigDecimal(getUnscaledValue(),toIntScale(newScale));
  }
  if (-newScale < DOUBLE_TEN_POW.length && bitLength + DOUBLE_TEN_POW_BIT_LENGTH[(int)-newScale] < 54) {
    return valueOf(smallValue * DOUBLE_TEN_POW[(int)-newScale],0);
  }
  return new BigDecimal(Multiplication.multiplyByTenPow(getUnscaledValue(),(int)-newScale),0);
}

Fixed version (ground truth):
private BigDecimal movePoint(double newScale){
  if (isZero()) {
    return zeroScaledBy(Math.max(newScale,0));
  }
  if (newScale >= 0) {
    if (bitLength < SMALL_VALUE_BITS) {
      return valueOf(smallValue,toIntScale(newScale));
    }
    return new BigDecimal(getUnscaledValue(),toIntScale(newScale));
  }
  if (-newScale < DOUBLE_TEN_POW.length && bitLength + DOUBLE_TEN_POW_BIT_LENGTH[(int)-newScale] < SMALL_VALUE_BITS) {
    return valueOf(smallValue * DOUBLE_TEN_POW[(int)-newScale],0);
  }
  return new BigDecimal(Multiplication.multiplyByTenPow(getUnscaledValue(),(int)-newScale),0);
}
Program: 54216
Project: 54216
Buggy source:
private BigDecimal(long smallValue,int scale){
  this.scale=scale;
  this.bitLength=bitLength(smallValue);
  if (bitLength < 54) {
    this.smallValue=smallValue;
  }
 else {
    this.intVal=BigInteger.valueOf(smallValue);
  }
}

Fixed version (ground truth):
private BigDecimal(long smallValue,int scale){
  this.scale=scale;
  this.bitLength=bitLength(smallValue);
  if (bitLength < SMALL_VALUE_BITS) {
    this.smallValue=smallValue;
  }
 else {
    this.intVal=BigInteger.valueOf(smallValue);
  }
}
Program: 54217
Project: 54217
Buggy source:
/** 
 * Returns   {@code true} if {@code x} is a {@code BigDecimal} instance and ifthis instance is equal to this big decimal. Two big decimals are equal if their unscaled value and their scale is equal. For example, 1.0 (10*10^(-1)) is not equal to 1.00 (100*10^(-2)). Similarly, zero instances are not equal if their scale differs.
 * @param x object to be compared with {@code this}.
 * @return true if {@code x} is a {@code BigDecimal} and {@code this == x}.
 */
@Override public boolean equals(Object x){
  if (this == x) {
    return true;
  }
  if (x instanceof BigDecimal) {
    BigDecimal x1=(BigDecimal)x;
    return x1.scale == scale && (bitLength < 54 ? (x1.smallValue == smallValue) : intVal.equals(x1.intVal));
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if {@code x} is a {@code BigDecimal} instance and ifthis instance is equal to this big decimal. Two big decimals are equal if their unscaled value and their scale is equal. For example, 1.0 (10*10^(-1)) is not equal to 1.00 (100*10^(-2)). Similarly, zero instances are not equal if their scale differs.
 * @param x object to be compared with {@code this}.
 * @return true if {@code x} is a {@code BigDecimal} and {@code this == x}.
 */
@Override public boolean equals(Object x){
  if (this == x) {
    return true;
  }
  if (x instanceof BigDecimal) {
    BigDecimal x1=(BigDecimal)x;
    return x1.scale == scale && (bitLength < SMALL_VALUE_BITS ? (x1.smallValue == smallValue) : intVal.equals(x1.intVal));
  }
  return false;
}