nus-yam/ex-repair huggingface dataset:
Program: 152013
Project: 152013
Buggy source:
/** 
 * Writes out an object of the specified class, after the replacement has been done.
 */
protected void writeNoReplace(Object value,Class<?> clazz) throws IOException {
  if (clazz.isPrimitive()) {
    writeValue(value,clazz);
    return;
  }
  if (value instanceof String) {
    value=((String)value).intern();
  }
  Integer objectId=_objectIds.get(value);
  if (objectId != null) {
    Streams.writeVarInt(_out,objectId);
    return;
  }
  Streams.writeVarInt(_out,++_lastObjectId);
  _objectIds.put(value,_lastObjectId);
  writeValue(value,clazz);
}

Fixed version (ground truth):
/** 
 * Writes out an object of the specified class, after the replacement has been done.
 */
protected void writeNoReplace(Object value,Class<?> clazz) throws IOException {
  if (clazz.isPrimitive()) {
    writeValue(value,clazz);
    return;
  }
  boolean track;
  if (value instanceof String) {
    value=((String)value).intern();
    track=true;
  }
 else {
    track=shouldTrackInstance(value);
  }
  if (track) {
    Integer objectId=_objectIds.get(value);
    if (objectId != null) {
      Streams.writeVarInt(_out,objectId);
      return;
    }
  }
  Streams.writeVarInt(_out,++_lastObjectId);
  if (track) {
    _objectIds.put(value,_lastObjectId);
  }
  writeValue(value,clazz);
}
Program: 152014
Project: 152014
Buggy source:
/** 
 * Updates direct paths that reference this location in the array.
 * @param idx The index being modified
 * @param newIdx The index being moved to, of -1 if idx is being removed.
 */
protected void updatePaths(int idx,int newIdx){
  String path=getPropertyPath();
  ParameterizedConfig pc=ObjectUtil.as(getRootObject(),ParameterizedConfig.class);
  if (pc == null) {
    return;
  }
  Map<String,String> replace;
  ImmutableMap.Builder<String,String> builder=ImmutableMap.<String,String>builder();
  if (newIdx == -1) {
    builder.put(pathIndex(path,idx),"String_Node_Str");
    newIdx=_panels.getComponentCount() - 1;
  }
 else {
    builder.put(pathIndex(path,idx),pathIndex(path,newIdx));
  }
  int dir=Integer.signum(idx - newIdx);
  for (int ii=newIdx; ii != idx; ii+=dir) {
    builder.put(pathIndex(path,ii),pathIndex(path,ii + dir));
  }
  replace=builder.build();
  boolean updated=false;
  for (  Parameter param : pc.parameters) {
    if (param instanceof Parameter.Direct) {
      updated|=updateDirect((Parameter.Direct)param,replace);
    }
 else     if (param instanceof Parameter.Choice) {
      for (      Parameter.Direct direct : ((Parameter.Choice)param).directs) {
        updated|=updateDirect(direct,replace);
      }
    }
  }
  if (updated) {
    pc.wasUpdated();
  }
}

Fixed version (ground truth):
/** 
 * Updates direct paths that reference this location in the array.
 * @param idx The index being modified
 * @param newIdx The index being moved to, or -1 if idx is being removed.
 */
protected void updatePaths(int idx,int newIdx){
  String path=getPropertyPath();
  ParameterizedConfig pc=ObjectUtil.as(getRootObject(),ParameterizedConfig.class);
  if (pc == null) {
    return;
  }
  ImmutableMap.Builder<String,String> builder=ImmutableMap.<String,String>builder();
  if (newIdx == -1) {
    builder.put(pathIndex(path,idx),"String_Node_Str");
    newIdx=_panels.getComponentCount();
  }
 else {
    builder.put(pathIndex(path,idx),pathIndex(path,newIdx));
  }
  int dir=Integer.signum(idx - newIdx);
  for (int ii=newIdx; ii != idx; ii+=dir) {
    builder.put(pathIndex(path,ii),pathIndex(path,ii + dir));
  }
  Map<String,String> replace=builder.build();
  boolean updated=false;
  for (  Parameter param : pc.parameters) {
    if (param instanceof Parameter.Direct) {
      updated|=updateDirect((Parameter.Direct)param,replace);
    }
 else     if (param instanceof Parameter.Choice) {
      for (      Parameter.Direct direct : ((Parameter.Choice)param).directs) {
        updated|=updateDirect(direct,replace);
      }
    }
  }
  if (updated) {
    pc.wasUpdated();
  }
}
Program: 152015
Project: 152015
Buggy source:
/** 
 * Attempts to merge a static model.
 * @return a reference to the merged model, or <code>null</code> if the model cannot be merged.
 */
public Model maybeMerge(int x,int y,ConfigReference<ModelConfig> ref,Transform3D transform,final int floorFlags){
  int granularity=getMergeGranularity();
  Coord key=new Coord(x >> granularity,y >> granularity);
  Sprite sprite=_mergedSprites.get(key);
  Model model;
  if (sprite == null) {
    final Model fmodel=model=new Model(_ctx){
      @Override protected void updateFromConfig(){
        if (!_suppressMergeUpdates) {
          super.updateFromConfig();
        }
      }
    }
;
    _mergedSprites.put(key,sprite=new Sprite(_ctx,this){
      @Override public int getFloorFlags(){
        return floorFlags;
      }
      @Override public Model getModel(){
        return fmodel;
      }
    }
);
    model.setUserObject(sprite);
    model.setConfig(new ModelConfig(new MergedStaticConfig(new ComponentModel[]{new ComponentModel(ref,transform)})){
{
        _cfgmgr=_configs=_ctx.getConfigManager();
      }
      @Override protected void maybeFireOnConfigManager(){
      }
    }
);
    _scene.add(model);
  }
 else {
    if (sprite.getFloorFlags() != floorFlags) {
      return null;
    }
    model=sprite.getModel();
    ModelConfig mconfig=model.getConfig();
    MergedStaticConfig impl=(MergedStaticConfig)mconfig.implementation;
    impl.models=ArrayUtil.append(impl.models,new ComponentModel(ref,transform));
    mconfig.wasUpdated();
  }
  return model;
}

Fixed version (ground truth):
/** 
 * Attempts to merge a static model.
 * @return a reference to the merged model, or <code>null</code> if the model cannot be merged.
 */
public Model maybeMerge(int x,int y,ConfigReference<ModelConfig> ref,Transform3D transform,final int floorFlags){
  int granularity=getMergeGranularity();
  Coord key=new Coord(x >> granularity,y >> granularity);
  Sprite sprite=_mergedSprites.get(key);
  Model model;
  if (sprite == null) {
    final Model fmodel=model=new Model(_ctx){
      @Override protected void updateFromConfig(){
        if (!_suppressMergeUpdates) {
          super.updateFromConfig();
        }
      }
    }
;
    _mergedSprites.put(key,sprite=new Sprite(_ctx,this){
      @Override public int getFloorFlags(){
        return floorFlags;
      }
      @Override public Model getModel(){
        return fmodel;
      }
    }
);
    model.setUserObject(sprite);
    model.setConfig(new ModelConfig(new MergedStaticConfig(new ComponentModel[]{new ComponentModel(ref,transform)})){
{
        _cfgmgr=_configs=_ctx.getConfigManager();
      }
      @Override protected void maybeFireOnConfigManager(){
      }
      @Override protected void addUpdateDependencies(){
      }
    }
);
    _scene.add(model);
  }
 else {
    if (sprite.getFloorFlags() != floorFlags) {
      return null;
    }
    model=sprite.getModel();
    ModelConfig mconfig=model.getConfig();
    MergedStaticConfig impl=(MergedStaticConfig)mconfig.implementation;
    impl.models=ArrayUtil.append(impl.models,new ComponentModel(ref,transform));
    mconfig.wasUpdated();
  }
  return model;
}
Program: 152016
Project: 152016
Buggy source:
@Override public <T extends ManagedConfig>boolean add(Class<T> clazz,ConfigReference<T> ref){
  if (ref == null || ref.getArguments().isEmpty() || !_cfgClasses.contains(clazz)) {
    return false;
  }
  ConfigId id=new ConfigId(clazz,ref.getName());
  refs.put(id,ref);
  try {
    graph.addDependency(id,_current);
  }
 catch (  Exception e) {
    log.warning("String_Node_Str","String_Node_Str",id,"String_Node_Str",_allSeen.contains(id),"String_Node_Str",_current,"String_Node_Str",_allSeen.contains(_current),e);
  }
  return true;
}

Fixed version (ground truth):
@Override public <T extends ManagedConfig>boolean add(Class<T> clazz,ConfigReference<T> ref){
  if (ref == null || ref.getArguments().isEmpty() || !_cfgClasses.contains(clazz)) {
    return false;
  }
  ConfigId id=new ConfigId(clazz,ref.getName());
  refs.put(id,ref);
  try {
    if (!graph.dependsOn(id,_current)) {
      graph.addDependency(id,_current);
    }
 else {
      log.info("String_Node_Str");
    }
  }
 catch (  Exception e) {
    log.warning("String_Node_Str","String_Node_Str",id,"String_Node_Str",_allSeen.contains(id),"String_Node_Str",_current,"String_Node_Str",_allSeen.contains(_current),e);
  }
  return true;
}
Program: 152018
Project: 152018
Buggy source:
/** 
 * Similar to DeepUtil.transfer, but operating on properties. Attempt to transfer each property with the same name to the dest object, but recover on any and all errors. This is used in the editor when changing config types.
 */
public static void transferCompatibleProperties(Object source,Object dest){
  Property[] destProps=Introspector.getProperties(dest);
  for (  Property srcProp : Introspector.getProperties(source)) {
    String name=srcProp.getName();
    for (    Property destProp : destProps) {
      if (name.equals(destProp.getName())) {
        try {
          destProp.set(dest,srcProp.get(source));
        }
 catch (        Throwable t) {
        }
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Similar to DeepUtil.transfer, but operating on properties. Attempt to transfer each property with the same name to the dest object, but recover on any and all errors. This is used in the editor when changing config types.
 */
public static void transferCompatibleProperties(Object source,Object dest){
  Property[] destProps=Introspector.getProperties(dest);
  for (  Property srcProp : Introspector.getProperties(source)) {
    String name=srcProp.getName();
    for (    Property destProp : destProps) {
      if (name.equals(destProp.getName())) {
        if (srcProp.isCompatible(destProp)) {
          try {
            destProp.set(dest,srcProp.get(source));
          }
 catch (          Throwable t) {
            log.warning("String_Node_Str",t);
          }
        }
        break;
      }
    }
  }
}
Program: 152019
Project: 152019
Buggy source:
@Override protected JPanel createPanel(Object ignoredValue){
  Object val=_property.get(_object);
  Property prop;
  if (val instanceof List) {
    @SuppressWarnings("String_Node_Str") final List<Object> list=(List<Object>)val;
    prop=new IndexedProperty(){
      @Override protected Object getAtIndex(      int idx){
        return list.get(idx);
      }
      @Override protected void setAtIndex(      int idx,      Object value){
        list.set(idx,value);
      }
    }
;
  }
 else   if (val instanceof Object[]) {
    final Object[] array=(Object[])val;
    prop=new IndexedProperty(){
      @Override protected Object getAtIndex(      int idx){
        return array[idx];
      }
      @Override protected void setAtIndex(      int idx,      Object value){
        array[idx]=value;
      }
    }
;
  }
 else {
    throw new RuntimeException("String_Node_Str" + val);
  }
  _editor=PropertyEditor.createEditor(_ctx,prop,_lineage);
  return _editor.getContent();
}

Fixed version (ground truth):
@Override protected JPanel createPanel(Object ignoredValue){
  Object val=_property.get(_object);
  Property prop;
  if (val instanceof List) {
    prop=new IndexedProperty(){
      @Override protected Object getAtIndex(      int idx){
        return getList().get(idx);
      }
      @Override protected void setAtIndex(      int idx,      Object value){
        getList().set(idx,value);
      }
      protected List<Object> getList(){
        @SuppressWarnings("String_Node_Str") List<Object> list=(List<Object>)_property.get(_object);
        return list;
      }
    }
;
  }
 else   if (val instanceof Object[]) {
    prop=new IndexedProperty(){
      @Override protected Object getAtIndex(      int idx){
        return getArray()[idx];
      }
      @Override protected void setAtIndex(      int idx,      Object value){
        getArray()[idx]=value;
      }
      protected Object[] getArray(){
        return (Object[])_property.get(_object);
      }
    }
;
  }
 else {
    throw new RuntimeException("String_Node_Str" + val);
  }
  _editor=PropertyEditor.createEditor(_ctx,prop,_lineage);
  return _editor.getContent();
}
Program: 152021
Project: 152021
Buggy source:
/** 
 * Updates the state of the UI based on the selection.
 */
protected void updateSelection(){
  ConfigTreeNode node=_tree.getSelectedNode();
  _epanel.setObject(node == null ? null : node.getConfig());
  boolean enable=(node != null);
  _exportConfigs.setEnabled(enable);
  _cut.setEnabled(enable);
  _copy.setEnabled(enable);
  _delete.setEnabled(enable);
  _findUses.setEnabled(enable);
}

Fixed version (ground truth):
/** 
 * Updates the state of the UI based on the selection.
 */
protected void updateSelection(){
  ConfigTreeNode node=_tree.getSelectedNode();
  _epanel.setObject(node == null ? null : node.getRawConfig());
  boolean enable=(node != null);
  _exportConfigs.setEnabled(enable);
  _cut.setEnabled(enable);
  _copy.setEnabled(enable);
  _delete.setEnabled(enable);
  _findUses.setEnabled(enable);
}
Program: 152022
Project: 152022
Buggy source:
/** 
 * Read a varlong length off the stream, which may be up to 9 bytes to fully decode Long.MAX_VALUE. In all probability we'll just read one byte so just relax.
 */
public static long readLength(InputStream in) throws IOException {
  long ret=0;
  for (int count=0; count < 9; count++) {
    int bite=in.read();
    if (bite == -1) {
      throw new EOFException();
    }
    ret=(ret << 7) | (bite & 0x7f);
    if ((bite & 0x80) == 0) {
      if (count > 0 && ((bite & 0x7f) == 0)) {
        break;
      }
      return ret;
    }
  }
  throw new StreamCorruptedException();
}

Fixed version (ground truth):
/** 
 * Read a varlong length off the stream, which may be up to 9 bytes to fully decode Long.MAX_VALUE. In all probability we'll just read one byte so just relax.
 */
public static long readLength(InputStream in) throws IOException {
  long ret=0;
  for (int count=0; count < 9; count++) {
    int bite=in.read();
    if (bite == -1) {
      throw new EOFException();
    }
    ret|=(bite & 0x7f) << (count * 7);
    if ((bite & 0x80) == 0) {
      if (count > 0 && ((bite & 0x7f) == 0)) {
        break;
      }
      return ret;
    }
  }
  throw new StreamCorruptedException();
}
Program: 152023
Project: 152023
Buggy source:
/** 
 * Register a newly-seen descendant.
 */
protected void registerDescendant(Component c){
  if (!_comps.add(c)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (c instanceof Container) {
    ((Container)c).addContainerListener(_containerListener);
  }
  if (c instanceof BasePropertyEditor) {
    BasePropertyEditor pe=(BasePropertyEditor)c;
    String path=_editor.getComponentPath(pe,false);
    if (path.startsWith("String_Node_Str")) {
      path=path.substring(1);
    }
    if (_pathToEditor.containsKey(path)) {
      return;
    }
    _pathToEditor.put(path,pe);
    _editorToPath.put(pe,path);
    log.info("String_Node_Str","String_Node_Str",path,"String_Node_Str",pe.getClass());
    if (pe instanceof PathTableArrayListEditor) {
      PathTableArrayListEditor paths=(PathTableArrayListEditor)pe;
      _params.put(paths,new ParameterWatcher(paths));
    }
  }
}

Fixed version (ground truth):
/** 
 * Register a newly-seen descendant.
 */
protected void registerDescendant(Component c){
  if (c instanceof Container) {
    ((Container)c).addContainerListener(_containerListener);
  }
  if (c instanceof BasePropertyEditor) {
    BasePropertyEditor pe=(BasePropertyEditor)c;
    String path=_editor.getComponentPath(pe,false);
    if (path.startsWith("String_Node_Str")) {
      path=path.substring(1);
    }
    if (_pathToEditor.containsKey(path)) {
      return;
    }
    _pathToEditor.put(path,pe);
    _editorToPath.put(pe,path);
    if (pe instanceof PathTableArrayListEditor) {
      PathTableArrayListEditor paths=(PathTableArrayListEditor)pe;
      _params.put(paths,new ParameterWatcher(paths));
    }
  }
}
Program: 152024
Project: 152024
Buggy source:
/** 
 * Construct a ParameterWatcher.
 */
public ParameterWatcher(PathTableArrayListEditor paths){
  PropertyEditor name=null;
  for (Container p=paths; p != null; p=p.getParent()) {
    if (p instanceof EditorPanel) {
      name=((EditorPanel)p).getPropertyEditor("String_Node_Str");
      break;
    }
  }
  _pathsEditor=paths;
  _nameEditor=name;
  _pathsEditor.addChangeListener(this);
  _nameEditor.addChangeListener(this);
  log.info("String_Node_Str" + _nameEditor.getProperty().get(_nameEditor.getObject()));
  update();
}

Fixed version (ground truth):
/** 
 * Construct a ParameterWatcher.
 */
public ParameterWatcher(PathTableArrayListEditor paths){
  PropertyEditor name=null;
  for (Container p=paths; p != null; p=p.getParent()) {
    if (p instanceof EditorPanel) {
      name=((EditorPanel)p).getPropertyEditor("String_Node_Str");
      break;
    }
  }
  _pathsEditor=paths;
  _nameEditor=name;
  _pathsEditor.addChangeListener(this);
  _nameEditor.addChangeListener(this);
  update();
}
Program: 152025
Project: 152025
Buggy source:
/** 
 * Unregister a removed descendant.
 */
protected void unregisterDescendant(Component c){
  if (!_comps.remove(c)) {
    log.warning("String_Node_Str",new Exception());
  }
  if (c instanceof Container) {
    ((Container)c).removeContainerListener(_containerListener);
  }
  if (c instanceof BasePropertyEditor) {
    BasePropertyEditor pe=(BasePropertyEditor)c;
    String path=_editorToPath.remove(pe);
    if (path != null) {
      _pathToEditor.remove(path);
      log.info("String_Node_Str","String_Node_Str",path);
    }
    if (pe instanceof PathTableArrayListEditor) {
      ParameterWatcher watcher=_params.remove(pe);
      if (watcher == null) {
        log.warning("String_Node_Str" + pe);
      }
 else {
        watcher.shutdown();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Unregister a removed descendant.
 */
protected void unregisterDescendant(Component c){
  if (c instanceof Container) {
    ((Container)c).removeContainerListener(_containerListener);
  }
  if (c instanceof BasePropertyEditor) {
    BasePropertyEditor pe=(BasePropertyEditor)c;
    String path=_editorToPath.remove(pe);
    if (path != null) {
      _pathToEditor.remove(path);
    }
    if (pe instanceof PathTableArrayListEditor) {
      ParameterWatcher watcher=_params.remove(pe);
      if (watcher == null) {
        log.warning("String_Node_Str" + pe);
      }
 else {
        watcher.shutdown();
      }
    }
  }
}
Program: 152026
Project: 152026
Buggy source:
/** 
 * Update with the new set of targets.
 */
protected void update(Set<BasePropertyEditor> newTargets){
  for (  BasePropertyEditor pe : Sets.difference(_pathTargets,newTargets)) {
    pe.setParameterLabel(null);
  }
  _pathTargets=newTargets;
  String label=String.valueOf(_nameEditor.getProperty().get(_nameEditor.getObject()));
  log.info("String_Node_Str" + label);
  for (  BasePropertyEditor pe : newTargets) {
    pe.setParameterLabel(label);
  }
}

Fixed version (ground truth):
/** 
 * Update with the new set of targets.
 */
protected void update(Set<BasePropertyEditor> newTargets){
  for (  BasePropertyEditor pe : Sets.difference(_pathTargets,newTargets)) {
    pe.setParameterLabel(null);
  }
  _pathTargets=newTargets;
  String label=String.valueOf(_nameEditor.getProperty().get(_nameEditor.getObject()));
  for (  BasePropertyEditor pe : newTargets) {
    pe.setParameterLabel(label);
  }
}
Program: 152027
Project: 152027
Buggy source:
@Override public void setConfig(BaseParticleSystemConfig.Layer config){
  super.setConfig(config);
  Model[] omodels=_models;
  _models=new Model[config.particleCount];
  MetaParticleSystemConfig.Layer mconfig=(MetaParticleSystemConfig.Layer)config;
  _geometryRadius=0f;
  for (int ii=0; ii < _models.length; ii++) {
    Model model=(omodels == null || ii >= omodels.length) ? null : omodels[ii];
    if (model == null) {
      model=new Model(_ctx);
      model.setParentScope(this);
      model.setColorState(new ColorState());
    }
    model.setRenderScheme(config.alphaMode == AlphaMode.OPAQUE ? null : RenderScheme.TRANSLUCENT);
    model.setConfig(mconfig.model);
    model.setVisible(false);
    if (_geometryRadius == 0f) {
      model.setLocalTransform(new Transform3D());
      Box bounds=model.getBounds();
      if (!bounds.isEmpty()) {
        float length=bounds.getDiagonalLength();
        if (Float.isNaN(length)) {
          log.warning("String_Node_Str","String_Node_Str",mconfig.model,"String_Node_Str",bounds);
        }
 else {
          _geometryRadius=length * 0.5f;
        }
      }
    }
    _models[ii]=model;
  }
  if (omodels != null) {
    for (int ii=_models.length; ii < omodels.length; ii++) {
      omodels[ii].dispose();
    }
  }
}

Fixed version (ground truth):
@Override public void setConfig(BaseParticleSystemConfig.Layer config){
  super.setConfig(config);
  Model[] omodels=_models;
  _models=new Model[config.particleCount];
  MetaParticleSystemConfig.Layer mconfig=(MetaParticleSystemConfig.Layer)config;
  _geometryRadius=0f;
  for (int ii=0; ii < _models.length; ii++) {
    Model model=(omodels == null || ii >= omodels.length) ? null : omodels[ii];
    if (model == null) {
      model=new Model(_ctx);
      model.setParentScope(this);
      model.setColorState(new ColorState());
    }
    model.setRenderScheme(config.alphaMode == AlphaMode.OPAQUE ? null : RenderScheme.TRANSLUCENT);
    model.setConfig(mconfig.model);
    model.setVisible(true);
    if (_geometryRadius == 0f) {
      model.setLocalTransform(new Transform3D());
      Box bounds=model.getBounds();
      if (!bounds.isEmpty()) {
        float length=bounds.getDiagonalLength();
        if (Float.isNaN(length)) {
          log.warning("String_Node_Str","String_Node_Str",mconfig.model,"String_Node_Str",bounds);
        }
 else {
          _geometryRadius=length * 0.5f;
        }
      }
    }
    _models[ii]=model;
  }
  if (omodels != null) {
    for (int ii=_models.length; ii < omodels.length; ii++) {
      omodels[ii].setVisible(false);
      omodels[ii].dispose();
    }
  }
}
Program: 152028
Project: 152028
Buggy source:
@Override public void update(){
  int pcount=_panels.getComponentCount();
  int length=getLength();
  for (int ii=0; ii < length; ii++) {
    Object value=getValue(ii);
    if (ii < pcount) {
      updatePanel((EntryPanel)_panels.getComponent(ii),value);
    }
 else {
      addPanel(value);
    }
  }
  while (pcount > length) {
    _panels.remove(--pcount);
  }
  updatePanels();
}

Fixed version (ground truth):
@Override public void update(){
  int pcount=_panels.getComponentCount();
  int length=getLength();
  for (int ii=0; ii < length; ii++) {
    Object value=getValue(ii);
    if (ii < pcount) {
      updatePanel((EntryPanel)_panels.getComponent(ii),value);
    }
 else {
      addPanel(value);
    }
  }
  while (pcount > length) {
    _panels.remove(--pcount);
  }
  updatePanels();
  if (_add != null) {
    _add.setEnabled(getLength() < _max);
  }
}
Program: 152029
Project: 152029
Buggy source:
protected boolean intersects(int x,int y,Shape shape){
  Polygon rect=new Polygon();
  float length=1 / 3f;
  int intersectionCount=0;
  for (int ii=0; ii < SUB_DIVISION; ii++) {
    float xmin=x + (length * ii);
    float xmax=x + (length * (ii + 1));
    for (int jj=0; jj < SUB_DIVISION; jj++) {
      float ymin=y + (length * jj);
      float ymax=y + (length * (jj + 1));
      updateQuad(xmin,ymin,xmax,ymax);
      if (shape.intersects(_quad)) {
        intersectionCount++;
      }
    }
  }
  return intersectionCount > ((SUB_DIVISION * SUB_DIVISION) / 2);
}

Fixed version (ground truth):
protected boolean intersects(int x,int y,Shape shape){
  Polygon rect=new Polygon();
  float length=1f / SUB_DIVISION;
  int intersectionCount=0;
  int nonIntersectionCount=0;
  int intersectsThreshold=((SUB_DIVISION * SUB_DIVISION) / 2);
  for (int ii=0; ii < SUB_DIVISION; ii++) {
    float xmin=x + (length * ii);
    float xmax=x + (length * (ii + 1));
    for (int jj=0; jj < SUB_DIVISION; jj++) {
      float ymin=y + (length * jj);
      float ymax=y + (length * (jj + 1));
      updateQuad(xmin,ymin,xmax,ymax);
      if (shape.intersects(_quad)) {
        intersectionCount++;
      }
 else {
        nonIntersectionCount++;
      }
      if (intersectionCount > intersectsThreshold) {
        return true;
      }
      if (nonIntersectionCount > intersectsThreshold) {
        return false;
      }
    }
  }
  return intersectionCount > intersectsThreshold;
}
Program: 152030
Project: 152030
Buggy source:
/** 
 * Create an ActionInterval.
 */
public ActionInterval(int executionStamp,Logic activator){
  super(_scenemgr);
  this.executionStamp=executionStamp;
  this.activator=activator;
  _intervals.add(this);
  schedule(executionStamp - _scenemgr.getTimestamp());
}

Fixed version (ground truth):
/** 
 * Create an ActionInterval.
 */
public ActionInterval(int executionStamp,Logic activator){
  super(_scenemgr);
  this.executionStamp=executionStamp;
  this.activator=activator;
  _intervals.add(this);
  schedule(Math.max(0,executionStamp - _scenemgr.getTimestamp()));
}
Program: 152031
Project: 152031
Buggy source:
/** 
 * Returns a string describing the specified key.
 */
public static String getDesc(MessageBundle msgs,int key){
  int idx;
  String result;
  int baseKey=getBaseKey(key);
  List<String> modifiers=Lists.newArrayList();
  OUTER:   for (int ii=0; ii < KEY_MODIFIERS.length; ii++) {
    if (hasModifierKey(key,KEY_MODIFIERS[ii])) {
      List<Integer> keys=_modifierToKeys.get(KEY_MODIFIERS[ii]);
      if (keys.isEmpty()) {
        modifiers.add("String_Node_Str" + (ii + 1));
        continue;
      }
      boolean isController=isControllerKey(baseKey);
      boolean isMouse=isMouseKey(baseKey);
      boolean isKeyboard=isKeyboardKey(baseKey);
      for (      int k : keys) {
        if ((isController && isControllerKey(k)) || (isMouse && isMouseKey(k)) || (isKeyboard && isKeyboardKey(k))) {
          modifiers.add(MessageBundle.taint(getDesc(msgs,k)));
          continue OUTER;
        }
      }
      modifiers.add(MessageBundle.taint(getDesc(msgs,keys.iterator().next())));
    }
  }
switch (getType(baseKey)) {
case KEY_CONTROLLER_BUTTON:
    idx=getControllerIndex(baseKey);
  result=MessageBundle.tcompose("String_Node_Str",String.valueOf(idx),Controllers.getController(idx).getButtonName(getControlIndex(baseKey)));
break;
case KEY_CONTROLLER_AXIS_POSITIVE:
idx=getControllerIndex(baseKey);
result=MessageBundle.tcompose("String_Node_Str",String.valueOf(idx),Controllers.getController(idx).getAxisName(getControlIndex(baseKey)));
break;
case KEY_CONTROLLER_AXIS_NEGATIVE:
idx=getControllerIndex(baseKey);
result=MessageBundle.tcompose("String_Node_Str",String.valueOf(idx),Controllers.getController(idx).getAxisName(getControlIndex(baseKey)));
break;
case KEY_CONTROLLER_POV_X_POSITIVE:
result=MessageBundle.tcompose("String_Node_Str",String.valueOf(getControllerIndex(baseKey)));
break;
case KEY_CONTROLLER_POV_X_NEGATIVE:
result=MessageBundle.tcompose("String_Node_Str",String.valueOf(getControllerIndex(baseKey)));
break;
case KEY_CONTROLLER_POV_Y_POSITIVE:
result=MessageBundle.tcompose("String_Node_Str",String.valueOf(getControllerIndex(baseKey)));
break;
case KEY_CONTROLLER_POV_Y_NEGATIVE:
result=MessageBundle.tcompose("String_Node_Str",String.valueOf(getControllerIndex(baseKey)));
break;
default :
String name=getName(baseKey);
String mkey="String_Node_Str" + StringUtil.toUSLowerCase(name);
result=msgs.exists(mkey) ? mkey : MessageBundle.taint(name);
}
if (!modifiers.isEmpty()) {
modifiers.add(result);
result=MessageBundle.compose("String_Node_Str" + modifiers.size(),modifiers.toArray());
}
return msgs.xlate(result);
}

Fixed version (ground truth):
/** 
 * Returns a string describing the specified key.
 */
public static String getDesc(MessageBundle msgs,int key){
}
Program: 152032
Project: 152032
Buggy source:
/** 
 * Instructs this component to lay itself out and then mark itself as valid.
 */
public void validate(){
  if (!_valid) {
    if (isVisible()) {
      layout();
    }
    _valid=true;
  }
}

Fixed version (ground truth):
@Override public void validate(){
  if (!_valid) {
    if (isVisible()) {
      layout();
    }
    _valid=true;
  }
}
Program: 152033
Project: 152033
Buggy source:
/** 
 * Returns true if this component is added to a hierarchy of components that culminates in a top-level window.
 */
public boolean isAdded(){
  Window win=getWindow();
  return (win != null && win.isAdded());
}

Fixed version (ground truth):
@Override public boolean isAdded(){
  Window win=getWindow();
  return (win != null && win.isAdded());
}
Program: 152034
Project: 152034
Buggy source:
/** 
 * This is called by a window or a scroll pane when it has become invalid.  The root node should schedule a revalidation of this component on the next tick or the next time an event is processed.
 */
public void rootInvalidated(Component root){
  if (!_invalidRoots.contains(root)) {
    _invalidRoots.addLast(root);
  }
}

Fixed version (ground truth):
/** 
 * This is called by a window or a scroll pane when it has become invalid.  The root node should schedule a revalidation of this component on the next tick or the next time an event is processed.
 */
public void rootInvalidated(Validateable root){
  if (!_invalidRoots.contains(root)) {
    _invalidRoots.addLast(root);
  }
}
Program: 152036
Project: 152036
Buggy source:
/** 
 * Initializing constructor. 
 */
public ScrollPane(GlContext ctx,Component child,boolean vert,boolean horiz,int snap,boolean buttons){
  super(ctx,new BorderLayout(0,0));
  init(child,vert,horiz,snap,buttons);
}

Fixed version (ground truth):
/** 
 * Initializing constructor.
 */
public ScrollPane(GlContext ctx,Component child,boolean vert,boolean horiz,int snap,boolean buttons){
  super(ctx,new BorderLayout(0,0));
  init(child,vert,horiz,snap,buttons);
}
Program: 152037
Project: 152037
Buggy source:
/** 
 * Returns the path of the property under the mouse cursor relative to this property.
 * @param pt the location of the mouse cursor.
 */
public String getMousePath(Point pt){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Returns the path of the property under the mouse cursor relative to this property.
 */
public String getMousePath(){
  Point pt=getMousePosition();
  return (pt == null) ? "String_Node_Str" : getPointPath(pt);
}
Program: 152038
Project: 152038
Buggy source:
/** 
 * Get the property path for the array.
 */
protected String getPropertyPath(){
  BaseEditorPanel editor=findBaseEditor();
  if (editor == null) {
    return "String_Node_Str";
  }
  Point pt=SwingUtilities.convertPoint(this,1,1,editor);
  String path=editor.getMousePath(pt);
  if (path.startsWith("String_Node_Str")) {
    path=path.substring(1);
  }
  return path;
}

Fixed version (ground truth):
/** 
 * Get the property path for the array.
 */
protected String getPropertyPath(){
  BaseEditorPanel editor=findBaseEditor();
  if (editor == null) {
    return "String_Node_Str";
  }
  Point pt=SwingUtilities.convertPoint(this,1,1,editor);
  String path=editor.getPointPath(pt);
  if (path.startsWith("String_Node_Str")) {
    path=path.substring(1);
  }
  return path;
}
Program: 152039
Project: 152039
Buggy source:
/** 
 * Creates a new actor sprite.
 */
public ActorSprite(TudeyContext ctx,TudeySceneView view,int timestamp,Actor actor){
  super(ctx,view);
  _actor=(Actor)actor.clone();
  if ((_advancer=_actor.maybeCreateAdvancer(ctx,view,timestamp)) == null) {
    _history=new ActorHistory(timestamp,actor,view.getBufferDelay() * 4);
  }
  _model=new Model(ctx);
  _model.setUserObject(this);
  _attachedModels=Maps.newHashMap();
  _attachedModels.put(_model,false);
  _shape=new ShapeElement(_actor.getOriginal().shape);
  _shape.setUserObject(this);
  _view.addTickParticipant(this);
  updateActor();
  if (isCreated()) {
    _view.getScene().add(_model);
    _view.getActorSpace().add(_shape);
    _model.tick(0f);
    update();
    if (timestamp == _actor.getCreated()) {
      _impl.wasCreated();
    }
  }
 else {
    _impl=null;
  }
}

Fixed version (ground truth):
/** 
 * Creates a new actor sprite.
 */
public ActorSprite(TudeyContext ctx,TudeySceneView view,int timestamp,Actor actor){
  super(ctx,view);
  _actor=(Actor)actor.clone();
  if ((_advancer=_actor.maybeCreateAdvancer(ctx,view,timestamp)) == null) {
    _history=new ActorHistory(timestamp,actor,view.getBufferDelay() * 4);
  }
  _model=new Model(ctx);
  _model.setUserObject(this);
  _attachedModels=Maps.newHashMap();
  _attachedModels.put(_model,true);
  _shape=new ShapeElement(_actor.getOriginal().shape);
  _shape.setUserObject(this);
  _view.addTickParticipant(this);
  updateActor();
  if (isCreated()) {
    _view.getScene().add(_model);
    _view.getActorSpace().add(_shape);
    _model.tick(0f);
    update();
    if (timestamp == _actor.getCreated()) {
      _impl.wasCreated();
    }
  }
 else {
    _impl=null;
  }
}
Program: 152040
Project: 152040
Buggy source:
/** 
 * Updates this animation based on the elapsed time in seconds. NOTE: This is DIFFERENT from the typical tickable interface! In our case, true = 'done animating', false = 'still animating'. (Default tickable, true = 'keep ticking', false = 'stop ticking'.)
 * @return true if the animation has completed.
 */
public boolean tick(float elapsed){
  long nnow=ScopeUtil.resolveTimestamp(this,Scope.NOW).value;
  elapsed=(nnow - _lastTickTimestamp) / 1000f;
  _lastTickTimestamp=nnow;
  return _impl.tick(elapsed);
}

Fixed version (ground truth):
/** 
 * Updates this animation based on the elapsed time in seconds. NOTE: This is DIFFERENT from the typical tickable interface! In our case, true = 'done animating', false = 'still animating'. (Default tickable, true = 'keep ticking', false = 'stop ticking'.)
 * @return true if the animation has completed.
 */
public boolean tick(float elapsed){
  long nnow=ScopeUtil.resolveTimestamp(this,Scope.NOW).value;
  float telapsed=(nnow - _lastTickTimestamp) / 1000f;
  _lastTickTimestamp=nnow;
  elapsed=_lastElapsed;
  _lastElapsed=telapsed;
  return _impl.tick(elapsed);
}
Program: 152043
Project: 152043
Buggy source:
/** 
 * Calculates the height of an entry.
 */
protected void computeHeight(Entry<V,C> entry,Container container){
  if (entry.height < 0) {
    if (entry.component == null) {
      entry.component=createComponent(entry.value);
    }
    boolean remove=false;
    if (!entry.component.isAdded()) {
      container.add(entry.component);
      remove=true;
    }
    int twidth=container.getWidth() - container.getInsets().getHorizontal();
    entry.height=entry.component.getPreferredSize(twidth,0).height;
    if (remove) {
      remove(entry.component);
    }
  }
}

Fixed version (ground truth):
/** 
 * Calculates the height of an entry.
 */
protected void computeHeight(Entry<V,C> entry,Container container){
  if (entry.height < 0) {
    if (entry.component == null) {
      entry.component=createComponent(entry.value);
    }
    boolean remove=false;
    if (!entry.component.isAdded()) {
      container.add(entry.component);
      remove=true;
    }
    int twidth=container.getWidth() - container.getInsets().getHorizontal();
    entry.height=entry.component.getPreferredSize(twidth,0).height;
    if (remove) {
      container.remove(entry.component);
    }
  }
}
Program: 152044
Project: 152044
Buggy source:
/** 
 * Warps the actor.
 * @param adjust if true, adjusts the location as when spawning to avoid intersecting otheractors.
 */
public void warp(float x,float y,float rotation,float tx,float ty,boolean adjust){
  _actor.set(Actor.WARP);
  float oldX=_actor.getTranslation().x;
  float oldY=_actor.getTranslation().y;
  float oldR=_actor.getRotation();
  if (tx != x || ty != y) {
    rotation=FloatMath.atan2(ty - y,tx - x);
  }
  move(x,y,rotation);
  if (adjust && _config.spawnMask != 0) {
    _scenemgr.getActorSpace().remove(_shape);
    if (_scenemgr.collides(_config.spawnMask,getShape(),_scenemgr.getTimestamp()) || _scenemgr.getPathfinder().getPath(this,MAX_ADJUSTMENT_PATH_LENGTH,tx,ty,false,false) == null) {
      adjustSpawnPoint(tx,ty);
      if (_scenemgr.getPathfinder().getPath(this,MAX_ADJUSTMENT_PATH_LENGTH,tx,ty,false,false) == null) {
        move(oldX,oldY,oldR);
      }
 else       if (tx != x || ty != y) {
        Vector2f trans=_actor.getTranslation();
        _actor.setRotation(FloatMath.atan2(ty - trans.y,tx - trans.x));
        updateShape();
      }
    }
    _scenemgr.getActorSpace().add(_shape);
  }
  _scenemgr.addTickParticipant(new TudeySceneManager.TickParticipant(){
    public boolean tick(    int timestamp){
      _actor.clear(Actor.WARP);
      wasUpdated();
      return false;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Warps the actor.
 * @param adjust if true, adjusts the location as when spawning to avoid intersecting otheractors.
 */
public void warp(float x,float y,float rotation,float tx,float ty,boolean adjust){
  _actor.set(Actor.WARP);
  float oldX=_actor.getTranslation().x;
  float oldY=_actor.getTranslation().y;
  float oldR=_actor.getRotation();
  if (tx != x || ty != y) {
    rotation=FloatMath.atan2(ty - y,tx - x);
  }
  move(x,y,rotation);
  if (adjust && _config.spawnMask != 0) {
    _scenemgr.getActorSpace().remove(_shape);
    boolean canPath=_scenemgr.getPathfinder().getPath(this,MAX_ADJUSTMENT_PATH_LENGTH,tx,ty,false,false) != null;
    if (!canPath || _scenemgr.collides(_config.spawnMask,getShape(),_scenemgr.getTimestamp())) {
      if (canPath) {
        adjustSpawnPoint(x,y);
      }
 else {
        adjustSpawnPoint(tx,ty);
      }
      if (_scenemgr.getPathfinder().getPath(this,MAX_ADJUSTMENT_PATH_LENGTH,tx,ty,false,false) == null) {
        move(oldX,oldY,oldR);
      }
 else       if (tx != x || ty != y) {
        Vector2f trans=_actor.getTranslation();
        _actor.setRotation(FloatMath.atan2(ty - trans.y,tx - trans.x));
        updateShape();
      }
    }
    _scenemgr.getActorSpace().add(_shape);
  }
  _scenemgr.addTickParticipant(new TudeySceneManager.TickParticipant(){
    public boolean tick(    int timestamp){
      _actor.clear(Actor.WARP);
      wasUpdated();
      return false;
    }
  }
);
}
Program: 152047
Project: 152047
Buggy source:
@Override protected void createGlyphs(){
  _glyphs=getTextFactory().wrapText(getDisplayText(),getColor(),UIConstants.PLAIN,UIConstants.DEFAULT_SIZE,null,_width - getInsets().getHorizontal());
  if (_glyphs.length != _lines) {
    _lines=_glyphs.length;
    invalidate();
  }
}

Fixed version (ground truth):
@Override protected void createGlyphs(){
  _glyphs=getTextFactory().wrapText(getDisplayText(),getColor(),UIConstants.PLAIN,UIConstants.DEFAULT_SIZE,null,_width - getInsets().getHorizontal());
}
Program: 152048
Project: 152048
Buggy source:
@Override protected Dimension computePreferredSize(int whint,int hhint){
  Insets insets=getInsets();
  int height=getTextFactory().getHeight();
  int width=(_prefWidth == -1) ? insets.getHorizontal() : _prefWidth;
  return (_glyphs == null) ? new Dimension(width,height) : new Dimension(width,(height * _glyphs.length) + insets.getVertical());
}

Fixed version (ground truth):
@Override protected Dimension computePreferredSize(int whint,int hhint){
  Insets insets=getInsets();
  int lineHeight=getTextFactory().getHeight();
  int width=(_prefWidth == -1) ? insets.getHorizontal() : _prefWidth;
  return new Dimension(width,(_lines * lineHeight) + insets.getVertical());
}
Program: 152050
Project: 152050
Buggy source:
/** 
 * Creates a canvas using one of our supported pixel formats.
 */
protected Component createCanvas(){
  return new DisplayCanvas(){
    @Override protected void didInit(){
      GlCanvasApp.this.init();
    }
    @Override protected void updateView(){
      GlCanvasApp.this.updateView();
    }
    @Override protected void renderView(){
      GlCanvasApp.this.renderView();
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Creates a canvas using one of our supported pixel formats.
 */
protected Component createCanvas(){
  if (RunAnywhere.isLinux()) {
    return new DisplayCanvas(){
      @Override protected void didInit(){
        GlCanvasApp.this.init();
      }
      @Override protected void updateView(){
        GlCanvasApp.this.updateView();
      }
      @Override protected void renderView(){
        GlCanvasApp.this.renderView();
      }
    }
;
  }
  for (  PixelFormat format : PIXEL_FORMATS) {
    try {
      return new AWTCanvas(format){
        @Override protected void didInit(){
          GlCanvasApp.this.init();
        }
        @Override protected void updateView(){
          GlCanvasApp.this.updateView();
        }
        @Override protected void renderView(){
          GlCanvasApp.this.renderView();
        }
      }
;
    }
 catch (    LWJGLException e) {
    }
  }
  log.warning("String_Node_Str");
  return null;
}
Program: 152051
Project: 152051
Buggy source:
protected void updateVisibility(int layer,boolean visible){
  TudeySceneView view=_editor.getView();
  for (  TudeySceneModel.Entry entry : _scene.getEntries()) {
    Object key=entry.getKey();
    if (layer == _scene.getLayer(key)) {
      EntrySprite sprite=view.getEntrySprite(key);
      if (sprite != null) {
        sprite.getModel().setVisible(visible);
      }
    }
  }
}

Fixed version (ground truth):
protected void updateVisibility(int layer,boolean visible){
  TudeySceneView view=_editor.getView();
  for (  TudeySceneModel.Entry entry : _scene.getEntries()) {
    Object key=entry.getKey();
    if (layer == _scene.getLayer(key)) {
      EntrySprite sprite=view.getEntrySprite(key);
      if (sprite != null) {
        Model model=sprite.getModel();
        if (model != null) {
          model.setVisible(visible);
        }
      }
    }
  }
}
Program: 152052
Project: 152052
Buggy source:
/** 
 * Sets the active tool.
 */
protected void setActiveTool(EditorTool tool){
  if (_activeTool == tool) {
    return;
  }
  if (_activeTool != null) {
    _activeTool.deactivate();
    _opanel.remove(_activeTool);
  }
  if ((_activeTool=tool) != null) {
    _opanel.add(_activeTool);
    _activeTool.activate();
  }
  boolean hideLayers=(tool instanceof GlobalEditor) || (tool instanceof Notepad);
  if (hideLayers) {
    _layerDividerPos=_layerSplit.getDividerLocation();
    _layers.setVisible(false);
  }
 else {
    _layers.setVisible(true);
    if (_layerDividerPos != 0) {
      _layerSplit.setDividerLocation(_layerDividerPos);
    }
  }
  boolean forceBase=(tool == _tileBrush) || (tool == _groundBrush) || (tool == _wallBrush);
  if (forceBase) {
    _layers.setSelectedLayer(0);
  }
  SwingUtil.refresh(_opanel);
}

Fixed version (ground truth):
/** 
 * Sets the active tool.
 */
protected void setActiveTool(EditorTool tool){
  if (_activeTool == tool) {
    return;
  }
  if (_activeTool != null) {
    _activeTool.deactivate();
    _opanel.remove(_activeTool);
  }
  if ((_activeTool=tool) != null) {
    _opanel.add(_activeTool);
    _activeTool.activate();
  }
  boolean hideLayers=(tool instanceof GlobalEditor) || (tool instanceof Notepad);
  if (hideLayers) {
    if (_layers.isVisible()) {
      _layerDividerPos=_layerSplit.getDividerLocation();
      _layers.setVisible(false);
    }
  }
 else {
    _layers.setVisible(true);
    if (_layerDividerPos != 0) {
      _layerSplit.setDividerLocation(_layerDividerPos);
    }
  }
  boolean forceBase=(tool == _tileBrush) || (tool == _groundBrush) || (tool == _wallBrush);
  if (forceBase) {
    _layers.setSelectedLayer(0);
  }
  SwingUtil.refresh(_opanel);
}
Program: 152053
Project: 152053
Buggy source:
/** 
 * Sets the GLSL shader state.
 */
public void setShaderState(Program program,boolean vertexProgramTwoSide){
  if (_program != program) {
    int id=(program == null) ? 0 : program.getId();
    ARBShaderObjects.glUseProgramObjectARB(id);
    _program=program;
    _states[RenderState.SHADER_STATE]=null;
  }
  if (program != null && program.getVertexShader() != null && _vertexProgramTwoSide != Boolean.valueOf(vertexProgramTwoSide)) {
    setCapability(ARBVertexShader.GL_VERTEX_PROGRAM_TWO_SIDE_ARB,_vertexProgramTwoSide=vertexProgramTwoSide);
  }
}

Fixed version (ground truth):
/** 
 * Sets the GLSL shader state.
 */
public void setShaderState(Program program,boolean vertexProgramTwoSide){
  if (_program != program) {
    int id=(program == null) ? 0 : program.getId();
    ARBShaderObjects.glUseProgramObjectARB(id);
    _program=program;
    _states[RenderState.SHADER_STATE]=null;
  }
  if (program != null && program.getVertexShader() != null && _vertexProgramTwoSide != Boolean.valueOf(vertexProgramTwoSide)) {
    setCapability(ARBVertexShader.GL_VERTEX_PROGRAM_TWO_SIDE_ARB,_vertexProgramTwoSide=vertexProgramTwoSide);
  }
  updateFogEnabled();
}
Program: 152054
Project: 152054
Buggy source:
/** 
 * Sets the linear fog state.  If <code>fogMode</code> is -1, fog will be disabled.
 */
public void setFogState(int fogMode,float fogStart,float fogEnd,Color4f fogColor){
  _states[RenderState.FOG_STATE]=null;
  boolean fogEnabled=(fogMode != -1);
  if (_fogEnabled != Boolean.valueOf(fogEnabled)) {
    setCapability(GL11.GL_FOG,_fogEnabled=fogEnabled);
  }
  if (!fogEnabled) {
    return;
  }
  if (_fogMode != fogMode) {
    GL11.glFogi(GL11.GL_FOG_MODE,_fogMode=fogMode);
  }
  if (_fogStart != fogStart) {
    GL11.glFogf(GL11.GL_FOG_START,_fogStart=fogStart);
  }
  if (_fogEnd != fogEnd) {
    GL11.glFogf(GL11.GL_FOG_END,_fogEnd=fogEnd);
  }
  if (!_fogColor.equals(fogColor)) {
    _fogColor.set(fogColor).get(_vbuf).rewind();
    GL11.glFog(GL11.GL_FOG_COLOR,_vbuf);
  }
}

Fixed version (ground truth):
/** 
 * Sets the linear fog state.  If <code>fogMode</code> is -1, fog will be disabled.
 */
public void setFogState(int fogMode,float fogStart,float fogEnd,Color4f fogColor){
  _states[RenderState.FOG_STATE]=null;
  _wouldEnableFog=(fogMode != -1);
  updateFogEnabled();
  if (!_wouldEnableFog) {
    return;
  }
  if (_fogMode != fogMode) {
    GL11.glFogi(GL11.GL_FOG_MODE,_fogMode=fogMode);
  }
  if (_fogStart != fogStart) {
    GL11.glFogf(GL11.GL_FOG_START,_fogStart=fogStart);
  }
  if (_fogEnd != fogEnd) {
    GL11.glFogf(GL11.GL_FOG_END,_fogEnd=fogEnd);
  }
  if (!_fogColor.equals(fogColor)) {
    _fogColor.set(fogColor).get(_vbuf).rewind();
    GL11.glFog(GL11.GL_FOG_COLOR,_vbuf);
  }
}
Program: 152055
Project: 152055
Buggy source:
/** 
 * Returns the configuration group with the specified name.  If the group is not found in this manager, the request will be forwarded to the parent, and so on.
 */
public ConfigGroup getGroup(String name){
  for (  ConfigGroup group : _groups.values()) {
    if (group.getName().equals(name)) {
      return group;
    }
  }
  return (_parent == null) ? null : _parent.getGroup(name);
}

Fixed version (ground truth):
/** 
 * Returns the configuration group with the specified name.
 * @param forward if true and there's no such group, forward the request to the parent.
 */
public ConfigGroup getGroup(String name,boolean forward){
  for (  ConfigGroup group : _groups.values()) {
    if (group.getName().equals(name)) {
      return group;
    }
  }
  return (forward && _parent != null) ? _parent.getGroup(name) : null;
}
Program: 152056
Project: 152056
Buggy source:
public boolean canTraverse(Object traverser,int x,int y){
  for (int yy=y - bottom, yymax=y + top; yy <= yymax; yy++) {
    for (int xx=x - left, xxmax=x + right; xx <= xxmax; xx++) {
      if (actor.canCollide(_entryFlags.get(xx / SUBDIVISION,yy / SUBDIVISION))) {
        return false;
      }
 else       if (collideActor && actor.canCollide(_actorFlags.get(x,y))) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean canTraverse(Object traverser,int x,int y){
  for (int yy=y - bottom, yymax=y + top; yy <= yymax; yy++) {
    for (int xx=x - left, xxmax=x + right; xx <= xxmax; xx++) {
      if (actor.canCollide(_entryFlags.get(xx / SUBDIVISION,yy / SUBDIVISION))) {
        return false;
      }
 else       if (collideActor && actor.canCollide(_actorFlags.get(xx,yy))) {
        return false;
      }
    }
  }
  return true;
}