nus-yam/ex-repair huggingface dataset:
Program: 1003
Project: 1003
Buggy source:
@Test public void testSaveLoad() throws IOException {
  AssetManager assetManager=mock(AssetManager.class);
  CoreRegistry.put(AssetManager.class,assetManager);
  BehaviorTreeLoader loader=new BehaviorTreeLoader();
  BehaviorTreeData data=buildSample();
  OutputStream os=new ByteArrayOutputStream(10000);
  loader.save(os,data);
  String jsonExpected=os.toString();
  data=loader.load(null,new ByteArrayInputStream(jsonExpected.getBytes()),null);
  os=new ByteArrayOutputStream(10000);
  loader=new BehaviorTreeLoader();
  loader.save(os,data);
  String jsonActual=os.toString();
  Assert.assertEquals(jsonActual,jsonExpected);
  System.out.println(jsonActual);
}

Fixed version (ground truth):
@Test public void testSaveLoad() throws IOException {
  AssetManager assetManager=mock(AssetManager.class);
  CoreRegistry.put(AssetManager.class,assetManager);
  BehaviorNodeFactory nodeFactory=mock(BehaviorNodeFactory.class);
  CoreRegistry.put(BehaviorNodeFactory.class,nodeFactory);
  BehaviorTreeLoader loader=new BehaviorTreeLoader();
  BehaviorTreeData data=buildSample();
  OutputStream os=new ByteArrayOutputStream(10000);
  loader.save(os,data);
  String jsonExpected=os.toString();
  data=loader.load(null,new ByteArrayInputStream(jsonExpected.getBytes()),null);
  os=new ByteArrayOutputStream(10000);
  loader=new BehaviorTreeLoader();
  loader.save(os,data);
  String jsonActual=os.toString();
  Assert.assertEquals(jsonActual,jsonExpected);
}
Program: 1004
Project: 1004
Buggy source:
@Override public Node read(JsonReader in) throws IOException {
  int id=in.nextInt();
  return treeGson.getNode(id);
}

Fixed version (ground truth):
@Override public RenderableNode read(JsonReader in) throws IOException {
  in.beginObject();
  nextName(in,"String_Node_Str");
  int id=in.nextInt();
  Node node=treeGson.getNode(id);
  RenderableNode renderableNode=new RenderableNode(CoreRegistry.get(BehaviorNodeFactory.class).getNodeComponent(node));
  renderableNode.setNode(node);
  nextName(in,"String_Node_Str");
  in.beginArray();
  float x=(float)in.nextDouble();
  float y=(float)in.nextDouble();
  in.endArray();
  renderableNode.setPosition(x,y);
  nextName(in,"String_Node_Str");
  in.beginArray();
  x=(float)in.nextDouble();
  y=(float)in.nextDouble();
  in.endArray();
  renderableNode.setSize(new Vector2f(x,y));
  nextName(in,"String_Node_Str");
  in.beginArray();
  int i=0;
  while (in.hasNext()) {
    RenderableNode child=gsonNode.fromJson(in,RenderableNode.class);
    renderableNode.setChild(i,child);
    i++;
  }
  in.endArray();
  in.endObject();
  return renderableNode;
}
Program: 1005
Project: 1005
Buggy source:
private RenderableBehaviorTreeGson(){
  gsonNode=new GsonBuilder().setPrettyPrinting().registerTypeHierarchyAdapter(Node.class,new NodeTypeAdapter()).create();
}

Fixed version (ground truth):
private RenderableBehaviorTreeGson(){
  gsonNode=new GsonBuilder().setPrettyPrinting().registerTypeHierarchyAdapter(Node.class,new NodeTypeAdapter()).registerTypeHierarchyAdapter(RenderableNode.class,new RenderableNodeTypeAdapter()).create();
}
Program: 1006
Project: 1006
Buggy source:
@Override public void write(JsonWriter out,Node value) throws IOException {
  int id=treeGson.getId(value);
  out.value(id);
}

Fixed version (ground truth):
@Override public void write(JsonWriter out,RenderableNode value) throws IOException {
  out.beginObject().name("String_Node_Str").value(treeGson.getId(value.getNode())).name("String_Node_Str").beginArray().value(value.getPosition().x).value(value.getPosition().y).endArray().name("String_Node_Str").beginArray().value(value.getSize().x).value(value.getSize().y).endArray().name("String_Node_Str");
  gsonNode.toJson(value.children(),List.class,out);
  out.endObject();
}
Program: 1007
Project: 1007
Buggy source:
@Override public void onInitialize(){
  count=Math.max(1,getNode().limit);
}

Fixed version (ground truth):
@Override public void onInitialize(){
  count=getNode().limit;
}
Program: 1008
Project: 1008
Buggy source:
public void tick(float dt){
  if (debugger == null || debugger.beforeTick()) {
    while (step(dt)) {
      continue;
    }
    if (debugger != null) {
      debugger.afterTick();
    }
  }
}

Fixed version (ground truth):
public void tick(float dt){
  if (debugger == null || debugger.beforeTick()) {
    startedNodes.clear();
    while (step(dt)) {
      continue;
    }
    if (debugger != null) {
      debugger.afterTick();
    }
  }
}
Program: 1009
Project: 1009
Buggy source:
public void stop(Task task,Status result){
  task.setStatus(result);
  Task.Observer observer=task.getObserver();
  if (observer != null) {
    observer.handle(result);
  }
}

Fixed version (ground truth):
public void stop(Task task,Status result){
  task.setStatus(result);
  Task.Observer observer=task.getObserver();
  if (observer != null) {
    observer.handle(result);
  }
  tasks.remove(task);
  if (debugger != null) {
    debugger.nodeFinished(task.getNode(),result);
  }
}
Program: 1010
Project: 1010
Buggy source:
public boolean step(float dt){
  Task current=tasks.pollFirst();
  if (current == TERMINAL) {
    tasks.addLast(TERMINAL);
    return false;
  }
  current.tick(dt);
  if (current.getStatus() != Status.RUNNING && current.getObserver() != null) {
    logger.info("String_Node_Str" + current + "String_Node_Str"+ current.getStatus());
    if (debugger != null) {
      debugger.nodeFinished(current.getNode(),current.getStatus());
    }
    current.getObserver().handle(current.getStatus());
  }
 else {
    tasks.addLast(current);
    if (debugger != null) {
      debugger.nodeUpdated(current.getNode(),current.getStatus());
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean step(float dt){
  Task current=tasks.pollFirst();
  if (current == TERMINAL) {
    tasks.addLast(TERMINAL);
    return false;
  }
  if (startedNodes.contains(current.getNode())) {
    tasks.addLast(current);
    return true;
  }
  startedNodes.add(current.getNode());
  current.tick(dt);
  if (current.getStatus() != Status.RUNNING && current.getObserver() != null) {
    if (debugger != null) {
      debugger.nodeFinished(current.getNode(),current.getStatus());
    }
    current.getObserver().handle(current.getStatus());
  }
 else {
    tasks.addLast(current);
    if (debugger != null) {
      debugger.nodeUpdated(current.getNode(),current.getStatus());
    }
  }
  return true;
}
Program: 1011
Project: 1011
Buggy source:
@Override public void onInitialize(){
  interpreter().start(getNode().child,this);
}

Fixed version (ground truth):
@Override public void onInitialize(){
  if (getNode().child != null) {
    interpreter().start(getNode().child,this);
  }
}
Program: 1012
Project: 1012
Buggy source:
@Override public void handle(Status result){
  if (result == Status.FAILURE) {
    interpreter().stop(this,Status.FAILURE);
    return;
  }
  interpreter().start(getNode().child,this);
}

Fixed version (ground truth):
@Override public void handle(Status result){
  if (result == Status.FAILURE) {
    interpreter().stop(this,Status.FAILURE);
    return;
  }
  if (getNode().child != null) {
    interpreter().start(getNode().child,this);
  }
}
Program: 1013
Project: 1013
Buggy source:
public PropertyProvider(T target){
  factories.put(Range.class,new RangePropertyFactory());
  factories.put(Checkbox.class,new CheckboxPropertyFactory());
  factories.put(OneOf.List.class,new OneOfListPropertyFactory());
  factories.put(TextField.class,new TextPropertyFactory());
  try {
    this.target=target;
    Class<?> type=target.getClass();
    ReflectFactory reflectFactory=CoreRegistry.get(ReflectFactory.class);
    CopyStrategyLibrary copyStrategies=new CopyStrategyLibrary(reflectFactory);
    ClassMetadata<?,?> classMetadata=new DefaultClassMetadata<>(new SimpleUri(),type,reflectFactory,copyStrategies);
    for (    Field field : getAllFields(type)) {
      Annotation annotation=getFactory(field);
      if (annotation != null) {
        FieldMetadata<Object,?> fieldMetadata=(FieldMetadata<Object,?>)classMetadata.getField(field.getName());
        PropertyFactory factory=factories.get(annotation.annotationType());
        Property property=factory.create(fieldMetadata,field.getName(),annotation);
        properties.add(property);
      }
    }
  }
 catch (  NoSuchMethodException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public PropertyProvider(T target){
  factories.put(Range.class,new RangePropertyFactory());
  factories.put(Checkbox.class,new CheckboxPropertyFactory());
  factories.put(OneOf.List.class,new OneOfListPropertyFactory());
  factories.put(OneOf.Enum.class,new OneOfEnumPropertyFactory());
  factories.put(TextField.class,new TextPropertyFactory());
  try {
    this.target=target;
    Class<?> type=target.getClass();
    ReflectFactory reflectFactory=CoreRegistry.get(ReflectFactory.class);
    CopyStrategyLibrary copyStrategies=new CopyStrategyLibrary(reflectFactory);
    ClassMetadata<?,?> classMetadata=new DefaultClassMetadata<>(new SimpleUri(),type,reflectFactory,copyStrategies);
    for (    Field field : getAllFields(type)) {
      Annotation annotation=getFactory(field);
      if (annotation != null) {
        FieldMetadata<Object,?> fieldMetadata=(FieldMetadata<Object,?>)classMetadata.getField(field.getName());
        PropertyFactory factory=factories.get(annotation.annotationType());
        Property property=factory.create(fieldMetadata,field.getName(),annotation);
        properties.add(property);
      }
    }
  }
 catch (  NoSuchMethodException e) {
    throw new RuntimeException(e);
  }
}
Program: 1014
Project: 1014
Buggy source:
/** 
 * Note: Keep an eye out for recursive delete being added to the core Java API in the future - there are certain circumstances in which this can be unsafe.
 * @param path
 * @throws IOException
 */
public static void recursiveDelete(Path path) throws IOException {
  Files.walkFileTree(path,new SimpleFileVisitor<Path>(){
    @Override public FileVisitResult visitFile(    Path file,    BasicFileAttributes attrs) throws IOException {
      Files.delete(file);
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFileFailed(    Path file,    IOException exc) throws IOException {
      Files.delete(file);
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult postVisitDirectory(    Path dir,    IOException exc) throws IOException {
      if (exc == null) {
        Files.delete(dir);
        return FileVisitResult.CONTINUE;
      }
 else {
        throw exc;
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Note: Keep an eye out for recursive delete being added to the core Java API in the future - there are certain circumstances in which this can be unsafe.
 * @param path
 * @throws IOException
 */
public static void recursiveDelete(Path path) throws IOException {
  if (Files.isDirectory(path)) {
    Files.walkFileTree(path,new SimpleFileVisitor<Path>(){
      @Override public FileVisitResult visitFile(      Path file,      BasicFileAttributes attrs) throws IOException {
        Files.delete(file);
        return FileVisitResult.CONTINUE;
      }
      @Override public FileVisitResult visitFileFailed(      Path file,      IOException exc) throws IOException {
        Files.delete(file);
        return FileVisitResult.CONTINUE;
      }
      @Override public FileVisitResult postVisitDirectory(      Path dir,      IOException exc) throws IOException {
        if (exc == null) {
          Files.delete(dir);
          return FileVisitResult.CONTINUE;
        }
 else {
          throw exc;
        }
      }
    }
);
  }
}
Program: 1015
Project: 1015
Buggy source:
@Override public void purgeChunks(){
  ChunkMonitor.fireChunkProviderDisposed(this);
  pipeline.shutdown();
  unloadRequestTaskMaster.shutdown(new ChunkUnloadRequest(),true);
  for (  ChunkImpl chunk : nearCache.values()) {
    worldEntity.send(new BeforeChunkUnload(chunk.getPos()));
    chunk.dispose();
    ChunkStore store=storageManager.createChunkStoreForSave(chunk);
    store.storeAllEntities();
    store.save();
  }
  nearCache.clear();
  storageManager.purgeChunks();
  this.pipeline=new ChunkGenerationPipeline(this,generator,new ChunkTaskRelevanceComparator());
  this.unloadRequestTaskMaster=TaskMaster.createFIFOTaskMaster("String_Node_Str",8);
  ChunkMonitor.fireChunkProviderInitialized(this);
  for (  ChunkRelevanceRegion chunkRelevanceRegion : regions.values()) {
    pipeline.requestProduction(chunkRelevanceRegion.getRegion().expand(new Vector3i(2,0,2)));
    chunkRelevanceRegion.setUpToDate();
  }
}

Fixed version (ground truth):
@Override public void purgeChunks(){
  ChunkMonitor.fireChunkProviderDisposed(this);
  pipeline.shutdown();
  unloadRequestTaskMaster.shutdown(new ChunkUnloadRequest(),true);
  for (  ChunkImpl chunk : nearCache.values()) {
    if (chunk.getChunkState() == ChunkImpl.State.COMPLETE && chunk.isReady()) {
      worldEntity.send(new BeforeChunkUnload(chunk.getPos()));
    }
    chunk.dispose();
    ChunkStore store=storageManager.createChunkStoreForSave(chunk);
    store.storeAllEntities();
    store.save();
  }
  nearCache.clear();
  storageManager.purgeChunks();
  this.pipeline=new ChunkGenerationPipeline(this,generator,new ChunkTaskRelevanceComparator());
  this.unloadRequestTaskMaster=TaskMaster.createFIFOTaskMaster("String_Node_Str",8);
  ChunkMonitor.fireChunkProviderInitialized(this);
  for (  ChunkRelevanceRegion chunkRelevanceRegion : regions.values()) {
    pipeline.requestProduction(chunkRelevanceRegion.getRegion().expand(new Vector3i(2,0,2)));
    chunkRelevanceRegion.setUpToDate();
  }
}
Program: 1016
Project: 1016
Buggy source:
public ModuleClassLoader(URL[] urls,ClassLoader parent,ModuleSecurityManager securityManager){
  super(urls,parent);
  this.securityManager=securityManager;
  pool=new ClassPool(ClassPool.getDefault());
  for (  URL url : urls) {
    try {
      pool.appendClassPath(url.getFile());
    }
 catch (    NotFoundException e) {
      logger.error("String_Node_Str",url);
    }
  }
}

Fixed version (ground truth):
public ModuleClassLoader(URL[] urls,ClassLoader parent,ModuleSecurityManager securityManager){
  super(urls,parent);
  this.securityManager=securityManager;
  pool=new ClassPool(ClassPool.getDefault());
  for (  URL url : urls) {
    try {
      pool.appendClassPath(Paths.get(url.toURI()).toString());
    }
 catch (    NotFoundException|URISyntaxException e) {
      logger.error("String_Node_Str",url);
    }
  }
}
Program: 1017
Project: 1017
Buggy source:
private void initConfig(){
  if (Files.isRegularFile(Config.getConfigFile())) {
    try {
      config=Config.load(Config.getConfigFile());
    }
 catch (    IOException e) {
      logger.error("String_Node_Str",e);
      config=new Config();
    }
  }
 else {
    config=new Config();
  }
  if (!config.getDefaultModSelection().hasModule("String_Node_Str")) {
    config.getDefaultModSelection().addModule("String_Node_Str");
  }
  if (config.getSecurity().getServerPrivateCertificate() == null) {
    CertificateGenerator generator=new CertificateGenerator();
    CertificatePair serverIdentity=generator.generateSelfSigned();
    config.getSecurity().setServerCredentials(serverIdentity.getPublicCert(),serverIdentity.getPrivateCert());
    config.save();
  }
  logger.info("String_Node_Str" + config.getRendering().toString());
  logger.info("String_Node_Str" + config.getRendering().getDebug().toString());
  CoreRegistry.putPermanently(Config.class,config);
}

Fixed version (ground truth):
private void initConfig(){
  if (Files.isRegularFile(Config.getConfigFile())) {
    try {
      config=Config.load(Config.getConfigFile());
    }
 catch (    IOException e) {
      logger.error("String_Node_Str",e);
      config=new Config();
    }
  }
 else {
    config=new Config();
  }
  if (!config.getDefaultModSelection().hasModule("String_Node_Str")) {
    config.getDefaultModSelection().addModule("String_Node_Str");
  }
  if (config.getSecurity().getServerPrivateCertificate() == null) {
    CertificateGenerator generator=new CertificateGenerator();
    CertificatePair serverIdentity=generator.generateSelfSigned();
    config.getSecurity().setServerCredentials(serverIdentity.getPublicCert(),serverIdentity.getPrivateCert());
    config.save();
  }
  logger.info("String_Node_Str" + config.getRendering().toString());
  CoreRegistry.putPermanently(Config.class,config);
}
Program: 1019
Project: 1019
Buggy source:
@Override public void click(UIDisplayElement element,int button){
  logger.info("String_Node_Str" + config.getRendering().toString());
  logger.info("String_Node_Str" + config.getRendering().getDebug().toString());
  CoreRegistry.get(ShaderManager.class).recompileAllShaders();
  getGUIManager().openWindow("String_Node_Str");
}

Fixed version (ground truth):
@Override public void click(UIDisplayElement element,int button){
  logger.info("String_Node_Str" + config.getRendering().toString());
  CoreRegistry.get(ShaderManager.class).recompileAllShaders();
  getGUIManager().openWindow("String_Node_Str");
}
Program: 1020
Project: 1020
Buggy source:
@Override public void onButtonActivated(UIButton button){
  logger.info("String_Node_Str" + config.getRendering().toString());
  logger.info("String_Node_Str" + config.getRendering().getDebug().toString());
  CoreRegistry.get(ShaderManager.class).recompileAllShaders();
  TerasologyEngine te=(TerasologyEngine)engine;
  if (te.isFullscreen() != find("String_Node_Str",UICheckbox.class).isChecked()) {
    te.setFullscreen(!te.isFullscreen());
  }
  nuiManager.popScreen();
}

Fixed version (ground truth):
@Override public void onButtonActivated(UIButton button){
  logger.info("String_Node_Str" + config.getRendering().toString());
  CoreRegistry.get(ShaderManager.class).recompileAllShaders();
  TerasologyEngine te=(TerasologyEngine)engine;
  if (te.isFullscreen() != find("String_Node_Str",UICheckbox.class).isChecked()) {
    te.setFullscreen(!te.isFullscreen());
  }
  nuiManager.popScreen();
}
Program: 1022
Project: 1022
Buggy source:
public FlatWorldGenerator(SimpleUri uri){
  super(uri);
  register(new FlatTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.AddDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}

Fixed version (ground truth):
public FlatWorldGenerator(SimpleUri uri){
  super(uri);
  register(new FlatTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.addDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}
Program: 1023
Project: 1023
Buggy source:
public HeightMapWorldGenerator(SimpleUri uri){
  super(uri);
  register(new BasicHMTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.AddDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}

Fixed version (ground truth):
public HeightMapWorldGenerator(SimpleUri uri){
  super(uri);
  register(new BasicHMTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.addDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}
Program: 1024
Project: 1024
Buggy source:
public MixedWorldGenerator(SimpleUri uri){
  super(uri);
  register(new MultiTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.AddDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}

Fixed version (ground truth):
public MixedWorldGenerator(SimpleUri uri){
  super(uri);
  register(new MultiTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.addDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}
Program: 1025
Project: 1025
Buggy source:
public PerlinWorldGenerator(SimpleUri uri){
  super(uri);
  register(new PerlinTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.AddDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}

Fixed version (ground truth):
public PerlinWorldGenerator(SimpleUri uri){
  super(uri);
  register(new PerlinTerrainGenerator());
  register(new FloraGenerator());
  register(new LiquidsGenerator());
  ForestGenerator forestGenerator=new ForestGenerator();
  DefaultGenerators.addDefaultForestGenerators(forestGenerator);
  register(forestGenerator);
}
Program: 1026
Project: 1026
Buggy source:
private Rect2i applyFixedSizesToRegion(Rect2i region){
  UIStyle style=getCurrentStyle();
  if (style.getFixedWidth() != 0 || style.getFixedHeight() != 0) {
    int newWidth=(style.getFixedWidth() != 0) ? style.getFixedWidth() : region.width();
    int newHeight=(style.getFixedHeight() != 0) ? style.getFixedHeight() : region.height();
    int newMinX=region.minX() + style.getHorizontalAlignment().getOffset(newWidth,region.width());
    int newMinY=region.minY() + style.getVerticalAlignment().getOffset(newHeight,region.height());
    return Rect2i.createFromMinAndSize(newMinX,newMinY,newWidth,newHeight);
  }
  return region;
}

Fixed version (ground truth):
private Rect2i applyFixedSizesToRegion(Rect2i region,UIStyle style){
  if (style.getFixedWidth() != 0 || style.getFixedHeight() != 0) {
    int newWidth=(style.getFixedWidth() != 0) ? style.getFixedWidth() : region.width();
    int newHeight=(style.getFixedHeight() != 0) ? style.getFixedHeight() : region.height();
    int newMinX=region.minX() + style.getHorizontalAlignment().getOffset(newWidth,region.width());
    int newMinY=region.minY() + style.getVerticalAlignment().getOffset(newHeight,region.height());
    return Rect2i.createFromMinAndSize(newMinX,newMinY,newWidth,newHeight);
  }
  return region;
}
Program: 1027
Project: 1027
Buggy source:
@Override public void drawElement(UIElement element,Rect2i region){
  UIStyle newStyle=state.skin.getStyleFor((element.getFamily() != null) ? element.getFamily() : state.family,element.getClass(),element.getMode());
  Rect2i regionArea=applyFixedSizesToRegion(region);
  try (SubRegion ignored=subRegion(regionArea,false)){
    state.element=element;
    if (element.getFamily() != null) {
      setFamily(element.getFamily());
    }
    setPart("String_Node_Str");
    setMode(element.getMode());
    if (newStyle.isBackgroundAutomaticallyDrawn()) {
      drawBackground();
    }
    element.onDraw(this);
  }
 }

Fixed version (ground truth):
@Override public void drawElement(UIElement element,Rect2i region){
  UIStyle newStyle=state.skin.getStyleFor((element.getFamily() != null) ? element.getFamily() : state.family,element.getClass(),element.getMode());
  Rect2i regionArea=applyFixedSizesToRegion(region,newStyle);
  try (SubRegion ignored=subRegion(regionArea,false)){
    state.element=element;
    if (element.getFamily() != null) {
      setFamily(element.getFamily());
    }
    setPart("String_Node_Str");
    setMode(element.getMode());
    if (newStyle.isBackgroundAutomaticallyDrawn()) {
      drawBackground();
    }
    element.onDraw(this);
  }
 }
Program: 1028
Project: 1028
Buggy source:
public BlockAppearance(Map<BlockPart,BlockMeshPart> blockParts,Map<BlockPart,Vector2f> textureAtlasPos){
  this.blockParts=blockParts;
  this.textureAtlasPos=textureAtlasPos;
  for (  BlockPart part : BlockPart.values()) {
    if (textureAtlasPos == null) {
      textureAtlasPos.put(part,new Vector2f());
    }
  }
}

Fixed version (ground truth):
public BlockAppearance(Map<BlockPart,BlockMeshPart> blockParts,Map<BlockPart,Vector2f> textureAtlasPos){
  Preconditions.checkNotNull(blockParts);
  Preconditions.checkNotNull(textureAtlasPos);
  this.blockParts=blockParts;
  this.textureAtlasPos.putAll(textureAtlasPos);
  for (  BlockPart part : BlockPart.values()) {
    Preconditions.checkNotNull("String_Node_Str" + part,textureAtlasPos.get(part));
  }
}
Program: 1031
Project: 1031
Buggy source:
@Override public void render(){
  canvas.preRender();
  canvas.drawText(font,"String_Node_Str");
  canvas.setOffset(15,100);
  canvas.drawTextShadowed(font,"String_Node_Str",Color.BLACK);
  try (SubRegion ignored=canvas.subRegion(Rect2i.createFromMinAndMax(0,300,100,500),true)){
    canvas.drawText(font,"String_Node_Str",300);
  }
   canvas.setOffset(0,150);
  canvas.drawText(font,"String_Node_Str");
  canvas.postRender();
}

Fixed version (ground truth):
@Override public void render(){
  canvas.preRender();
  canvas.drawTexture(Assets.getTexture("String_Node_Str"),Rect2i.createFromMinAndSize(0,0,400,400),ScaleMode.STRETCH);
  canvas.drawText(font,"String_Node_Str");
  canvas.setOffset(15,100);
  canvas.drawTextShadowed(font,"String_Node_Str",Color.BLACK);
  try (SubRegion ignored=canvas.subRegion(Rect2i.createFromMinAndMax(0,300,100,500),true)){
    canvas.drawText(font,"String_Node_Str",300);
  }
   canvas.setOffset(0,150);
  canvas.drawText(font,"String_Node_Str");
  canvas.postRender();
}
Program: 1032
Project: 1032
Buggy source:
public LwjglSubRegion(Rect2i region,boolean crop){
  previousState=state;
  subregionStack.push(this);
  int left=region.minX() + state.region.minX();
  int right=region.maxX() + state.region.minX();
  int top=region.minY() + state.region.minY();
  int bottom=region.maxY() + state.region.minY();
  Rect2i subRegion=Rect2i.createFromMinAndMax(left,top,right,bottom);
  if (crop) {
    int cropLeft=Math.max(left,state.cropRegion.minX());
    int cropRight=Math.min(right,state.cropRegion.maxX());
    int cropTop=Math.max(top,state.cropRegion.minY());
    int cropBottom=Math.min(bottom,state.cropRegion.maxY());
    state=new CanvasState(subRegion,Rect2i.createFromMinAndMax(cropLeft,cropTop,cropRight,cropBottom));
    glScissor(cropLeft,cropTop,cropRight - cropLeft,cropBottom - cropTop);
  }
 else {
    state=new CanvasState(subRegion);
  }
}

Fixed version (ground truth):
public LwjglSubRegion(Rect2i region,boolean crop){
  previousState=state;
  subregionStack.push(this);
  int left=region.minX() + state.region.minX();
  int right=region.maxX() + state.region.minX();
  int top=region.minY() + state.region.minY();
  int bottom=region.maxY() + state.region.minY();
  Rect2i subRegion=Rect2i.createFromMinAndMax(left,top,right,bottom);
  if (crop) {
    int cropLeft=Math.max(left,state.cropRegion.minX());
    int cropRight=Math.min(right,state.cropRegion.maxX());
    int cropTop=Math.max(top,state.cropRegion.minY());
    int cropBottom=Math.min(bottom,state.cropRegion.maxY());
    state=new CanvasState(subRegion,Rect2i.createFromMinAndMax(cropLeft,cropTop,cropRight,cropBottom));
    glScissor(cropLeft,cropTop,cropRight - cropLeft,cropBottom - cropTop);
    croppingRegion=true;
  }
 else {
    state=new CanvasState(subRegion);
  }
}
Program: 1033
Project: 1033
Buggy source:
public CanvasState(Rect2i region,Rect2i cropRegion){
  this.region=region;
  this.cropRegion=cropRegion;
  this.cropped=true;
}

Fixed version (ground truth):
public CanvasState(Rect2i region,Rect2i cropRegion){
  this.region=region;
  this.cropRegion=cropRegion;
}
Program: 1034
Project: 1034
Buggy source:
@Override public void close(){
  if (!disposed) {
    disposed=true;
    LwjglSubRegion region=subregionStack.pop();
    while (!region.equals(this)) {
      logger.error("String_Node_Str");
      region.close();
      region=subregionStack.pop();
    }
    if (state.cropped) {
      glScissor(previousState.region.minX(),previousState.region.minY(),previousState.region.width(),previousState.region.height());
    }
    state=previousState;
  }
}

Fixed version (ground truth):
@Override public void close(){
  if (!disposed) {
    disposed=true;
    LwjglSubRegion region=subregionStack.pop();
    while (!region.equals(this)) {
      logger.error("String_Node_Str");
      region.close();
      region=subregionStack.pop();
    }
    if (croppingRegion) {
      glScissor(previousState.region.minX(),previousState.region.minY(),previousState.region.width(),previousState.region.height());
    }
    state=previousState;
  }
}
Program: 1035
Project: 1035
Buggy source:
@Override public Map<Material,Mesh> createTextMesh(List<String> lines){
  Map<Material,MeshBuilder> meshBuilders=Maps.newLinkedHashMap();
  addLinesToMesh(lines,meshBuilders);
  Map<Material,Mesh> result=Maps.newLinkedHashMap();
  for (  Map.Entry<Material,MeshBuilder> entry : meshBuilders.entrySet()) {
    result.put(entry.getKey(),entry.getValue().getMesh());
  }
  return result;
}

Fixed version (ground truth):
@Override public Map<Material,Mesh> createTextMesh(List<String> lines){
  Map<Material,MeshBuilder> meshBuilders=Maps.newLinkedHashMap();
  addLinesToMesh(lines,meshBuilders);
  Map<Material,Mesh> result=Maps.newLinkedHashMap();
  for (  Map.Entry<Material,MeshBuilder> entry : meshBuilders.entrySet()) {
    result.put(entry.getKey(),entry.getValue().build());
  }
  return result;
}
Program: 1036
Project: 1036
Buggy source:
private void addLinesToMesh(List<String> lines,Map<Material,MeshBuilder> meshBuilders){
  int y=0;
  for (  String line : lines) {
    int x=0;
    for (    char c : line.toCharArray()) {
      FontCharacter character=data.getCharacter(c);
      if (character != null && character.getPage() != null) {
        MeshBuilder builder=meshBuilders.get(character.getPageMat());
        if (builder == null) {
          builder=new MeshBuilder();
          meshBuilders.put(character.getPageMat(),builder);
        }
        builder.addCharacter(character,x,y);
        x+=character.getxAdvance();
      }
    }
    y+=data.getLineHeight();
  }
}

Fixed version (ground truth):
private void addLinesToMesh(List<String> lines,Map<Material,MeshBuilder> meshBuilders){
  int y=0;
  for (  String line : lines) {
    int x=0;
    for (    char c : line.toCharArray()) {
      FontCharacter character=data.getCharacter(c);
      if (character != null && character.getPage() != null) {
        MeshBuilder builder=meshBuilders.get(character.getPageMat());
        if (builder == null) {
          builder=new MeshBuilder();
          meshBuilders.put(character.getPageMat(),builder);
        }
        addCharacter(builder,character,x,y);
        x+=character.getxAdvance();
      }
    }
    y+=data.getLineHeight();
  }
}
Program: 1037
Project: 1037
Buggy source:
public void addCharacter(FontCharacter character,int x,int y){
  float top=y + character.getyOffset();
  float bottom=top + character.getHeight();
  float left=x + character.getxOffset();
  float right=left + character.getWidth();
  float texTop=character.getY();
  float texBottom=texTop + character.getTexHeight();
  float texLeft=character.getX();
  float texRight=texLeft + character.getTexWidth();
  meshData.getVertices().add(left);
  meshData.getVertices().add(top);
  meshData.getVertices().add(0);
  meshData.getTexCoord0().add(texLeft);
  meshData.getTexCoord0().add(texTop);
  meshData.getVertices().add(right);
  meshData.getVertices().add(top);
  meshData.getVertices().add(0);
  meshData.getTexCoord0().add(texRight);
  meshData.getTexCoord0().add(texTop);
  meshData.getVertices().add(right);
  meshData.getVertices().add(bottom);
  meshData.getVertices().add(0);
  meshData.getTexCoord0().add(texRight);
  meshData.getTexCoord0().add(texBottom);
  meshData.getVertices().add(left);
  meshData.getVertices().add(bottom);
  meshData.getVertices().add(0);
  meshData.getTexCoord0().add(texLeft);
  meshData.getTexCoord0().add(texBottom);
  meshData.getIndices().add(vertCount);
  meshData.getIndices().add(vertCount + 1);
  meshData.getIndices().add(vertCount + 2);
  meshData.getIndices().add(vertCount);
  meshData.getIndices().add(vertCount + 2);
  meshData.getIndices().add(vertCount + 3);
  vertCount+=4;
}

Fixed version (ground truth):
public void addCharacter(MeshBuilder builder,FontCharacter character,int x,int y){
  float top=y + character.getyOffset();
  float bottom=top + character.getHeight();
  float left=x + character.getxOffset();
  float right=left + character.getWidth();
  float texTop=character.getY();
  float texBottom=texTop + character.getTexHeight();
  float texLeft=character.getX();
  float texRight=texLeft + character.getTexWidth();
  Vector3f v1=new Vector3f(left,top,0);
  Vector3f v2=new Vector3f(right,top,0);
  Vector3f v3=new Vector3f(right,bottom,0);
  Vector3f v4=new Vector3f(left,bottom,0);
  builder.addPoly(v1,v2,v3,v4);
  builder.addTexCoord(texLeft,texTop);
  builder.addTexCoord(texRight,texTop);
  builder.addTexCoord(texRight,texBottom);
  builder.addTexCoord(texLeft,texBottom);
}
Program: 1039
Project: 1039
Buggy source:
private static void spreadSunlightInternal(Chunk chunk,int x,int y,int z,Block block){
  byte lightValue=chunk.getSunlight(x,y,z);
  if (y > 0 && SUNLIGHT_RULES.canSpreadOutOf(block,Side.BOTTOM)) {
    Block adjBlock=chunk.getBlock(x,y - 1,z);
    if (chunk.getSunlight(x,y - 1,z) < lightValue - 1 && SUNLIGHT_RULES.canSpreadInto(adjBlock,Side.TOP)) {
      chunk.setSunlight(x,y - 1,z,(byte)(lightValue - 1));
      spreadSunlightInternal(chunk,x,y - 1,z,adjBlock);
    }
  }
  if (y < Chunk.SIZE_Y && lightValue < Chunk.MAX_LIGHT && SUNLIGHT_RULES.canSpreadOutOf(block,Side.TOP)) {
    Block adjBlock=chunk.getBlock(x,y + 1,z);
    if (chunk.getSunlight(x,y + 1,z) < lightValue - 1 && SUNLIGHT_RULES.canSpreadInto(adjBlock,Side.BOTTOM)) {
      chunk.setSunlight(x,y + 1,z,(byte)(lightValue - 1));
      spreadSunlightInternal(chunk,x,y + 1,z,adjBlock);
    }
  }
  if (lightValue <= 1) {
    return;
  }
  for (  Side adjDir : Side.horizontalSides()) {
    int adjX=x + adjDir.getVector3i().x;
    int adjZ=z + adjDir.getVector3i().z;
    if (chunk.isInBounds(adjX,y,adjZ) && SUNLIGHT_RULES.canSpreadOutOf(block,adjDir)) {
      byte adjLightValue=chunk.getSunlight(adjX,y,adjZ);
      Block adjBlock=chunk.getBlock(adjX,y,adjZ);
      if (adjLightValue < lightValue - 1 && SUNLIGHT_RULES.canSpreadInto(adjBlock,adjDir.reverse())) {
        chunk.setSunlight(adjX,y,adjZ,(byte)(lightValue - 1));
        spreadSunlightInternal(chunk,adjX,y,adjZ,adjBlock);
      }
    }
  }
}

Fixed version (ground truth):
private static void spreadSunlightInternal(Chunk chunk,int x,int y,int z,Block block){
  byte lightValue=chunk.getSunlight(x,y,z);
  if (lightValue <= 1) {
    return;
  }
  if (y > 0 && SUNLIGHT_RULES.canSpreadOutOf(block,Side.BOTTOM)) {
    Block adjBlock=chunk.getBlock(x,y - 1,z);
    if (chunk.getSunlight(x,y - 1,z) < lightValue - 1 && SUNLIGHT_RULES.canSpreadInto(adjBlock,Side.TOP)) {
      chunk.setSunlight(x,y - 1,z,(byte)(lightValue - 1));
      spreadSunlightInternal(chunk,x,y - 1,z,adjBlock);
    }
  }
  if (y < Chunk.SIZE_Y && lightValue < Chunk.MAX_LIGHT && SUNLIGHT_RULES.canSpreadOutOf(block,Side.TOP)) {
    Block adjBlock=chunk.getBlock(x,y + 1,z);
    if (chunk.getSunlight(x,y + 1,z) < lightValue - 1 && SUNLIGHT_RULES.canSpreadInto(adjBlock,Side.BOTTOM)) {
      chunk.setSunlight(x,y + 1,z,(byte)(lightValue - 1));
      spreadSunlightInternal(chunk,x,y + 1,z,adjBlock);
    }
  }
  for (  Side adjDir : Side.horizontalSides()) {
    int adjX=x + adjDir.getVector3i().x;
    int adjZ=z + adjDir.getVector3i().z;
    if (chunk.isInBounds(adjX,y,adjZ) && SUNLIGHT_RULES.canSpreadOutOf(block,adjDir)) {
      byte adjLightValue=chunk.getSunlight(adjX,y,adjZ);
      Block adjBlock=chunk.getBlock(adjX,y,adjZ);
      if (adjLightValue < lightValue - 1 && SUNLIGHT_RULES.canSpreadInto(adjBlock,adjDir.reverse())) {
        chunk.setSunlight(adjX,y,adjZ,(byte)(lightValue - 1));
        spreadSunlightInternal(chunk,adjX,y,adjZ,adjBlock);
      }
    }
  }
}
Program: 1040
Project: 1040
Buggy source:
public AssetUri resolve(AssetType type,String name){
  AssetUri uri=new AssetUri(type,name);
  if (uri.isValid()) {
    return uri;
  }
  List<AssetUri> possibilities=resolveAll(type,name);
switch (possibilities.size()) {
case 0:
    return null;
case 1:
  return possibilities.get(0);
default :
Module context=ModuleContext.getContext();
if (context != null) {
Set<String> dependencies=moduleManager.getDependencyNamesOf(context);
Iterator<AssetUri> iterator=possibilities.iterator();
while (iterator.hasNext()) {
  AssetUri possibleUri=iterator.next();
  if (context.getId().equals(possibleUri.getNormalisedModuleName())) {
    return possibleUri;
  }
  if (!dependencies.contains(possibleUri.getNormalisedModuleName())) {
    iterator.remove();
  }
}
if (possibilities.size() == 1) {
  return possibilities.get(0);
}
}
return null;
}
}

Fixed version (ground truth):
public AssetUri resolve(AssetType type,String name){
  List<AssetUri> possibilities=resolveAll(type,name);
switch (possibilities.size()) {
case 0:
    return null;
case 1:
  return possibilities.get(0);
default :
Module context=ModuleContext.getContext();
if (context != null) {
Set<String> dependencies=moduleManager.getDependencyNamesOf(context);
Iterator<AssetUri> iterator=possibilities.iterator();
while (iterator.hasNext()) {
  AssetUri possibleUri=iterator.next();
  if (context.getId().equals(possibleUri.getNormalisedModuleName())) {
    return possibleUri;
  }
  if (!dependencies.contains(possibleUri.getNormalisedModuleName())) {
    iterator.remove();
  }
}
if (possibilities.size() == 1) {
  return possibilities.get(0);
}
}
return null;
}
}
Program: 1041
Project: 1041
Buggy source:
public List<AssetUri> resolveAll(AssetType type,String name){
  return Lists.newArrayList(uriLookup.get(type).row(UriUtil.normalise(name)).values());
}

Fixed version (ground truth):
public List<AssetUri> resolveAll(AssetType type,String name){
  AssetUri uri=new AssetUri(type,name);
  if (uri.isValid()) {
    return Lists.newArrayList(uri);
  }
  return Lists.newArrayList(uriLookup.get(type).row(UriUtil.normalise(name)).values());
}
Program: 1042
Project: 1042
Buggy source:
public void receiveFamilyRegistration(BlockUri familyUri,Map<String,Integer> registration){
  BlockFamily family;
  if (isFreeformFamily(familyUri.getRootFamilyUri())) {
    family=blockLoader.loadWithShape(familyUri);
  }
 else {
    family=getAvailableBlockFamily(familyUri);
  }
  if (family != null) {
    for (    Block block : family.getBlocks()) {
      Integer id=registration.get(block.getURI().toString());
      if (id != null) {
        block.setId((byte)id.intValue());
      }
 else {
        logger.error("String_Node_Str",block.getURI(),familyUri);
        block.setId(UNKNOWN_ID);
      }
      registerFamily(family);
    }
  }
 else {
    logger.error("String_Node_Str",familyUri);
  }
}

Fixed version (ground truth):
public void receiveFamilyRegistration(BlockUri familyUri,Map<String,Integer> registration){
  BlockFamily family;
  if (isFreeformFamily(familyUri)) {
    family=blockLoader.loadWithShape(familyUri);
  }
 else {
    family=getAvailableBlockFamily(familyUri);
  }
  if (family != null) {
    for (    Block block : family.getBlocks()) {
      Integer id=registration.get(block.getURI().toString());
      if (id != null) {
        block.setId((byte)id.intValue());
      }
 else {
        logger.error("String_Node_Str",block.getURI(),familyUri);
        block.setId(UNKNOWN_ID);
      }
      registerFamily(family);
    }
  }
 else {
    logger.error("String_Node_Str",familyUri);
  }
}
Program: 1043
Project: 1043
Buggy source:
@Override public boolean isFreeformFamily(BlockUri familyUri){
  return freeformBlockUris.contains(familyUri);
}

Fixed version (ground truth):
@Override public boolean isFreeformFamily(BlockUri familyUri){
  return freeformBlockUris.contains(familyUri.getRootFamilyUri());
}
Program: 1044
Project: 1044
Buggy source:
private boolean isSubtype(CtClass cc,Class parentType) throws NotFoundException {
  if (parentType.isInterface()) {
    for (    CtClass parentInterface : cc.getInterfaces()) {
      if (parentInterface.getName().equals(parentInterface.getName())) {
        return true;
      }
 else       if (isSubtype(parentInterface,parentType)) {
        return true;
      }
    }
    if (cc.getSuperclass() != null) {
      return isSubtype(cc,parentType);
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isSubtype(CtClass cc,Class parentType) throws NotFoundException {
  if (parentType.isInterface()) {
    for (    CtClass parentInterface : cc.getInterfaces()) {
      if (parentInterface.getName().equals(parentInterface.getName())) {
        return true;
      }
 else       if (isSubtype(parentInterface,parentType)) {
        return true;
      }
    }
    if (cc.getSuperclass() != null) {
      return isSubtype(cc.getSuperclass(),parentType);
    }
  }
  return false;
}
Program: 1045
Project: 1045
Buggy source:
@Override public void update(float delta){
  long startTime=1000 * Sys.getTime() / Sys.getTimerResolution();
  while (current != null && 1000 * Sys.getTime() / Sys.getTimerResolution() - startTime < 20) {
    if (current.step()) {
      popStep();
    }
 else {
      completedSteps++;
    }
  }
  if (current == null) {
    CoreRegistry.get(GUIManager.class).closeWindow("String_Node_Str");
    CoreRegistry.get(GameEngine.class).changeState(new StateIngame());
  }
 else {
    if (currentExpectedSteps > 0) {
      loadingScreen.updateStatus(current.getMessage(),100f * completedSteps / currentExpectedSteps);
    }
 else {
      loadingScreen.updateStatus(current.getMessage(),0);
    }
    guiManager.update();
  }
}

Fixed version (ground truth):
@Override public void update(float delta){
  long startTime=1000 * Sys.getTime() / Sys.getTimerResolution();
  while (current != null && 1000 * Sys.getTime() / Sys.getTimerResolution() - startTime < 20) {
    if (current.step()) {
      popStep();
    }
 else {
      completedSteps++;
    }
  }
  if (current == null) {
    CoreRegistry.get(GUIManager.class).closeWindow("String_Node_Str");
    CoreRegistry.get(GameEngine.class).changeState(new StateIngame());
  }
 else {
    if (currentExpectedSteps > 0) {
      loadingScreen.updateStatus(current.getMessage(),Math.min(100f,100f * completedSteps / currentExpectedSteps));
    }
 else {
      loadingScreen.updateStatus(current.getMessage(),0);
    }
    guiManager.update();
  }
}
Program: 1046
Project: 1046
Buggy source:
/** 
 * Set the value which the slider should have.
 * @param value The value. The range of the value should be greater or equal than the minimum value and lower or equal than the maximum value.
 */
public void setValue(int value){
  this.value=value;
  progressLine.updateProgress(value,range);
  notifyChangedListeners();
}

Fixed version (ground truth):
/** 
 * Set the value which the slider should have.
 * @param value The value. The range of the value should be greater or equal than the minimum value and lower or equal than the maximum value.
 */
public void setValue(int value){
  this.value=TeraMath.clamp(value,minValue,maxValue);
  progressLine.updateProgress(value,range);
  notifyChangedListeners();
}
Program: 1047
Project: 1047
Buggy source:
@Override public void reload(MaterialData data){
  dispose();
  shader=(GLSLShader)data.getShader();
  recompile();
  for (  Map.Entry<String,Texture> entry : data.getTextures().entrySet()) {
    setTexture(entry.getKey(),entry.getValue());
  }
  for (  Map.Entry<String,Float> entry : data.getFloatParams().entrySet()) {
    setFloat(entry.getKey(),entry.getValue());
  }
  for (  Map.Entry<String,Integer> entry : data.getIntegerParams().entrySet()) {
    setInt(entry.getKey(),entry.getValue());
  }
  for (  Map.Entry<String,float[]> entry : data.getFloatArrayParams().entrySet()) {
switch (entry.getValue().length) {
case 1:
      setFloat(entry.getKey(),entry.getValue()[0]);
    break;
case 2:
  setFloat2(entry.getKey(),entry.getValue()[0],entry.getValue()[1]);
break;
case 3:
setFloat3(entry.getKey(),entry.getValue()[0],entry.getValue()[1],entry.getValue()[2]);
break;
case 4:
setFloat4(entry.getKey(),entry.getValue()[0],entry.getValue()[1],entry.getValue()[2],entry.getValue()[3]);
break;
}
}
}

Fixed version (ground truth):
@Override public void reload(MaterialData data){
  Util.checkGLError();
  dispose();
  shader=(GLSLShader)data.getShader();
  recompile();
  for (  Map.Entry<String,Texture> entry : data.getTextures().entrySet()) {
    setTexture(entry.getKey(),entry.getValue());
  }
  for (  Map.Entry<String,Float> entry : data.getFloatParams().entrySet()) {
    setFloat(entry.getKey(),entry.getValue());
  }
  for (  Map.Entry<String,Integer> entry : data.getIntegerParams().entrySet()) {
    setInt(entry.getKey(),entry.getValue());
  }
  for (  Map.Entry<String,float[]> entry : data.getFloatArrayParams().entrySet()) {
switch (entry.getValue().length) {
case 1:
      setFloat(entry.getKey(),entry.getValue()[0]);
    break;
case 2:
  setFloat2(entry.getKey(),entry.getValue()[0],entry.getValue()[1]);
break;
case 3:
setFloat3(entry.getKey(),entry.getValue()[0],entry.getValue()[1],entry.getValue()[2]);
break;
case 4:
setFloat4(entry.getKey(),entry.getValue()[0],entry.getValue()[1],entry.getValue()[2],entry.getValue()[3]);
break;
}
}
Util.checkGLError();
}
Program: 1048
Project: 1048
Buggy source:
@Override public void reload(ShaderData data){
  logger.debug("String_Node_Str",getURI());
  dispose();
  shaderProgramBase=data;
  parameters.clear();
  for (  ShaderParameterMetadata metadata : shaderProgramBase.getParameterMetadata()) {
    parameters.put(metadata.getName(),metadata);
  }
  updateAvailableFeatures();
  recompile();
}

Fixed version (ground truth):
@Override public void reload(ShaderData data){
  Util.checkGLError();
  logger.debug("String_Node_Str",getURI());
  dispose();
  shaderProgramBase=data;
  parameters.clear();
  for (  ShaderParameterMetadata metadata : shaderProgramBase.getParameterMetadata()) {
    parameters.put(metadata.getName(),metadata);
  }
  updateAvailableFeatures();
  recompile();
  Util.checkGLError();
}
Program: 1049
Project: 1049
Buggy source:
@Override public void reload(MeshData newData){
  dispose();
  buildMesh(newData);
}

Fixed version (ground truth):
@Override public void reload(MeshData newData){
  Util.checkGLError();
  dispose();
  buildMesh(newData);
  Util.checkGLError();
}
Program: 1050
Project: 1050
Buggy source:
@Override public void reload(SkeletalMeshData newData){
  dispose();
  this.data=newData;
  vboPosNormBuffer=VertexBufferObjectManager.getInstance().getVboId();
  IntBuffer indexBuffer=BufferUtils.createIntBuffer(newData.getIndices().size());
  indexBuffer.put(newData.getIndices().toArray());
  indexBuffer.flip();
  vboIndexBuffer=VertexBufferObjectManager.getInstance().getVboId();
  VertexBufferObjectManager.getInstance().bufferVboElementData(vboIndexBuffer,indexBuffer,GL15.GL_STATIC_DRAW);
  FloatBuffer uvBuffer=BufferUtils.createFloatBuffer(newData.getUVs().size() * 2);
  for (  Vector2f uv : newData.getUVs()) {
    uvBuffer.put(uv.x);
    uvBuffer.put(uv.y);
  }
  uvBuffer.flip();
  vboUVBuffer=VertexBufferObjectManager.getInstance().getVboId();
  VertexBufferObjectManager.getInstance().bufferVboData(vboUVBuffer,uvBuffer,GL15.GL_STATIC_DRAW);
}

Fixed version (ground truth):
@Override public void reload(SkeletalMeshData newData){
  Util.checkGLError();
  dispose();
  this.data=newData;
  vboPosNormBuffer=VertexBufferObjectManager.getInstance().getVboId();
  IntBuffer indexBuffer=BufferUtils.createIntBuffer(newData.getIndices().size());
  indexBuffer.put(newData.getIndices().toArray());
  indexBuffer.flip();
  vboIndexBuffer=VertexBufferObjectManager.getInstance().getVboId();
  VertexBufferObjectManager.getInstance().bufferVboElementData(vboIndexBuffer,indexBuffer,GL15.GL_STATIC_DRAW);
  FloatBuffer uvBuffer=BufferUtils.createFloatBuffer(newData.getUVs().size() * 2);
  for (  Vector2f uv : newData.getUVs()) {
    uvBuffer.put(uv.x);
    uvBuffer.put(uv.y);
  }
  uvBuffer.flip();
  vboUVBuffer=VertexBufferObjectManager.getInstance().getVboId();
  VertexBufferObjectManager.getInstance().bufferVboData(vboUVBuffer,uvBuffer,GL15.GL_STATIC_DRAW);
  Util.checkGLError();
}
Program: 1052
Project: 1052
Buggy source:
@Override public Prefab deserialize(EntityData.Value value){
  if (value.getStringCount() > 0) {
    return CoreRegistry.get(PrefabManager.class).getPrefab(value.getString(0));
  }
  return null;
}

Fixed version (ground truth):
@Override public Prefab deserialize(EntityData.Value value){
  if (value.getStringCount() > 0) {
    return Assets.getPrefab(value.getString(0));
  }
  return null;
}