nus-yam/ex-repair huggingface dataset:
Program: 53855
Project: 53855
Buggy source:
public void putAll(Map<? extends K,? extends V> m){
  ensureSizeFor(size + m.size());
  internalPutAll(m);
}

Fixed version (ground truth):
public void putAll(Map<? extends K,? extends V> m){
  resizeForJoin(m.size());
  for (  Entry<? extends K,? extends V> entry : m.entrySet()) {
    put(entry.getKey(),entry.getValue());
  }
}
Program: 53856
Project: 53856
Buggy source:
public boolean hasNext(){
  return index < keys.length;
}

Fixed version (ground truth):
public boolean hasNext(){
  if (coModCheckKeys != keys) {
    throw new ConcurrentModificationException();
  }
  advanceToItem();
  return index < keys.length;
}
Program: 53857
Project: 53857
Buggy source:
@Override public boolean addAll(Collection<? extends Entry<K,V>> c){
  HashMap.this.ensureSizeFor(size() + c.size());
  return super.addAll(c);
}

Fixed version (ground truth):
@Override public boolean addAll(Collection<? extends Entry<K,V>> c){
  HashMap.this.resizeForJoin(c.size());
  return super.addAll(c);
}
Program: 53858
Project: 53858
Buggy source:
/** 
 * Ensures the map is large enough to contain the specified number of entries. Default access to avoid synthetic accessors from inner classes.
 */
void ensureSizeFor(int expectedSize){
  if (keys.length * 3 >= expectedSize * 4) {
    return;
  }
  int newCapacity=keys.length << 1;
  while (newCapacity * 3 < expectedSize * 4) {
    newCapacity<<=1;
  }
  Object[] oldKeys=keys;
  Object[] oldValues=values;
  initTable(newCapacity);
  for (int i=0; i < oldKeys.length; ++i) {
    Object k=oldKeys[i];
    if (k != null) {
      int newIndex=getKeyIndex(unmaskNullKey(k));
      while (keys[newIndex] != null) {
        if (++newIndex == keys.length) {
          newIndex=0;
        }
      }
      keys[newIndex]=k;
      values[newIndex]=oldValues[i];
    }
  }
}

Fixed version (ground truth):
/** 
 * Ensures the map is large enough to contain the specified number of entries. Default access to avoid synthetic accessors from inner classes.
 */
boolean ensureSizeFor(int expectedSize){
  if (keys.length * 3 >= expectedSize * 4) {
    return false;
  }
  int newCapacity=keys.length << 1;
  while (newCapacity * 3 < expectedSize * 4) {
    newCapacity<<=1;
  }
  Object[] oldKeys=keys;
  Object[] oldValues=values;
  initTable(newCapacity);
  for (int i=0; i < oldKeys.length; ++i) {
    Object k=oldKeys[i];
    if (k != null) {
      int newIndex=getKeyIndex(unmaskNullKey(k));
      while (keys[newIndex] != null) {
        if (++newIndex == keys.length) {
          newIndex=0;
        }
      }
      keys[newIndex]=k;
      values[newIndex]=oldValues[i];
    }
  }
  return true;
}
Program: 53859
Project: 53859
Buggy source:
/** 
 * Determines whether the given class fully implements an interface (either directly or via inherited methods).
 */
private boolean classFullyImplements(JClassType cls,JClassType intf){
  if (!intf.isAssignableFrom(cls)) {
    return false;
  }
  for (  JMethod meth : intf.getInheritableMethods()) {
    if (!classImplementsMethod(cls,meth)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determines whether the given class fully implements an interface (either directly or via inherited methods).
 */
private boolean classFullyImplements(JClassType cls,JClassType intf){
  if ((intf.getMethods().length > 0) && !intf.isAssignableFrom(cls)) {
    return false;
  }
  for (  JMethod meth : intf.getInheritableMethods()) {
    if (!classImplementsMethod(cls,meth)) {
      return false;
    }
  }
  return true;
}
Program: 53860
Project: 53860
Buggy source:
/** 
 * This constructor may be used by subclasses to explicitly use an existing element. This element must be an &lt;img&gt; element.
 * @param element the element to be used
 */
protected Image(Element element){
  ImageElement.as(element);
  setElement(element);
}

Fixed version (ground truth):
/** 
 * This constructor may be used by subclasses to explicitly use an existing element. This element must be an &lt;img&gt; element.
 * @param element the element to be used
 */
protected Image(Element element){
  ImageElement.as(element);
  setElement(element);
  changeState(new UnclippedState(element));
}
Program: 53861
Project: 53861
Buggy source:
/** 
 * Determines whether the given   {@link JavaScriptObject} is a DOM node. A<code>null</code> object will cause this method to return <code>false</code>.
 */
public static native boolean is(JavaScriptObject o);

Fixed version (ground truth):
/** 
 * Determines whether the given   {@link JavaScriptObject} is a DOM node. A<code>null</code> object will cause this method to return <code>false</code>. The try catch is needed for the firefox permission error: "Permission denied to access property 'nodeType'"
 */
public static native boolean is(JavaScriptObject o);
Program: 53862
Project: 53862
Buggy source:
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(FrameTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}
Program: 53863
Project: 53863
Buggy source:
public boolean isChanged(){
  for (  AutoBean<?> bean : editedProxies.values()) {
    AutoBean<?> previous=bean.getTag(Constants.PARENT_OBJECT);
    if (previous == null) {
      Class<?> proxyClass=((EntityProxy)bean.as()).stableId().getProxyClass();
      previous=getRequestFactory().getAutoBeanFactory().create(proxyClass);
    }
    if (!AutoBeanUtils.diff(previous,bean).isEmpty()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isChanged(){
  for (  AutoBean<? extends BaseProxy> bean : editedProxies.values()) {
    AutoBean<?> previous=bean.getTag(Constants.PARENT_OBJECT);
    if (previous == null) {
      Class<?> proxyClass=stableId(bean).getProxyClass();
      previous=getRequestFactory().getAutoBeanFactory().create(proxyClass);
    }
    if (!AutoBeanUtils.diff(previous,bean).isEmpty()) {
      return true;
    }
  }
  return false;
}
Program: 53864
Project: 53864
Buggy source:
private void animate(int duration){
  if (layoutData.size() == 0) {
    return;
  }
  double top=0, bottom=0;
  int i=0;
  for (; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    layoutPanel.setWidgetTopHeight(data.header,top,unit,data.headerSize,unit);
    top+=data.headerSize;
    layoutPanel.setWidgetTopHeight(data.widget,top,unit,0,unit);
    if (i == selectedIndex) {
      break;
    }
  }
  for (int j=layoutData.size() - 1; j > i; --j) {
    LayoutData data=layoutData.get(j);
    layoutPanel.setWidgetBottomHeight(data.header,bottom,unit,data.headerSize,unit);
    layoutPanel.setWidgetBottomHeight(data.widget,bottom,unit,0,unit);
    bottom+=data.headerSize;
  }
  LayoutData data=layoutData.get(selectedIndex);
  layoutPanel.setWidgetTopBottom(data.widget,top,unit,bottom,unit);
  layoutPanel.animate(duration);
}

Fixed version (ground truth):
public void animate(int duration,AnimationCallback callback){
  if (layoutData.size() == 0) {
    if (callback != null) {
      callback.onAnimationComplete();
    }
    return;
  }
  double top=0, bottom=0;
  int i=0;
  for (; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    layoutPanel.setWidgetTopHeight(data.header,top,unit,data.headerSize,unit);
    top+=data.headerSize;
    layoutPanel.setWidgetTopHeight(data.widget,top,unit,0,unit);
    if (i == selectedIndex) {
      break;
    }
  }
  for (int j=layoutData.size() - 1; j > i; --j) {
    LayoutData data=layoutData.get(j);
    layoutPanel.setWidgetBottomHeight(data.header,bottom,unit,data.headerSize,unit);
    layoutPanel.setWidgetBottomHeight(data.widget,bottom,unit,0,unit);
    bottom+=data.headerSize;
  }
  LayoutData data=layoutData.get(selectedIndex);
  layoutPanel.setWidgetTopBottom(data.widget,top,unit,bottom,unit);
  layoutPanel.animate(duration,callback);
}
Program: 53865
Project: 53865
Buggy source:
public boolean remove(Widget child){
  if (child.getParent() != layoutPanel) {
    return false;
  }
  for (int i=0; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    if (data.widget == child) {
      layoutPanel.remove(data.header);
      layoutPanel.remove(data.widget);
      data.header.removeStyleName(HEADER_STYLE);
      data.widget.removeStyleName(CONTENT_STYLE);
      layoutData.remove(i);
      if (selectedIndex == i) {
        selectedIndex=-1;
        if (layoutData.size() > 0) {
          showWidget(layoutData.get(0).widget);
        }
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean remove(Widget child){
  if (child.getParent() != layoutPanel) {
    return false;
  }
  for (int i=0; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    if (data.widget == child) {
      layoutPanel.remove(data.header);
      layoutPanel.remove(data.widget);
      data.header.removeStyleName(HEADER_STYLE);
      data.widget.removeStyleName(CONTENT_STYLE);
      layoutData.remove(i);
      if (selectedIndex == i) {
        selectedIndex=-1;
        if (layoutData.size() > 0) {
          showWidget(layoutData.get(0).widget);
        }
      }
 else {
        if (i <= selectedIndex) {
          selectedIndex--;
        }
        animate(animationDuration);
      }
      return true;
    }
  }
  return false;
}
Program: 53866
Project: 53866
Buggy source:
/** 
 * Tests to ensure that arbitrary widgets can be added/inserted effectively.
 */
public void testInsertWithWidgets(){
  StackLayoutPanel p=new StackLayoutPanel(Unit.EM);
  TextBox wa=new TextBox();
  CheckBox wb=new CheckBox();
  VerticalPanel wc=new VerticalPanel();
  wc.add(new Label("String_Node_Str"));
  wc.add(new Label("String_Node_Str"));
  p.add(new Label("String_Node_Str"),wc,1);
  p.insert(new Label("String_Node_Str"),wb,1,0);
  p.insert(new Label("String_Node_Str"),wa,1,0);
  assertNotNull(p.getHeaderWidget(0));
  assertNotNull(p.getHeaderWidget(1));
  assertNotNull(p.getHeaderWidget(2));
  assertEquals(3,p.getWidgetCount());
}

Fixed version (ground truth):
/** 
 * Tests to ensure that arbitrary widgets can be added/inserted effectively.
 */
public void testInsertWithWidgets(){
  StackLayoutPanel p=new StackLayoutPanel(Unit.EM);
  TextBox wa=new TextBox();
  CheckBox wb=new CheckBox();
  VerticalPanel wc=new VerticalPanel();
  wc.add(new Label("String_Node_Str"));
  wc.add(new Label("String_Node_Str"));
  Label contentA=new Label("String_Node_Str");
  Label contentB=new Label("String_Node_Str");
  Label contentC=new Label("String_Node_Str");
  p.add(contentC,wc,1);
  p.insert(contentB,wb,1,0);
  p.showWidget(1);
  p.insert(contentA,wa,1,0);
  assertEquals(2,p.getVisibleIndex());
  assertEquals(wa,p.getHeaderWidget(0));
  assertEquals(wb,p.getHeaderWidget(1));
  assertEquals(wc,p.getHeaderWidget(2));
  assertEquals(contentA,p.getWidget(0));
  assertEquals(contentB,p.getWidget(1));
  assertEquals(contentC,p.getWidget(2));
  assertEquals(3,p.getWidgetCount());
}
Program: 53867
Project: 53867
Buggy source:
/** 
 * Returns a hash code on the byte code of the class. TODO(zundel): should be a hash on only the public API for this class. 
 */
public String getSignatureHash(){
  if (signatureHash == null) {
    signatureHash=Util.computeStrongName(getBytes());
  }
  return signatureHash;
}

Fixed version (ground truth):
/** 
 * Returns a hash code on the byte code of the class.
 */
public String getSignatureHash(){
  if (signatureHash == null) {
    signatureHash=BytecodeSignatureMaker.getCompileDependencySignature(getBytes());
  }
  return signatureHash;
}
Program: 53868
Project: 53868
Buggy source:
private Object writeReplace(){
  return new SerializedRef(target.getInternalName(),getSignatureHash());
}

Fixed version (ground truth):
protected Object writeReplace(){
  return new SerializedRef(target.getInternalName(),getSignatureHash());
}
Program: 53869
Project: 53869
Buggy source:
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(FrameTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}
Program: 53870
Project: 53870
Buggy source:
Splittable encode(Object obj){
  Splittable value;
  if (obj == null) {
    return LazySplittable.NULL;
  }
 else   if (obj.getClass().isEnum() && getRequestFactory() instanceof EnumMap) {
    value=ValueCodex.encode(((EnumMap)getRequestFactory()).getToken((Enum<?>)obj));
  }
 else   if (ValueCodex.canDecode(obj.getClass())) {
    value=ValueCodex.encode(obj);
  }
 else {
    value=AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(obj));
  }
  return value;
}

Fixed version (ground truth):
Splittable encode(Object obj){
  Splittable value;
  if (obj == null) {
    return LazySplittable.NULL;
  }
 else   if (obj.getClass().isEnum() && getRequestFactory().getAutoBeanFactory() instanceof EnumMap) {
    value=ValueCodex.encode(((EnumMap)getRequestFactory().getAutoBeanFactory()).getToken((Enum<?>)obj));
  }
 else   if (ValueCodex.canDecode(obj.getClass())) {
    value=ValueCodex.encode(obj);
  }
 else {
    value=AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(obj));
  }
  return value;
}
Program: 53873
Project: 53873
Buggy source:
/** 
 * Sometimes a variable reference can be to a local or parameter in an an enclosing method. This is a tricky situation to detect. There's no obvious way to tell, but the clue we can get from JDT is that the local's containing method won't be the same as the method we're currently processing. Once we have this clue, we can use getEmulationPath to compute the current class's binding for that field.
 */
private JVariable possiblyReferenceOuterLocal(JVariable variable,Binding binding){
  if (variable instanceof JLocal || variable instanceof JParameter) {
    LocalVariableBinding localBinding=(LocalVariableBinding)binding;
    if (localBinding.declaringScope.methodScope() != currentMethodScope) {
      variable=null;
      VariableBinding[] vars=currentMethodScope.getEmulationPath(localBinding);
      if (vars == null) {
        return null;
      }
      assert(vars.length == 1);
      VariableBinding varBinding=vars[0];
      if (varBinding instanceof SyntheticArgumentBinding) {
        JType type=(JType)typeMap.get(varBinding.type);
        String name=String.valueOf(varBinding.name);
        for (int i=0; i < currentMethod.getParams().size(); ++i) {
          JParameter param=currentMethod.getParams().get(i);
          if (type == param.getType() && name.equals(param.getName())) {
            variable=param;
            break;
          }
        }
      }
      if (variable == null) {
        variable=(JField)typeMap.get(varBinding);
      }
    }
  }
  return variable;
}

Fixed version (ground truth):
/** 
 * Sometimes a variable reference can be to a local or parameter in an an enclosing method. This is a tricky situation to detect. There's no obvious way to tell, but the clue we can get from JDT is that the local's containing method won't be the same as the method we're currently processing. Once we have this clue, we can use getEmulationPath to compute the current class's binding for that field.
 */
private JVariable possiblyReferenceOuterLocal(JVariable variable,Binding binding){
}
Program: 53875
Project: 53875
Buggy source:
private void fetch(final int start){
  lastFetch=start;
  requestFactory.schoolCalendarRequest().getPeople(start,numRows,filter).fire(new Receiver<List<PersonProxy>>(){
    @Override public void onSuccess(    List<PersonProxy> response){
      int responses=response.size();
      table.setRowData(start,response);
      pager.setPageStart(start);
      if (start == 0 || !table.isRowCountExact()) {
        table.setRowCount(start + responses,responses < numRows);
      }
    }
  }
);
}

Fixed version (ground truth):
private void fetch(final int start){
  lastFetch=start;
  requestFactory.schoolCalendarRequest().getPeople(start,numRows,filter).fire(new Receiver<List<PersonProxy>>(){
    @Override public void onSuccess(    List<PersonProxy> response){
      if (lastFetch != start) {
        return;
      }
      int responses=response.size();
      table.setRowData(start,response);
      pager.setPageStart(start);
      if (start == 0 || !table.isRowCountExact()) {
        table.setRowCount(start + responses,responses < numRows);
      }
    }
  }
);
}
Program: 53876
Project: 53876
Buggy source:
@Override public void onSuccess(List<PersonProxy> response){
  int responses=response.size();
  table.setRowData(start,response);
  pager.setPageStart(start);
  if (start == 0 || !table.isRowCountExact()) {
    table.setRowCount(start + responses,responses < numRows);
  }
}

Fixed version (ground truth):
@Override public void onSuccess(List<PersonProxy> response){
  if (lastFetch != start) {
    return;
  }
  int responses=response.size();
  table.setRowData(start,response);
  pager.setPageStart(start);
  if (start == 0 || !table.isRowCountExact()) {
    table.setRowCount(start + responses,responses < numRows);
  }
}
Program: 53877
Project: 53877
Buggy source:
/** 
 * Enable or disable the previous page buttons.
 * @param disabled true to disable, false to enable
 */
private void setPrevPageButtonsDisabled(boolean disabled){
  if (disabled == prevDisabled) {
    return;
  }
  prevDisabled=disabled;
  if (disabled) {
    firstPage.setResource(resources.simplePagerFirstPageDisabled());
    firstPage.getElement().getParentElement().addClassName(style.disabledButton());
    prevPage.setResource(resources.simplePagerPreviousPageDisabled());
    prevPage.getElement().getParentElement().addClassName(style.disabledButton());
  }
 else {
    firstPage.setResource(resources.simplePagerFirstPage());
    firstPage.getElement().getParentElement().removeClassName(style.disabledButton());
    prevPage.setResource(resources.simplePagerPreviousPage());
    prevPage.getElement().getParentElement().removeClassName(style.disabledButton());
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable the previous page buttons.
 * @param disabled true to disable, false to enable
 */
private void setPrevPageButtonsDisabled(boolean disabled){
  firstPage.setDisabled(disabled);
  prevPage.setDisabled(disabled);
}
Program: 53878
Project: 53878
Buggy source:
/** 
 * Enable or disable the next page buttons.
 * @param disabled true to disable, false to enable
 */
private void setNextPageButtonsDisabled(boolean disabled){
  if (disabled == nextDisabled) {
    return;
  }
  nextDisabled=disabled;
  if (disabled) {
    nextPage.setResource(resources.simplePagerNextPageDisabled());
    nextPage.getElement().getParentElement().addClassName(style.disabledButton());
    if (lastPage != null) {
      lastPage.setResource(resources.simplePagerLastPageDisabled());
      lastPage.getElement().getParentElement().addClassName(style.disabledButton());
    }
  }
 else {
    nextPage.setResource(resources.simplePagerNextPage());
    nextPage.getElement().getParentElement().removeClassName(style.disabledButton());
    if (lastPage != null) {
      lastPage.setResource(resources.simplePagerLastPage());
      lastPage.getElement().getParentElement().removeClassName(style.disabledButton());
    }
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable the next page buttons.
 * @param disabled true to disable, false to enable
 */
private void setNextPageButtonsDisabled(boolean disabled){
  nextPage.setDisabled(disabled);
  if (lastPage != null) {
    lastPage.setDisabled(disabled);
  }
}
Program: 53880
Project: 53880
Buggy source:
/** 
 * Check if the previous button is disabled. Visible for testing.
 */
boolean isPreviousButtonDisabled(){
  return prevDisabled;
}

Fixed version (ground truth):
/** 
 * Check if the previous button is disabled. Visible for testing.
 */
boolean isPreviousButtonDisabled(){
  return prevPage.isDisabled();
}
Program: 53881
Project: 53881
Buggy source:
/** 
 * Check if the next button is disabled. Visible for testing.
 */
boolean isNextButtonDisabled(){
  return nextDisabled;
}

Fixed version (ground truth):
/** 
 * Check if the next button is disabled. Visible for testing.
 */
boolean isNextButtonDisabled(){
  return nextPage.isDisabled();
}
Program: 53882
Project: 53882
Buggy source:
/** 
 * Reset the positions of the scrollable elements.
 * @return true if the size changed, false if not
 */
private boolean resetScrollables(){
  int offsetHeight=parent.getOffsetHeight();
  int offsetWidth=parent.getOffsetWidth();
  int height=offsetHeight + 100;
  int width=offsetWidth + 100;
  expandableInner.getStyle().setHeight(height,Unit.PX);
  expandableInner.getStyle().setWidth(width,Unit.PX);
  expandable.setScrollTop(height);
  expandable.setScrollLeft(width);
  collapsible.setScrollTop(collapsible.getScrollHeight() + 100);
  collapsible.setScrollLeft(collapsible.getScrollWidth() + 100);
  if (lastOffsetHeight != offsetHeight || lastOffsetWidth != offsetWidth) {
    lastOffsetHeight=offsetHeight;
    lastOffsetWidth=offsetWidth;
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Reset the positions of the scrollable elements.
 * @return true if the size changed, false if not
 */
private boolean resetScrollables(){
  if (resettingScrollables) {
    return false;
  }
  resettingScrollables=true;
  int offsetHeight=parent.getOffsetHeight();
  int offsetWidth=parent.getOffsetWidth();
  int height=offsetHeight + 100;
  int width=offsetWidth + 100;
  expandableInner.getStyle().setHeight(height,Unit.PX);
  expandableInner.getStyle().setWidth(width,Unit.PX);
  expandable.setScrollTop(height);
  expandable.setScrollLeft(width);
  collapsible.setScrollTop(collapsible.getScrollHeight() + 100);
  collapsible.setScrollLeft(collapsible.getScrollWidth() + 100);
  if (lastOffsetHeight != offsetHeight || lastOffsetWidth != offsetWidth) {
    lastOffsetHeight=offsetHeight;
    lastOffsetWidth=offsetWidth;
    resettingScrollables=false;
    return true;
  }
  resettingScrollables=false;
  return false;
}
Program: 53883
Project: 53883
Buggy source:
public void onBrowserEvent(Event event){
  if (Event.ONSCROLL == event.getTypeInt()) {
    EventTarget eventTarget=event.getEventTarget();
    if (!Element.is(eventTarget)) {
      return;
    }
    Element target=eventTarget.cast();
    if (target == collapsible || target == expandable) {
      handleResize();
    }
  }
}

Fixed version (ground truth):
public void onBrowserEvent(Event event){
  if (!resettingScrollables && Event.ONSCROLL == event.getTypeInt()) {
    EventTarget eventTarget=event.getEventTarget();
    if (!Element.is(eventTarget)) {
      return;
    }
    Element target=eventTarget.cast();
    if (target == collapsible || target == expandable) {
      handleResize();
    }
  }
}
Program: 53884
Project: 53884
Buggy source:
/** 
 * Run the given proxy through a ProxySerializer and verify that the before-and-after values match.
 */
protected <T extends BaseProxy>T checkSerialization(T proxy){
  AutoBean<T> originalBean=AutoBeanUtils.getAutoBean(proxy);
  SimpleProxyId<T> id=BaseProxyCategory.stableId(originalBean);
  DefaultProxyStore store=new DefaultProxyStore();
  ProxySerializer s=req.getSerializer(store);
  String key=s.serialize(proxy);
  assertNotNull(key);
  store=new DefaultProxyStore(store.encode());
  s=req.getSerializer(store);
  T restored=s.deserialize(id.getProxyClass(),key);
  AutoBean<BaseProxy> restoredBean=AutoBeanUtils.getAutoBean(restored);
  assertNotSame(proxy,restored);
  assertTrue(AutoBeanUtils.deepEquals(originalBean,restoredBean));
  if (proxy instanceof EntityProxy && !id.isEphemeral()) {
    assertEquals(((EntityProxy)proxy).stableId(),((EntityProxy)restored).stableId());
  }
  restoredBean.setTag(Constants.STABLE_ID,originalBean.getTag(Constants.STABLE_ID));
  return restored;
}

Fixed version (ground truth):
/** 
 * Run the given proxy through a ProxySerializer and verify that the before-and-after values match.
 */
protected <T extends BaseProxy>T checkSerialization(T proxy){
  AutoBean<T> originalBean=AutoBeanUtils.getAutoBean(proxy);
  SimpleProxyId<T> id=BaseProxyCategory.stableId(originalBean);
  DefaultProxyStore store=new DefaultProxyStore();
  ProxySerializer s=req.getSerializer(store);
  String key=s.serialize(proxy);
  assertNotNull(key);
  store=new DefaultProxyStore(store.encode());
  s=req.getSerializer(store);
  T restored=s.deserialize(id.getProxyClass(),key);
  AutoBean<? extends BaseProxy> restoredBean=AutoBeanUtils.getAutoBean(restored);
  assertNotSame(proxy,restored);
  assertTrue(AutoBeanUtils.deepEquals(originalBean,restoredBean));
  if (proxy instanceof EntityProxy && !id.isEphemeral()) {
    assertEquals(((EntityProxy)proxy).stableId(),((EntityProxy)restored).stableId());
  }
  restoredBean.setTag(Constants.STABLE_ID,originalBean.getTag(Constants.STABLE_ID));
  return restored;
}
Program: 53885
Project: 53885
Buggy source:
private void writeEmptyMethod(String mangledMethodName,Method method){
}

Fixed version (ground truth):
private void writeEmptyMethod(String mangledMethodName,Method declMethod){
  MethodVisitor mv=super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT,mangledMethodName,declMethod.getDescriptor(),null,null);
  mv.visitEnd();
}
Program: 53886
Project: 53886
Buggy source:
@Override public void visitEnd(){
  if (inSingleJsoImplInterfaceType) {
    for (    Map.Entry<String,List<Method>> entry : toImplement(currentTypeName).entrySet()) {
      for (      Method method : entry.getValue()) {
        writeEmptyMethod(entry.getKey(),method);
      }
    }
  }
  super.visitEnd();
}

Fixed version (ground truth):
@Override public void visitEnd(){
  if (inSingleJsoImplInterfaceType) {
    for (    String mangledName : toImplement(currentTypeName)) {
      for (      Method method : jsoData.getDeclarations(mangledName)) {
        writeEmptyMethod(mangledName,method);
      }
    }
  }
  super.visitEnd();
}
Program: 53887
Project: 53887
Buggy source:
/** 
 * Given a resource name of a class, find all mangled method names that must be implemented.
 */
private SortedMap<String,List<Method>> toImplement(String typeName){
  String name=typeName.replace('/','_');
  String prefix=name + "String_Node_Str";
  String suffix=name + "String_Node_Str";
  SortedMap<String,List<Method>> toReturn=new TreeMap<String,List<Method>>();
  for (  String mangledName : jsoData.getMangledNames().subSet(prefix,suffix)) {
    toReturn.put(mangledName,jsoData.getImplementations(mangledName));
  }
  toReturn.keySet().removeAll(implementedMethods);
  return toReturn;
}

Fixed version (ground truth):
/** 
 * Given a resource name of a class, find all mangled method names that must be implemented.
 */
private SortedSet<String> toImplement(String typeName){
  String name=typeName.replace('/','_');
  String prefix=name + "String_Node_Str";
  String suffix=name + "String_Node_Str";
  SortedSet<String> toReturn=new TreeSet<String>();
  for (  String mangledName : jsoData.getMangledNames().subSet(prefix,suffix)) {
    if (!implementedMethods.contains(mangledName)) {
      toReturn.add(mangledName);
    }
  }
  return toReturn;
}
Program: 53888
Project: 53888
Buggy source:
/** 
 * For regular Java objects that implement a SingleJsoImpl interface, write instance trampoline dispatchers for mangled method names to the implementing method.
 */
private void writeTrampoline(String stubIntr){
  for (  Map.Entry<String,List<Method>> entry : toImplement(stubIntr).entrySet()) {
    for (    Method method : entry.getValue()) {
      String mangledName=entry.getKey();
      String descriptor="String_Node_Str" + method.getDescriptor().substring(1 + method.getArgumentTypes()[0].getDescriptor().length());
      String localName=method.getName().substring(0,method.getName().length() - 1);
      Method toCall=new Method(localName,descriptor);
      MethodVisitor mv=super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC,mangledName,descriptor,null,null);
      if (mv != null) {
        mv.visitCode();
        int var=1;
        int size=1;
        mv.visitVarInsn(Opcodes.ALOAD,0);
        for (        Type t : toCall.getArgumentTypes()) {
          size+=t.getSize();
          mv.visitVarInsn(t.getOpcode(Opcodes.ILOAD),var);
          var+=t.getSize();
        }
        size=Math.max(size,toCall.getReturnType().getSize());
        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,currentTypeName,toCall.getName(),toCall.getDescriptor());
        mv.visitInsn(toCall.getReturnType().getOpcode(Opcodes.IRETURN));
        mv.visitMaxs(size,var);
        mv.visitEnd();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * For regular Java objects that implement a SingleJsoImpl interface, write instance trampoline dispatchers for mangled method names to the implementing method.
 */
private void writeTrampoline(String stubIntr){
  for (  String mangledName : toImplement(stubIntr)) {
    for (    Method method : jsoData.getDeclarations(mangledName)) {
      Method toCall=new Method(method.getName(),method.getDescriptor());
      MethodVisitor mv=super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC,mangledName,method.getDescriptor(),null,null);
      if (mv != null) {
        mv.visitCode();
        int var=1;
        int size=1;
        mv.visitVarInsn(Opcodes.ALOAD,0);
        for (        Type t : toCall.getArgumentTypes()) {
          size+=t.getSize();
          mv.visitVarInsn(t.getOpcode(Opcodes.ILOAD),var);
          var+=t.getSize();
        }
        size=Math.max(size,toCall.getReturnType().getSize());
        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,currentTypeName,toCall.getName(),toCall.getDescriptor());
        mv.visitInsn(toCall.getReturnType().getOpcode(Opcodes.IRETURN));
        mv.visitMaxs(size,var);
        mv.visitEnd();
      }
    }
  }
}
Program: 53889
Project: 53889
Buggy source:
public static PlainJsoWithInterface create(){
  return JavaScriptObject.createArray().cast();
}

Fixed version (ground truth):
static Element create(){
  return (Element)JavaScriptObject.createObject();
}
Program: 53890
Project: 53890
Buggy source:
public int compareTo(Timestamp o){
  int delta=(int)(getTime() - o.getTime());
  return delta == 0 ? getNanos() - o.getNanos() : delta;
}

Fixed version (ground truth):
public int compareTo(Timestamp o){
  int sign=Long.signum(getTime() - o.getTime());
  return sign == 0 ? getNanos() - o.getNanos() : sign;
}
Program: 53891
Project: 53891
Buggy source:
public int compareTo(Date other){
  long thisTime=getTime();
  long otherTime=other.getTime();
  if (thisTime < otherTime) {
    return -1;
  }
 else   if (thisTime > otherTime) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int compareTo(Date other){
  return Long.signum(getTime() - other.getTime());
}
Program: 53892
Project: 53892
Buggy source:
@Override protected Element getKeyboardSelectedElement(){
  int rowIndex=getKeyboardSelectedRow();
  if (childContainer.getChildCount() > rowIndex) {
    return childContainer.getChild(rowIndex).cast();
  }
  return null;
}

Fixed version (ground truth):
@Override protected Element getKeyboardSelectedElement(){
  int rowIndex=getKeyboardSelectedRow();
  if (rowIndex >= 0 && childContainer.getChildCount() > rowIndex) {
    return childContainer.getChild(rowIndex).cast();
  }
  return null;
}
Program: 53893
Project: 53893
Buggy source:
@Override protected Element getKeyboardSelectedElement(){
  int rowIndex=getKeyboardSelectedRow();
  NodeList<TableRowElement> rows=tbody.getRows();
  if (rowIndex < rows.getLength() && columns.size() > 0) {
    TableRowElement tr=rows.getItem(rowIndex);
    TableCellElement td=tr.getCells().getItem(keyboardSelectedColumn);
    return getCellParent(td);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Element getKeyboardSelectedElement(){
  int rowIndex=getKeyboardSelectedRow();
  NodeList<TableRowElement> rows=tbody.getRows();
  if (rowIndex >= 0 && rowIndex < rows.getLength() && columns.size() > 0) {
    TableRowElement tr=rows.getItem(rowIndex);
    TableCellElement td=tr.getCells().getItem(keyboardSelectedColumn);
    return getCellParent(td);
  }
  return null;
}
Program: 53894
Project: 53894
Buggy source:
public Double parse(CharSequence object) throws ParseException {
  if ("String_Node_Str".equals(object.toString())) {
    return null;
  }
  try {
    return Math.rint(NumberFormat.getDecimalFormat().parse(object.toString()));
  }
 catch (  NumberFormatException e) {
    throw new ParseException(e.getMessage(),0);
  }
}

Fixed version (ground truth):
public Double parse(CharSequence object) throws ParseException {
  if ("String_Node_Str".equals(object.toString())) {
    return null;
  }
  try {
    return NumberFormat.getDecimalFormat().parse(object.toString());
  }
 catch (  NumberFormatException e) {
    throw new ParseException(e.getMessage(),0);
  }
}
Program: 53896
Project: 53896
Buggy source:
private void registerParsers(){
  addElementParser("String_Node_Str","String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
}

Fixed version (ground truth):
private void registerParsers(){
  addElementParser("String_Node_Str","String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
  addWidgetParser("String_Node_Str");
}
Program: 53897
Project: 53897
Buggy source:
/** 
 * Logs a message.
 * @param logRecordJson a log record in JSON format.
 * @throws RemoteLoggingException if logging fails
 */
public static void logMessage(String logRecordJson) throws RemoteLoggingException {
  String strongName=RequestFactoryServlet.getThreadLocalRequest().getHeader(RpcRequestBuilder.STRONG_NAME_HEADER);
  RemoteLoggingServiceUtil.logOnServer(logRecordJson,strongName,deobfuscator,null);
}

Fixed version (ground truth):
/** 
 * Logs a message.
 * @param serializedLogRecordString a json serialized LogRecord, as provided by{@link com.google.gwt.logging.client.JsonLogRecordClientUtil.logRecordAsJsonObject(LogRecord)}
 * @throws RemoteLoggingException if logging fails
 */
public static void logMessage(String logRecordJson) throws RemoteLoggingException {
  HttpServletRequest threadLocalRequest=RequestFactoryServlet.getThreadLocalRequest();
  String strongName=null;
  if (threadLocalRequest != null) {
    threadLocalRequest.getHeader(RpcRequestBuilder.STRONG_NAME_HEADER);
  }
  RemoteLoggingServiceUtil.logOnServer(logRecordJson,strongName,deobfuscator,null);
}
Program: 53898
Project: 53898
Buggy source:
/** 
 * Given the binary name of a domain type, return the BaseProxy type that is assignable to   {@code clientType}. This method allows multiple proxy types to be assigned to a domain type for use in different contexts (e.g. API slices). If there are multiple client types mapped to  {@code domainTypeBinaryName} and assignable to {@code clientTypeBinaryName}, the first matching type will be returned.
 */
String getEntityProxyTypeName(String domainTypeBinaryName,String clientTypeBinaryName){
  Type key=Type.getObjectType(BinaryName.toInternalName(domainTypeBinaryName));
  List<Type> found=domainToClientType.get(key);
  if (found == null || found.isEmpty()) {
    return null;
  }
  if (found.size() == 1) {
    return found.get(0).getClassName();
  }
  Type assignableTo=Type.getObjectType(BinaryName.toInternalName(clientTypeBinaryName));
  for (  Type t : found) {
    if (isAssignable(parentLogger,assignableTo,t)) {
      return t.getClassName();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Given the binary name of a domain type, return the BaseProxy type that is assignable to   {@code clientType}. This method allows multiple proxy types to be assigned to a domain type for use in different contexts (e.g. API slices). If there are multiple client types mapped to  {@code domainTypeBinaryName} and assignable to {@code clientTypeBinaryName}, the first matching type will be returned.
 */
String getEntityProxyTypeName(String domainTypeBinaryName,String clientTypeBinaryName){
  Type key=Type.getObjectType(BinaryName.toInternalName(domainTypeBinaryName));
  List<Type> found=domainToClientType.get(key);
  if (found == null || found.isEmpty()) {
    List<Type> types=getSupertypes(parentLogger,key);
    for (    Type type : types) {
      if (objectType.equals(type)) {
        break;
      }
      found=domainToClientType.get(type);
      if (found != null && !found.isEmpty()) {
        break;
      }
    }
  }
  if (found == null || found.isEmpty()) {
    return null;
  }
  Type typeToReturn=null;
  if (found.size() == 1) {
    typeToReturn=found.get(0);
  }
 else {
    Type assignableTo=Type.getObjectType(BinaryName.toInternalName(clientTypeBinaryName));
    for (    Type t : found) {
      if (isAssignable(parentLogger,assignableTo,t)) {
        typeToReturn=t;
        break;
      }
    }
  }
  return typeToReturn == null ? null : typeToReturn.getClassName();
}
Program: 53899
Project: 53899
Buggy source:
public List<Type> exec(Type type){
  RequestFactoryInterfaceValidator.this.visit(logger,type.getInternalName(),this);
  return supertypes;
}

Fixed version (ground truth):
public List<Type> exec(Type type){
  RequestFactoryInterfaceValidator.this.visit(logger,type.getInternalName(),this);
  return supers;
}
Program: 53900
Project: 53900
Buggy source:
/** 
 * Examines a generic RequestContext method declaration and determines the expected domain return type. This implementation is limited in that it will not attempt to resolve type bounds since that would essentially require implementing TypeOracle. In the case where the type bound cannot be resolved, this method will return Object's type.
 */
private Type getReturnType(ErrorContext logger,RFMethod method){
  logger=logger.setMethod(method);
  final String[] returnType={"String_Node_Str"};
  String signature=method.getSignature();
  final int expectedCount;
  if (method.getReturnType().equals(instanceRequestIntf)) {
    expectedCount=2;
  }
 else   if (method.getReturnType().equals(requestIntf)) {
    expectedCount=1;
  }
 else {
    logger.spam("String_Node_Str" + signature);
    return Type.getObjectType(returnType[0]);
  }
  new SignatureReader(signature).accept(new SignatureAdapter(){
    @Override public SignatureVisitor visitReturnType(){
      return new SignatureAdapter(){
        int count;
        @Override public SignatureVisitor visitTypeArgument(        char wildcard){
          if (++count == expectedCount) {
            return new SignatureAdapter(){
              @Override public void visitClassType(              String name){
                returnType[0]=name;
              }
            }
;
          }
          return super.visitTypeArgument(wildcard);
        }
      }
;
    }
  }
);
  logger.spam("String_Node_Str" + returnType[0]);
  return Type.getObjectType(returnType[0]);
}

Fixed version (ground truth):
/** 
 * Examines a generic RequestContext method declaration and determines the expected domain return type. This implementation is limited in that it will not attempt to resolve type bounds since that would essentially require implementing TypeOracle. In the case where the type bound cannot be resolved, this method will return Object's type.
 */
private Type getReturnType(ErrorContext logger,RFMethod method){
  logger=logger.setMethod(method);
  final String[] returnType={objectType.getInternalName()};
  String signature=method.getSignature();
  final int expectedCount;
  if (method.getReturnType().equals(instanceRequestIntf)) {
    expectedCount=2;
  }
 else   if (method.getReturnType().equals(requestIntf)) {
    expectedCount=1;
  }
 else {
    logger.spam("String_Node_Str" + signature);
    return Type.getObjectType(returnType[0]);
  }
  new SignatureReader(signature).accept(new SignatureAdapter(){
    @Override public SignatureVisitor visitReturnType(){
      return new SignatureAdapter(){
        int count;
        @Override public SignatureVisitor visitTypeArgument(        char wildcard){
          if (++count == expectedCount) {
            return new SignatureAdapter(){
              @Override public void visitClassType(              String name){
                returnType[0]=name;
              }
            }
;
          }
          return super.visitTypeArgument(wildcard);
        }
      }
;
    }
  }
);
  logger.spam("String_Node_Str" + returnType[0]);
  return Type.getObjectType(returnType[0]);
}
Program: 53901
Project: 53901
Buggy source:
/** 
 * Returns the current user information for a given redirect URL. If  {@link #setUserInformationImplClass(String)} has been called with a classname, that class is used to gather the information by calling a (String) constructor. If the impl class name is "", or if the class cannont be instantiated, dummy user info is returned.
 * @param redirectUrl the redirect URL as a String
 * @return a {@link UserInformation} instance
 */
public static UserInformation getCurrentUserInformation(String redirectUrl){
  UserInformation userInfo=null;
  if (!"String_Node_Str".equals(userInformationImplClass)) {
    try {
      userInfo=(UserInformation)Class.forName(userInformationImplClass).getConstructor(String.class).newInstance(redirectUrl);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  if (userInfo == null) {
    userInfo=new UserInformationSimpleImpl(redirectUrl);
  }
  return userInfo;
}

Fixed version (ground truth):
/** 
 * Called by   {@link RequestFactoryServlet#doPost} at the start of each requestreceived. Establishes the current user information for this request, and notes a redirect url to be provided back to the client if the user's bona fides cannot be established. All succeeding calls to {@link #findUserInformation(Long)} made from the same thread will returnthe same UserInfo instance. <p> If  {@link #setUserInformationImplClass(String)} has been called with aclass name, that class is used to gather the information by calling a (String) constructor. If the impl class name is "", or if the class cannont be instantiated, dummy user info is returned.
 * @param redirectUrl the redirect URL as a String
 * @return a {@link UserInformation} instance
 */
public static UserInformation getCurrentUserInformation(String redirectUrl){
  currentUser.remove();
  if (!"String_Node_Str".equals(userInformationImplClass)) {
    try {
      currentUser.set((UserInformation)Class.forName(userInformationImplClass).getConstructor(String.class).newInstance(redirectUrl));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  if (currentUser.get() == null) {
    currentUser.set(new UserInformationSimpleImpl(redirectUrl));
  }
  return currentUser.get();
}
Program: 53902
Project: 53902
Buggy source:
/** 
 * Log a message on the server.
 * @param serializedLogRecordString a String
 * @return a Void {@link Request}
 */
Request<Void> logMessage(String serializedLogRecordString);

Fixed version (ground truth):
/** 
 * Log a message on the server.
 * @param serializedLogRecordString a json serialized LogRecord, as provided by{@link com.google.gwt.logging.client.JsonLogRecordClientUtil.logRecordAsJsonObject(LogRecord)}
 * @return a Void {@link Request}
 */
Request<Void> logMessage(String serializedLogRecordString);
Program: 53903
Project: 53903
Buggy source:
/** 
 * Commit the current value.
 * @param parent the parent element
 * @param viewData the {@link ViewData} object
 * @param valueUpdater the {@link ValueUpdater}
 */
private void commit(Element parent,ViewData viewData,ValueUpdater<String> valueUpdater){
  String value=updateViewData(parent,viewData,false);
  clearInput(getInputElement(parent));
  setValue(parent,value,viewData);
  valueUpdater.update(value);
}

Fixed version (ground truth):
/** 
 * Commit the current value.
 * @param parent the parent element
 * @param viewData the {@link ViewData} object
 * @param valueUpdater the {@link ValueUpdater}
 */
private void commit(Element parent,ViewData viewData,ValueUpdater<String> valueUpdater){
  String value=updateViewData(parent,viewData,false);
  clearInput(getInputElement(parent));
  setValue(parent,value,viewData);
  if (valueUpdater != null) {
    valueUpdater.update(value);
  }
}
Program: 53904
Project: 53904
Buggy source:
/** 
 * Navigate to a deeper node.
 */
private void keyboardNavigateDeep(){
  if (isKeyboardSelectionDisabled()) {
    return;
  }
  if (level < treeNodes.size() - 1) {
    TreeNodeImpl<?> treeNode=treeNodes.get(level + 1);
    treeNode.display.getPresenter().setKeyboardSelectedRow(treeNode.display.getKeyboardSelectedRow(),true);
  }
}

Fixed version (ground truth):
/** 
 * Navigate to a deeper node.
 */
private void keyboardNavigateDeep(){
  if (isKeyboardSelectionDisabled()) {
    return;
  }
  if (level < treeNodes.size() - 1) {
    TreeNodeImpl<?> treeNode=treeNodes.get(level + 1);
    treeNode.display.getPresenter().setKeyboardSelectedRow(treeNode.display.getKeyboardSelectedRow(),true,true);
  }
}
Program: 53905
Project: 53905
Buggy source:
public TreeNode setChildOpen(int index,boolean open,boolean fireEvents){
  assertNotDestroyed();
  checkChildBounds(index);
  if (open) {
    display.getPresenter().setKeyboardSelectedRow(index,false);
    return updateChildState(display,fireEvents);
  }
 else {
    if (index == display.getKeyboardSelectedRow()) {
      display.getPresenter().clearKeyboardSelectedRowValue();
      updateChildState(display,fireEvents);
    }
    return null;
  }
}

Fixed version (ground truth):
public TreeNode setChildOpen(int index,boolean open,boolean fireEvents){
  assertNotDestroyed();
  checkChildBounds(index);
  if (open) {
    display.getPresenter().setKeyboardSelectedRow(index,false,true);
    return updateChildState(display,fireEvents);
  }
 else {
    if (index == display.getKeyboardSelectedRow()) {
      display.getPresenter().clearKeyboardSelectedRowValue();
      updateChildState(display,fireEvents);
    }
    return null;
  }
}