nus-yam/ex-repair huggingface dataset:
Program: 20018
Project: 20018
Buggy source:
/** 
 * Kutsutaan kun aktiviteetti luodaan. 
 */
@Override public void onCreate(Bundle _savedInstanceState){
  super.onCreate(_savedInstanceState);
  setContentView(R.layout.main);
  context=getApplicationContext();
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  View storyButton=findViewById(R.id.button_story);
  storyButton.setOnClickListener(this);
  View survivalButton=findViewById(R.id.button_survival);
  survivalButton.setOnClickListener(this);
  View helpButton=findViewById(R.id.button_help);
  helpButton.setOnClickListener(this);
  View highscoresButton=findViewById(R.id.button_highscores);
  highscoresButton.setOnClickListener(this);
  View optionsButton=findViewById(R.id.button_options);
  optionsButton.setOnClickListener(this);
  View quitButton=findViewById(R.id.button_quit);
  quitButton.setOnClickListener(this);
  SoundManager.getInstance();
  SoundManager.initSounds(this);
}

Fixed version (ground truth):
/** 
 * Kutsutaan kun aktiviteetti luodaan. 
 */
@Override public void onCreate(Bundle _savedInstanceState){
  super.onCreate(_savedInstanceState);
  setContentView(R.layout.main);
  context=getApplicationContext();
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  View storyButton=findViewById(R.id.button_story);
  storyButton.setOnClickListener(this);
  View survivalButton=findViewById(R.id.button_survival);
  survivalButton.setOnClickListener(this);
  View helpButton=findViewById(R.id.button_help);
  helpButton.setOnClickListener(this);
  View highscoresButton=findViewById(R.id.button_highscores);
  highscoresButton.setOnClickListener(this);
  View optionsButton=findViewById(R.id.button_options);
  optionsButton.setOnClickListener(this);
  View quitButton=findViewById(R.id.button_quit);
  quitButton.setOnClickListener(this);
  SoundManager.getInstance();
  SoundManager.initSounds(this);
  SoundManager.loadSounds();
}
Program: 20019
Project: 20019
Buggy source:
public static final void playSound(int _index,float _speed){
  float streamVolume=audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
  streamVolume=streamVolume / audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
  soundPool.play((Integer)soundPoolMap.get(_index),streamVolume,streamVolume,1,0,_speed);
}

Fixed version (ground truth):
public static final void playSound(int _index,float _speed){
  if (Options.sounds) {
    float streamVolume=audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
    streamVolume=streamVolume / audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    soundPool.play((Integer)soundPoolMap.get(_index),streamVolume,streamVolume,1,0,_speed);
  }
}
Program: 20020
Project: 20020
Buggy source:
public static final void initSounds(Context _context){
  context=_context;
  soundPool=new SoundPool(4,AudioManager.STREAM_MUSIC,0);
  soundPoolMap=new HashMap<Integer,Integer>();
  audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  loadSounds();
}

Fixed version (ground truth):
public static final void initSounds(Context _context){
  context=_context;
  soundPool=new SoundPool(4,AudioManager.STREAM_MUSIC,0);
  soundPoolMap=new HashMap<Integer,Integer>();
  audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
}
Program: 20021
Project: 20021
Buggy source:
protected TouchManager(GLSurfaceView _glSurfaceView,Context _context){
  weaponManager=WeaponManager.getConnection();
  hud=HUD.getConnection();
  screenWidth=GameActivity.dm.widthPixels;
  screenHeight=GameActivity.dm.heightPixels;
  setSurfaceListeners(_glSurfaceView);
}

Fixed version (ground truth):
protected TouchManager(GLSurfaceView _glSurfaceView,Context _context,HUD _hud){
  weaponManager=WeaponManager.getConnection();
  hud=_hud;
  screenWidth=GameActivity.dm.widthPixels;
  screenHeight=GameActivity.dm.heightPixels;
  setSurfaceListeners(_glSurfaceView);
}
Program: 20022
Project: 20022
Buggy source:
public void readLevel(int _id){
  XmlResourceParser level;
  try {
    level=context.getResources().getXml(R.xml.class.getField("String_Node_Str" + _id).getInt(getClass()));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  try {
    while (level.getEventType() != XmlPullParser.END_DOCUMENT) {
      if (level.getEventType() == XmlPullParser.START_TAG) {
        if (level.getName().equals("String_Node_Str")) {
          renderer.players.add(new Player(gl,context,level.getAttributeResourceValue(null,"String_Node_Str",0),level.getAttributeIntValue(null,"String_Node_Str",10),level.getAttributeIntValue(null,"String_Node_Str",0)));
        }
 else         if (level.getName().equals("String_Node_Str")) {
        }
      }
 else       if (level.getEventType() == XmlPullParser.END_TAG) {
      }
 else       if (level.getEventType() == XmlPullParser.TEXT) {
      }
      level.next();
    }
  }
 catch (  XmlPullParserException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void readLevel(int _id){
  XmlResourceParser level=null;
  try {
    level=context.getResources().getXml(R.xml.class.getField("String_Node_Str" + _id).getInt(getClass()));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  try {
    while (level.getEventType() != XmlPullParser.END_DOCUMENT) {
      if (level.getEventType() == XmlPullParser.START_TAG) {
        if (level.getName().equals("String_Node_Str")) {
          renderer.players.add(new Player(gl,context,level.getAttributeResourceValue(null,"String_Node_Str",0),level.getAttributeIntValue(null,"String_Node_Str",10),level.getAttributeIntValue(null,"String_Node_Str",0)));
        }
 else         if (level.getName().equals("String_Node_Str")) {
        }
      }
 else       if (level.getEventType() == XmlPullParser.END_TAG) {
      }
 else       if (level.getEventType() == XmlPullParser.TEXT) {
      }
      level.next();
    }
  }
 catch (  XmlPullParserException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 20023
Project: 20023
Buggy source:
public BeanDefinition parse(Element element,ParserContext parserContext){
  BeanDefinitionBuilder beanBuilder=BeanDefinitionBuilder.genericBeanDefinition(JdbcConnectionRepository.class);
  String jdbcTemplate=element.getAttribute("String_Node_Str");
  beanBuilder.addConstructorArgReference(jdbcTemplate);
  String stringEncryptor=element.getAttribute("String_Node_Str");
  if (stringEncryptor != null && !stringEncryptor.isEmpty()) {
    beanBuilder.addConstructorArgReference(stringEncryptor);
  }
 else {
    beanBuilder.addConstructorArgValue(Encryptors.noOpText());
  }
  AbstractBeanDefinition beanDefinition=beanBuilder.getBeanDefinition();
  parserContext.getRegistry().registerBeanDefinition("String_Node_Str",beanDefinition);
  return beanDefinition;
}

Fixed version (ground truth):
public BeanDefinition parse(Element element,ParserContext parserContext){
  BeanDefinitionBuilder beanBuilder=BeanDefinitionBuilder.genericBeanDefinition(JdbcConnectionRepository.class);
  String dataSource=element.getAttribute("String_Node_Str");
  beanBuilder.addConstructorArgReference(dataSource);
  String stringEncryptor=element.getAttribute("String_Node_Str");
  if (stringEncryptor != null && !stringEncryptor.isEmpty()) {
    beanBuilder.addConstructorArgReference(stringEncryptor);
  }
 else {
    beanBuilder.addConstructorArgValue(Encryptors.noOpText());
  }
  AbstractBeanDefinition beanDefinition=beanBuilder.getBeanDefinition();
  parserContext.getRegistry().registerBeanDefinition("String_Node_Str",beanDefinition);
  return beanDefinition;
}
Program: 20024
Project: 20024
Buggy source:
public void retweet(long tweetId){
  @SuppressWarnings("String_Node_Str") ResponseEntity<Map> response=restOperations.postForEntity(RETWEET_URL,Collections.emptyMap(),Map.class,Collections.singletonMap("String_Node_Str",Long.toString(tweetId)));
  handleResponseErrors(response);
}

Fixed version (ground truth):
public void retweet(long tweetId){
  @SuppressWarnings("String_Node_Str") ResponseEntity<Map> response=restOperations.postForEntity(RETWEET_URL,"String_Node_Str",Map.class,Collections.singletonMap("String_Node_Str",Long.toString(tweetId)));
  handleResponseErrors(response);
}
Program: 20025
Project: 20025
Buggy source:
/** 
 * Create a new instance of ScribeOAuth1RequestSigner.
 * @param accessToken the access token value
 * @param accessTokenSecret the access token secret
 * @param apiKey the API key assigned by the provider
 * @param apiSecret the API secret assigned by the provider
 */
public ScribeOAuth1RequestSigner(String apiKey,String apiSecret,String accessToken,String accessTokenSecret){
  this.accessToken=accessToken;
  this.accessTokenSecret=accessTokenSecret;
  this.service=new ServiceBuilder().provider(TwitterApi.class).apiKey(apiKey).apiSecret(apiSecret).callback("String_Node_Str").build();
}

Fixed version (ground truth):
/** 
 * Create a new instance of ScribeOAuth1RequestSigner.
 * @param accessToken the access token value
 * @param accessTokenSecret the access token secret
 * @param apiKey the API key assigned by the provider
 * @param apiSecret the API secret assigned by the provider
 */
public ScribeOAuth1RequestSigner(String apiKey,String apiSecret,String accessToken,String accessTokenSecret){
  this.accessToken=accessToken;
  this.accessTokenSecret=accessTokenSecret;
  this.service=new ServiceBuilder().provider(LinkedInApi.class).apiKey(apiKey).apiSecret(apiSecret).callback("String_Node_Str").build();
}
Program: 20026
Project: 20026
Buggy source:
/** 
 * Create a new instance of TwitterTemplate. This constructor creates a new TwitterTemplate given the minimal amount of information required to sign a request and builds up a  {@link RestOperations} internally using this information.
 * @param apiKey the application's API key.
 * @param apiSecret the application's API secret.
 * @param accessToken the user's access token, given after successful OAuth authentication.
 * @param accessTokenSecret the access token secret, given along with the access token after successful OAuth authentication.
 */
public TwitterTemplate(String apiKey,String apiSecret,String accessToken,String accessTokenSecret){
  this.restOperations=new RestTemplate(new OAuthSigningClientHttpRequestFactory(new ScribeOAuth1RequestSigner(apiKey,apiSecret,accessToken,accessTokenSecret)));
}

Fixed version (ground truth):
/** 
 * Create a new instance of TwitterTemplate. This constructor creates a new TwitterTemplate given the minimal amount of information required to sign a request and builds up a  {@link RestOperations} internally using this information.
 * @param apiKey the application's API key.
 * @param apiSecret the application's API secret.
 * @param accessToken the user's access token, given after successful OAuth authentication.
 * @param accessTokenSecret the access token secret, given along with the access token after successful OAuth authentication.
 */
public TwitterTemplate(String apiKey,String apiSecret,String accessToken,String accessTokenSecret){
  RestTemplate restTemplate=new RestTemplate(new OAuthSigningClientHttpRequestFactory(new ScribeOAuth1RequestSigner(apiKey,apiSecret,accessToken,accessTokenSecret)));
  restTemplate.setErrorHandler(new TwitterErrorHandler());
  this.restOperations=restTemplate;
  this.statusCodeTranslator=new TwitterResponseStatusCodeTranslator();
}
Program: 20027
Project: 20027
Buggy source:
SearchResults buildSearchResults(Map<String,Object> response,List<Tweet> tweets){
  Long maxId=response.containsKey("String_Node_Str") ? NumberUtils.parseNumber((String)response.get("String_Node_Str"),Long.class) : 0;
  Long sinceId=response.containsKey("String_Node_Str") ? NumberUtils.parseNumber((String)response.get("String_Node_Str"),Long.class) : 0;
  return new SearchResults(tweets,maxId,sinceId,response.get("String_Node_Str") == null);
}

Fixed version (ground truth):
SearchResults buildSearchResults(Map<String,Object> response,List<Tweet> tweets){
  Number maxId=response.containsKey("String_Node_Str") ? (Number)response.get("String_Node_Str") : 0;
  Number sinceId=response.containsKey("String_Node_Str") ? (Number)response.get("String_Node_Str") : 0;
  return new SearchResults(tweets,maxId.longValue(),sinceId.longValue(),response.get("String_Node_Str") == null);
}
Program: 20028
Project: 20028
Buggy source:
@Test public void buildSearchResults(){
  TwitterTemplate twitter=new TwitterTemplate(null);
  Map<String,Object> response=new HashMap<String,Object>();
  response.put("String_Node_Str","String_Node_Str");
  response.put("String_Node_Str","String_Node_Str");
  response.put("String_Node_Str","String_Node_Str");
  SearchResults results=twitter.buildSearchResults(response,new ArrayList<Tweet>());
  assertEquals(42,results.getMaxId());
  assertEquals(24,results.getSinceId());
  assertEquals(false,results.isLastPage());
}

Fixed version (ground truth):
@Test public void buildSearchResults(){
  TwitterTemplate twitter=new TwitterTemplate(null);
  Map<String,Object> response=new HashMap<String,Object>();
  response.put("String_Node_Str",42);
  response.put("String_Node_Str",24);
  response.put("String_Node_Str","String_Node_Str");
  SearchResults results=twitter.buildSearchResults(response,new ArrayList<Tweet>());
  assertEquals(42,results.getMaxId());
  assertEquals(24,results.getSinceId());
  assertEquals(false,results.isLastPage());
}
Program: 20029
Project: 20029
Buggy source:
static String getRelativePath(final File fromFile,final File toFile){
  final String[] fromSegments=getReversePathSegments(fromFile);
  final String[] toSegments=getReversePathSegments(toFile);
  String relativePath="String_Node_Str";
  int i=fromSegments.length - 1;
  int j=toSegments.length - 1;
  while ((i >= 0) && (j >= 0) && (fromSegments[i].equals(toSegments[j]))) {
    i--;
    j--;
  }
  for (; i >= 0; i--) {
    relativePath+="String_Node_Str" + File.separator;
  }
  for (; j >= 1; j--) {
    relativePath+=toSegments[j] + File.separator;
  }
  relativePath+=toSegments[j];
  return relativePath;
}

Fixed version (ground truth):
static String getRelativePath(final File fromFile,final File toFile){
  final String[] fromSegments=getReversePathSegments(fromFile);
  final String[] toSegments=getReversePathSegments(toFile);
  String relativePath="String_Node_Str";
  int i=fromSegments.length - 1;
  int j=toSegments.length - 1;
  while ((i >= 0) && (j >= 0) && (fromSegments[i].equals(toSegments[j]))) {
    i--;
    j--;
  }
  for (; i >= 0; i--) {
    relativePath+="String_Node_Str" + File.separator;
  }
  for (; j >= 1; j--) {
    relativePath+=toSegments[j] + File.separator;
  }
  relativePath+=toSegments[j];
  return relativePath.replace(File.separator,"String_Node_Str");
}
Program: 20030
Project: 20030
Buggy source:
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
  Player player=event.getPlayer();
  if (Material.LEATHER_BOOTS.equals(Util.getPlayerBoots(player)) && permissions.canUseLeatherBoots(player)) {
    Entity entity=event.getRightClicked();
    if (!(entity instanceof Player) || permissions.canLaunchPlayers(player)) {
      Vector entityVelocity=entity.getVelocity();
      entityVelocity.setY(2);
      entity.setVelocity(entityVelocity);
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
  Player player=event.getPlayer();
  if (Material.LEATHER_BOOTS.equals(Util.getPlayerBoots(player)) && permissions.canUseLeatherBoots(player)) {
    Entity entity=event.getRightClicked();
    if (entity instanceof LivingEntity) {
      if (!(entity instanceof Player) || permissions.canLaunchPlayers(player)) {
        Vector entityVelocity=entity.getVelocity();
        entityVelocity.setY(2);
        entity.setVelocity(entityVelocity);
      }
    }
  }
}
Program: 20032
Project: 20032
Buggy source:
public IOException wrap() throws IOException {
  IOException ex=new IOException(getMessage());
  if (getCause() != null) {
    ex.setStackTrace(ex.getStackTrace());
  }
  throw ex;
}

Fixed version (ground truth):
public IOException wrap() throws IOException {
  IOException ex=new IOException(getMessage());
  ex.setStackTrace(getStackTrace());
  if (getCause() != null) {
    ex.initCause(getCause());
  }
  throw ex;
}
Program: 20033
Project: 20033
Buggy source:
public CouchDBResponse(HttpMethod request,int result,IOException exception) throws IOException {
  this.request=request;
  this.result=result;
  this.exception=exception;
  boolean err=!isHttpOK();
  json=JSONValue.parse(new InputStreamReader(request.getResponseBodyAsStream()));
  if (err) {
    isArray=false;
  }
 else {
    isArray=json instanceof JSONArray;
  }
}

Fixed version (ground truth):
public CouchDBResponse(HttpMethod request,int result,IOException exception) throws IOException {
  this.request=request;
  this.result=result;
  this.exception=exception;
  boolean err=!isHttpOK();
  InputStream response=request.getResponseBodyAsStream();
  if (err) {
    if (exception != null) {
      throw new IOException("String_Node_Str",exception);
    }
    if (response == null) {
      throw new IOException("String_Node_Str" + result);
    }
  }
  json=JSONValue.parse(new InputStreamReader(request.getResponseBodyAsStream()));
  if (err) {
    isArray=false;
  }
 else {
    isArray=json instanceof JSONArray;
  }
}
Program: 20034
Project: 20034
Buggy source:
@Test public void testFeatureWriterAdd() throws Exception {
  db.postBulk(loadJSON("String_Node_Str","String_Node_Str"));
  JSONArray data=loadJSON("String_Node_Str","String_Node_Str");
  JSONObject italy=(JSONObject)data.get(0);
  FeatureJSON json=new FeatureJSON();
  json.setFeatureType(CouchDBUtils.createFeatureType(italy,"String_Node_Str"));
  Feature feature=json.readFeature(italy.toString());
  ContentFeatureStore featureStore=(ContentFeatureStore)store.getFeatureSource("String_Node_Str");
  featureStore.addFeatures(Collections.singleton(feature));
  ContentFeatureCollection features=featureStore.getFeatures();
  assertEquals(2,features.size());
}

Fixed version (ground truth):
@Test public void testFeatureWriterAdd() throws Exception {
  db.postBulk(loadJSON("String_Node_Str","String_Node_Str"));
  JSONArray data=loadJSON("String_Node_Str","String_Node_Str");
  JSONObject italy=(JSONObject)data.get(0);
  FeatureJSON json=new FeatureJSON();
  json.setFeatureType(CouchDBUtils.createFeatureType(italy,"String_Node_Str"));
  Feature feature=json.readFeature(italy.toString());
  ContentFeatureStore featureStore=(ContentFeatureStore)store.getFeatureSource("String_Node_Str");
  featureStore.addFeatures(Collections.singleton(feature));
  ContentFeatureCollection features=featureStore.getFeatures();
  assertEquals(2,features.size());
  featureStore.addFeatures(Arrays.asList(feature,feature));
  assertEquals(4,features.size());
}
Program: 20035
Project: 20035
Buggy source:
public static byte[][] getByteMap(File f) throws Exception {
  byte[] contents=new byte[(int)f.length()];
  FileInputStream in=new FileInputStream(f);
  in.read(contents);
  in.close();
  int width=getIntVal(0x12,contents);
  int pad=(width + 3 & -4) - width;
  int length=getIntVal(0x16,contents);
  byte[][] mapBytes=new byte[length][width];
  int pos=1078;
  for (int i=length - 1; i >= 0; i--) {
    for (int i2=0; i2 < mapBytes[i].length; i2++)     mapBytes[i][i2]=contents[pos++];
    pos+=pad;
  }
  return mapBytes;
}

Fixed version (ground truth):
public static byte[][] getByteMap(File f){
  byte[] contents=new byte[(int)f.length()];
  FileInputStream in=null;
  try {
    in=new FileInputStream(f);
    in.read(contents);
    in.close();
  }
 catch (  Exception e) {
  }
  int width=getIntVal(0x12,contents);
  int pad=(width + 3 & -4) - width;
  int length=getIntVal(0x16,contents);
  byte[][] mapBytes=new byte[length][width];
  int pos=1078;
  for (int i=length - 1; i >= 0; i--) {
    for (int i2=0; i2 < mapBytes[i].length; i2++)     mapBytes[i][i2]=contents[pos++];
    pos+=pad;
  }
  return mapBytes;
}
Program: 20036
Project: 20036
Buggy source:
public static byte[][] getByteMap(File f) throws Exception {
  byte[] contents=new byte[(int)f.length()];
  FileInputStream in=new FileInputStream(f);
  in.read(contents);
  in.close();
  int width=getIntVal(0x12,contents);
  int pad=(width + 3 & -4) - width;
  int length=getIntVal(0x16,contents);
  byte[][] mapBytes=new byte[length][width];
  int pos=1078;
  for (int i=length - 1; i >= 0; i--) {
    for (int i2=0; i2 < mapBytes[i].length; i2++)     mapBytes[i][i2]=contents[pos++];
    pos+=pad;
  }
  return mapBytes;
}

Fixed version (ground truth):
public static byte[][] getByteMap(File f){
  byte[] contents=new byte[(int)f.length()];
  FileInputStream in=null;
  try {
    in=new FileInputStream(f);
    in.read(contents);
    in.close();
  }
 catch (  Exception e) {
  }
  int width=getIntVal(0x12,contents);
  int pad=(width + 3 & -4) - width;
  int length=getIntVal(0x16,contents);
  byte[][] mapBytes=new byte[length][width];
  int pos=1078;
  for (int i=length - 1; i >= 0; i--) {
    for (int i2=0; i2 < mapBytes[i].length; i2++)     mapBytes[i][i2]=contents[pos++];
    pos+=pad;
  }
  return mapBytes;
}
Program: 20037
Project: 20037
Buggy source:
public Map(String url){
  File map_file=new File(url);
  map_name=map_file.getName();
  byte[][] map_raw=FileParser.getByteMap(map_file);
  height=map_raw.length;
  width=map_raw[0].length;
  map=new Square[y][x];
  obstacles=new ArrayList<Obstacle>();
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   map[y][x]=new Square(map_raw[y][x]);
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   if (map_raw[y][x] == OBSTACLE && map[y][x].obstacle == NULL)   map[y][x].obstacle=new Obstacle(map_raw,map,x,y);
  obstacles.add(map[y][x].obstacle);
}

Fixed version (ground truth):
public Map(String url){
  File map_file=new File(url);
  map_name=map_file.getName();
  byte[][] map_raw=FileParser.getByteMap(map_file);
  height=map_raw.length;
  width=map_raw[0].length;
  map=new Square[height][width];
  obstacles=new ArrayList<Obstacle>();
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   map[y][x]=new Square(map_raw[y][x],x,y);
  for (int y=0; y < height; y++) {
    for (int x=0; x < width; x++) {
      if (map_raw[y][x] == OBSTACLE && map[y][x].nullObstacle()) {
        map[y][x].setObstacle(new Obstacle(map_raw,map,x,y));
        obstacles.add(map[y][x].getObstacle());
      }
    }
  }
}
Program: 20038
Project: 20038
Buggy source:
public Map(String url){
  File map_file=new File(url);
  map_name=map_file.getName();
  byte[][] map_raw=FileParser.getByteMap(map_file);
  height=map_raw.length;
  width=map_raw[0].length;
  map=new Square[y][x];
  obstacles=new ArrayList<Obstacle>();
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   map[y][x]=new Square(map_raw[y][x]);
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   if (map_raw[y][x] == OBSTACLE && map[y][x].obstacle == NULL)   map[y][x].obstacle=new Obstacle(map_raw,map,x,y);
  obstacles.add(map[y][x].obstacle);
}

Fixed version (ground truth):
public Map(String url){
  File map_file=new File(url);
  map_name=map_file.getName();
  byte[][] map_raw=FileParser.getByteMap(map_file);
  height=map_raw.length;
  width=map_raw[0].length;
  map=new Square[height][width];
  obstacles=new ArrayList<Obstacle>();
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   map[y][x]=new Square(map_raw[y][x],x,y);
  for (int y=0; y < height; y++) {
    for (int x=0; x < width; x++) {
      if (map_raw[y][x] == OBSTACLE && map[y][x].nullObstacle()) {
        map[y][x].setObstacle(new Obstacle(map_raw,map,x,y));
        obstacles.add(map[y][x].getObstacle());
      }
    }
  }
}
Program: 20039
Project: 20039
Buggy source:
public Obstacle(byte[][] map_raw,Square[][] map,int x,int y){
  squares=new ArrayList<Square>();
  corners=new ArrayList<Points>();
  grow(map_raw,map,x,y);
}

Fixed version (ground truth):
public Obstacle(byte[][] map_raw,Square[][] map,int x,int y){
  squares=new ArrayList<Square>();
  corners=new ArrayList<Point>();
  grow(map_raw,map,x,y);
}
Program: 20040
Project: 20040
Buggy source:
public void grow(byte[][] map_raw,Square[][] map,int x,int y){
  squares.add(map[y][x]);
  map[y][x].addObstacle(this);
  int w=map[0].length;
  int h=map.length;
  int nw, wn, ne, en, se, es, sw, ws;
  if (isEmpty(x - 1,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
  }
  if (isEmpty(x,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y - 1,w,h,map_raw,map)) {
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y,w,h,map_raw,map)) {
    sw++;
    ws++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y,w,h,map_raw,map)) {
    se++;
    es++;
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y + 1,w,h,map_raw,map)) {
    sw++;
    ws++;
  }
  if (isEmpty(x,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
    sw++;
    ws++;
  }
  if (isEmpty(x + 1,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
  }
  if (nw == 4 || wn == 4)   corners.add(new Point(x - 0.5,y - 0.5));
  if (ne == 4 || en == 4)   corners.add(new Point(x + 0.5,y - 0.5));
  if (sw == 4 || ws == 4)   corners.add(new Point(x - 0.5,y + 0.5));
  if (se == 4 || es == 4)   corners.add(new Point(x + 0.5,y + 0.5));
}

Fixed version (ground truth):
public void grow(byte[][] map_raw,Square[][] map,int x,int y){
  squares.add(map[y][x]);
  map[y][x].setObstacle(this);
  int w=map[0].length;
  int h=map.length;
  int nw=0, wn=0, ne=0, en=0, se=0, es=0, sw=0, ws=0;
  if (isEmpty(x - 1,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
  }
  if (isEmpty(x,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y - 1,w,h,map_raw,map)) {
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y,w,h,map_raw,map)) {
    sw++;
    ws++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y,w,h,map_raw,map)) {
    se++;
    es++;
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y + 1,w,h,map_raw,map)) {
    sw++;
    ws++;
  }
  if (isEmpty(x,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
    sw++;
    ws++;
  }
  if (isEmpty(x + 1,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
  }
  if (nw == 4 || wn == 4)   corners.add(new Point(x - 0.5,y - 0.5));
  if (ne == 4 || en == 4)   corners.add(new Point(x + 1.5,y - 0.5));
  if (sw == 4 || ws == 4)   corners.add(new Point(x - 0.5,y + 1.5));
  if (se == 4 || es == 4)   corners.add(new Point(x + 1.5,y + 1.5));
}
Program: 20041
Project: 20041
Buggy source:
private boolean isEmpty(int x,int y,int w,int h,byte[][] m,Square[][] m2){
}

Fixed version (ground truth):
private boolean isEmpty(int x,int y,int w,int h,byte[][] m,Square[][] m2){
  if (x < 0 || y < 0 || x >= w || y >= h)   return false;
  if (m[y][x] == OBSTACLE && m2[y][x].nullObstacle()) {
    grow(m,m2,x,y);
    return false;
  }
  return true;
}
Program: 20042
Project: 20042
Buggy source:
public Obstacle(byte[][] map_raw,Square[][] map,int x,int y){
  squares=new ArrayList<Square>();
  corners=new ArrayList<Points>();
  grow(map_raw,map,x,y);
}

Fixed version (ground truth):
public Obstacle(byte[][] map_raw,Square[][] map,int x,int y){
  squares=new ArrayList<Square>();
  corners=new ArrayList<Point>();
  grow(map_raw,map,x,y);
}
Program: 20043
Project: 20043
Buggy source:
public void grow(byte[][] map_raw,Square[][] map,int x,int y){
  squares.add(map[y][x]);
  map[y][x].addObstacle(this);
  int w=map[0].length;
  int h=map.length;
  int nw, wn, ne, en, se, es, sw, ws;
  if (isEmpty(x - 1,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
  }
  if (isEmpty(x,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y - 1,w,h,map_raw,map)) {
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y,w,h,map_raw,map)) {
    sw++;
    ws++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y,w,h,map_raw,map)) {
    se++;
    es++;
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y + 1,w,h,map_raw,map)) {
    sw++;
    ws++;
  }
  if (isEmpty(x,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
    sw++;
    ws++;
  }
  if (isEmpty(x + 1,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
  }
  if (nw == 4 || wn == 4)   corners.add(new Point(x - 0.5,y - 0.5));
  if (ne == 4 || en == 4)   corners.add(new Point(x + 0.5,y - 0.5));
  if (sw == 4 || ws == 4)   corners.add(new Point(x - 0.5,y + 0.5));
  if (se == 4 || es == 4)   corners.add(new Point(x + 0.5,y + 0.5));
}

Fixed version (ground truth):
public void grow(byte[][] map_raw,Square[][] map,int x,int y){
  squares.add(map[y][x]);
  map[y][x].setObstacle(this);
  int w=map[0].length;
  int h=map.length;
  int nw=0, wn=0, ne=0, en=0, se=0, es=0, sw=0, ws=0;
  if (isEmpty(x - 1,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
  }
  if (isEmpty(x,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y - 1,w,h,map_raw,map)) {
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y,w,h,map_raw,map)) {
    sw++;
    ws++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y,w,h,map_raw,map)) {
    se++;
    es++;
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y + 1,w,h,map_raw,map)) {
    sw++;
    ws++;
  }
  if (isEmpty(x,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
    sw++;
    ws++;
  }
  if (isEmpty(x + 1,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
  }
  if (nw == 4 || wn == 4)   corners.add(new Point(x - 0.5,y - 0.5));
  if (ne == 4 || en == 4)   corners.add(new Point(x + 1.5,y - 0.5));
  if (sw == 4 || ws == 4)   corners.add(new Point(x - 0.5,y + 1.5));
  if (se == 4 || es == 4)   corners.add(new Point(x + 1.5,y + 1.5));
}
Program: 20044
Project: 20044
Buggy source:
private boolean isEmpty(int x,int y,int w,int h,byte[][] m,Square[][] m2){
}

Fixed version (ground truth):
private boolean isEmpty(int x,int y,int w,int h,byte[][] m,Square[][] m2){
  if (x < 0 || y < 0 || x >= w || y >= h)   return false;
  if (m[y][x] == OBSTACLE && m2[y][x].nullObstacle()) {
    grow(m,m2,x,y);
    return false;
  }
  return true;
}
Program: 20045
Project: 20045
Buggy source:
public Point(float x,float y){
  this.x=x;
  this.y=y;
}

Fixed version (ground truth):
public Point(double x,double y){
  this.x=x;
  this.y=y;
}
Program: 20046
Project: 20046
Buggy source:
public void grow(byte[][] map_raw,Square[][] map,int x,int y){
  squares.add(map[y][x]);
  map[y][x].setObstacle(this);
  int w=map[0].length;
  int h=map.length;
  int nw=0, wn=0, ne=0, en=0, se=0, es=0, sw=0, ws=0;
  if (isEmpty(x - 1,y - 1,w,h,map_raw,map)) {
    nw++;
    ne++;
    wn++;
    ws++;
  }
  if (isEmpty(x,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y - 1,w,h,map_raw,map)) {
    ne++;
    nw++;
    en++;
    es++;
  }
  if (isEmpty(x - 1,y,w,h,map_raw,map)) {
    sw++;
    ws++;
    nw++;
    wn++;
  }
  if (isEmpty(x + 1,y,w,h,map_raw,map)) {
    se++;
    es++;
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y + 1,w,h,map_raw,map)) {
    sw++;
    se++;
    ws++;
    wn++;
  }
  if (isEmpty(x,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
    sw++;
    ws++;
  }
  if (isEmpty(x + 1,y + 1,w,h,map_raw,map)) {
    se++;
    sw++;
    es++;
    en++;
  }
  if ((nw == 4 || wn == 4) && notHasCorner(x - 0.5,y - 0.5))   corners.add(new Point(x - 0.5,y - 0.5));
  if ((ne == 4 || en == 4) && notHasCorner(x - 0.5,y - 0.5))   corners.add(new Point(x + 1.5,y - 0.5));
  if ((sw == 4 || ws == 4) && notHasCorner(x - 0.5,y - 0.5))   corners.add(new Point(x - 0.5,y + 1.5));
  if ((se == 4 || es == 4) && notHasCorner(x - 0.5,y - 0.5))   corners.add(new Point(x + 1.5,y + 1.5));
}

Fixed version (ground truth):
public void grow(byte[][] map_raw,Square[][] map,int x,int y){
  squares.add(map[y][x]);
  map[y][x].setObstacle(this);
  int w=map[0].length;
  int h=map.length;
  int nw=0, wn=0, ne=0, en=0, se=0, es=0, sw=0, ws=0;
  if (isEmpty(x - 1,y - 1,w,h,map_raw,map)) {
    nw++;
    ne++;
    wn++;
    ws++;
  }
  if (isEmpty(x,y - 1,w,h,map_raw,map)) {
    nw++;
    wn++;
    ne++;
    en++;
  }
  if (isEmpty(x + 1,y - 1,w,h,map_raw,map)) {
    ne++;
    nw++;
    en++;
    es++;
  }
  if (isEmpty(x - 1,y,w,h,map_raw,map)) {
    sw++;
    ws++;
    nw++;
    wn++;
  }
  if (isEmpty(x + 1,y,w,h,map_raw,map)) {
    se++;
    es++;
    ne++;
    en++;
  }
  if (isEmpty(x - 1,y + 1,w,h,map_raw,map)) {
    sw++;
    se++;
    ws++;
    wn++;
  }
  if (isEmpty(x,y + 1,w,h,map_raw,map)) {
    se++;
    es++;
    sw++;
    ws++;
  }
  if (isEmpty(x + 1,y + 1,w,h,map_raw,map)) {
    se++;
    sw++;
    es++;
    en++;
  }
  if ((nw == 4 || wn == 4) && notHasCorner((int)(x - 0.5),(int)(y - 0.5)))   corners.add(new Point(x - 0.5,y - 0.5));
  if ((ne == 4 || en == 4) && notHasCorner((int)(x + 1.5),(int)(y - 0.5)))   corners.add(new Point(x + 1.5,y - 0.5));
  if ((sw == 4 || ws == 4) && notHasCorner((int)(x - 0.5),(int)(y + 1.5)))   corners.add(new Point(x - 0.5,y + 1.5));
  if ((se == 4 || es == 4) && notHasCorner((int)(x + 1.5),(int)(y + 1.5)))   corners.add(new Point(x + 1.5,y + 1.5));
}
Program: 20047
Project: 20047
Buggy source:
public boolean notHasCorner(int x,int y){
  for (  Point p : points)   if ((int)p.x == x && (int)p.y == y)   return false;
  return true;
}

Fixed version (ground truth):
public boolean notHasCorner(int x,int y){
  for (  Point p : corners)   if ((int)p.x == x && (int)p.y == y)   return false;
  return true;
}
Program: 20048
Project: 20048
Buggy source:
Element matrixToMathml(TokenInput slf,String openDelim,String closeDelim,boolean stretchy,String align){
  skipOuOptional(slf);
  Element mtable=matrixToMtable(slf,resultElement("String_Node_Str",0),align);
  if (openDelim != null || closeDelim != null) {
    Element mrow=resultElement("String_Node_Str",0);
    if (openDelim != null) {
      if (stretchy) {
        resultElementAppend(mrow,resultElement("String_Node_Str",1,"String_Node_Str","String_Node_Str",openDelim));
      }
 else {
        resultElementAppend(mrow,resultElement("String_Node_Str",0,openDelim));
      }
    }
    resultElementAppend(mrow,mtable);
    if (closeDelim != null) {
      if (stretchy) {
        resultElementAppend(mrow,resultElement("String_Node_Str",1,"String_Node_Str","String_Node_Str",closeDelim));
      }
 else {
        resultElementAppend(mrow,resultElement("String_Node_Str",0,closeDelim));
      }
    }
    return mrow;
  }
 else {
    return mtable;
  }
}

Fixed version (ground truth):
Element matrixToMathml(TokenInput slf,String openDelim,String closeDelim,boolean stretchy,String align){
  Element mtable=matrixToMtable(slf,resultElement("String_Node_Str",0),align);
  if (openDelim != null || closeDelim != null) {
    Element mrow=resultElement("String_Node_Str",0);
    if (openDelim != null) {
      if (stretchy) {
        resultElementAppend(mrow,resultElement("String_Node_Str",1,"String_Node_Str","String_Node_Str",openDelim));
      }
 else {
        resultElementAppend(mrow,resultElement("String_Node_Str",0,openDelim));
      }
    }
    resultElementAppend(mrow,mtable);
    if (closeDelim != null) {
      if (stretchy) {
        resultElementAppend(mrow,resultElement("String_Node_Str",1,"String_Node_Str","String_Node_Str",closeDelim));
      }
 else {
        resultElementAppend(mrow,resultElement("String_Node_Str",0,closeDelim));
      }
    }
    return mrow;
  }
 else {
    return mtable;
  }
}
Program: 20049
Project: 20049
Buggy source:
Element underToMathml(TokenInput slf,String chr){
  return resultElement("String_Node_Str",0,pieceToMathml(slf),resultElement("String_Node_Str",0,chr));
}

Fixed version (ground truth):
Element underToMathml(TokenInput slf,String chr,boolean resetSize){
  Element content=pieceToMathml(slf);
  if (resetSize) {
    content=resultElement("String_Node_Str",2,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",content);
  }
  return resultElement("String_Node_Str",0,content,resultElement("String_Node_Str",0,chr));
}
Program: 20050
Project: 20050
Buggy source:
Element overToMathml(TokenInput slf,String chr){
  return resultElement("String_Node_Str",0,pieceToMathml(slf),resultElement("String_Node_Str",0,chr));
}

Fixed version (ground truth):
Element overToMathml(TokenInput slf,String chr,boolean resetSize){
  Element content=pieceToMathml(slf);
  if (resetSize) {
    content=resultElement("String_Node_Str",2,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",content);
  }
  return resultElement("String_Node_Str",0,content,resultElement("String_Node_Str",0,chr));
}
Program: 20051
Project: 20051
Buggy source:
private void display(Node node) throws Exception {
  DOMSource in=new DOMSource(node);
  System.out.println();
  TransformerFactory.newInstance().newTransformer().transform(in,new StreamResult(System.out));
  System.out.println();
}

Fixed version (ground truth):
@SuppressWarnings(value="String_Node_Str") private void display(Node node) throws Exception {
  DOMSource in=new DOMSource(node);
  System.out.println();
  TransformerFactory.newInstance().newTransformer().transform(in,new StreamResult(System.out));
  System.out.println();
}
Program: 20052
Project: 20052
Buggy source:
private Element charEscapeToMathml(TokenInput slf){
  String token=slf.nextToken();
  if (CHAR_ESCAPE_CODES.containsKey(token)) {
    return resultElement("String_Node_Str",0,CHAR_ESCAPE_CODES.get(token));
  }
 else {
    return resultElement("String_Node_Str",0,"String_Node_Str",token);
  }
}

Fixed version (ground truth):
private Element charEscapeToMathml(TokenInput slf){
  StringBuilder digits=new StringBuilder();
  int count;
  for (count=0; true; count++) {
    String digit=slf.peekToken(count);
    if (digit == null || !digit.matches("String_Node_Str")) {
      break;
    }
    digits.append(digit);
  }
  for (int i=0; i < count; i++) {
    slf.nextToken();
  }
  String digitString=digits.toString();
  if (CHAR_ESCAPE_CODES.containsKey(digitString)) {
    return resultElement("String_Node_Str",0,CHAR_ESCAPE_CODES.get(digitString));
  }
 else {
    return resultElement("String_Node_Str",0,"String_Node_Str",digitString);
  }
}
Program: 20053
Project: 20053
Buggy source:
/** 
 * Loads all the sample equations and tests them. This test is basically a 'does it crash' kind of test - we don't examine the results.
 */
@Test public void testSampleLibrary() throws Exception {
  BufferedReader reader=new BufferedReader(new InputStreamReader(TestLatexToMathml.class.getResourceAsStream("String_Node_Str"),"String_Node_Str"));
  int errors=0;
  while (true) {
    String line=reader.readLine();
    if (line == null) {
      break;
    }
    Matcher m=SAMPLES_REGEX.matcher(line);
    if (!m.matches()) {
      throw new IOException("String_Node_Str" + line);
    }
    String tex=m.group(2);
    String result=new TokenInput(tex).toMathml();
    if (result.contains("String_Node_Str")) {
      System.err.println(tex);
      errors++;
    }
  }
  assertEquals(0,errors);
}

Fixed version (ground truth):
/** 
 * Loads all the sample equations and tests them. This test is basically a 'does it crash' kind of test - we don't examine the results.
 */
@Test public void testSampleLibrary() throws Exception {
  BufferedReader reader=new BufferedReader(new InputStreamReader(TestLatexToMathml.class.getResourceAsStream("String_Node_Str"),"String_Node_Str"));
  int errors=0;
  while (true) {
    String line=reader.readLine();
    if (line == null) {
      break;
    }
    if (line.equals("String_Node_Str") || line.startsWith("String_Node_Str")) {
      continue;
    }
    Matcher m=SAMPLES_REGEX.matcher(line);
    if (!m.matches()) {
      throw new IOException("String_Node_Str" + line);
    }
    String tex=m.group(2);
    String result=new TokenInput(tex).toMathml();
    if (result.contains("String_Node_Str")) {
      System.err.println(tex);
      errors++;
    }
  }
  assertEquals(0,errors);
}
Program: 20056
Project: 20056
Buggy source:
private Integer addNeighboring(Block block,String ownerName){
  Integer additionalItemsLocked=0;
  for (  Block currentNeighbour : this.getNeighbours(block)) {
    if (currentNeighbour.getType().equals(block.getType())) {
      if (list.containsKey(currentNeighbour.getLocation())) {
        plugin.babble("String_Node_Str" + currentNeighbour.getType().toString().toLowerCase() + "String_Node_Str");
      }
 else {
        plugin.babble("String_Node_Str" + currentNeighbour.getType().toString().toLowerCase() + "String_Node_Str"+ currentNeighbour.getLocation().toString());
        SCLItem newItem=new SCLItem(ownerName,currentNeighbour);
        newItem.setTrusted(plugin.trustHandler.getTrustees(ownerName));
        list.put(currentNeighbour.getLocation(),newItem);
        additionalItemsLocked++;
      }
    }
 else {
      plugin.babble("String_Node_Str" + currentNeighbour.getType().toString().toLowerCase() + "String_Node_Str"+ block.getType().toString().toLowerCase());
    }
  }
  return additionalItemsLocked;
}

Fixed version (ground truth):
private Integer addNeighboring(Block block,String ownerName){
  Integer additionalItemsLocked=0;
  for (  Block currentNeighbour : this.getNeighbours(block)) {
    if (currentNeighbour.getType().equals(block.getType())) {
      if (list.containsKey(currentNeighbour.getLocation())) {
        plugin.babble("String_Node_Str" + currentNeighbour.getType().toString().toLowerCase() + "String_Node_Str");
      }
 else {
        plugin.babble("String_Node_Str" + currentNeighbour.getType().toString().toLowerCase() + "String_Node_Str"+ currentNeighbour.getLocation().toString());
        SCLItem newItem=new SCLItem(ownerName,currentNeighbour);
        newItem.setTrusted(plugin.trustHandler.getTrusteesCopy(ownerName));
        list.put(currentNeighbour.getLocation(),newItem);
        additionalItemsLocked++;
      }
    }
 else {
      plugin.babble("String_Node_Str" + currentNeighbour.getType().toString().toLowerCase() + "String_Node_Str"+ block.getType().toString().toLowerCase());
    }
  }
  return additionalItemsLocked;
}
Program: 20057
Project: 20057
Buggy source:
public Integer lock(Player player,Block block,DyeColor[] combo){
  if (player == null || block == null || list == null || combo.length != 3)   return 0;
  if (plugin.canLock(block)) {
    int lockedItems=0;
    String lockAs=player.getName();
    if (plugin.locksAs.containsKey(lockAs)) {
      lockAs=plugin.locksAs.get(lockAs);
    }
    if (plugin.lockpair && plugin.canDoubleLock(block)) {
      lockedItems=this.addNeighboring(block,lockAs,combo);
    }
 else {
      SCLItem newItem=new SCLItem(lockAs,block,combo);
      newItem.setTrusted(plugin.trustHandler.getTrustees(lockAs));
      list.put(block.getLocation(),newItem);
      lockedItems=1;
    }
    return lockedItems;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public Integer lock(Player player,Block block,DyeColor[] combo){
  if (player == null || block == null || list == null || combo.length != 3)   return 0;
  if (plugin.canLock(block)) {
    int lockedItems=0;
    String lockAs=player.getName();
    if (plugin.locksAs.containsKey(lockAs)) {
      lockAs=plugin.locksAs.get(lockAs);
    }
    if (plugin.lockpair && plugin.canDoubleLock(block)) {
      lockedItems=this.addNeighboring(block,lockAs,combo);
    }
 else {
      SCLItem newItem=new SCLItem(lockAs,block,combo);
      newItem.setTrusted(plugin.trustHandler.getTrusteesCopy(lockAs));
      list.put(block.getLocation(),newItem);
      lockedItems=1;
    }
    return lockedItems;
  }
 else {
    return 0;
  }
}
Program: 20058
Project: 20058
Buggy source:
public HashSet<String> getTrusteesCopy(String playerName){
  HashSet<String> original=trust.get(playerName.toLowerCase());
  HashSet<String> safeCopy=new HashSet<String>();
  for (  String trusted : original) {
    safeCopy.add(trusted);
  }
  return safeCopy;
}

Fixed version (ground truth):
public HashSet<String> getTrusteesCopy(String playerName){
  HashSet<String> original=trust.get(playerName.toLowerCase());
  HashSet<String> safeCopy=new HashSet<String>();
  if (original == null) {
    return safeCopy;
  }
  for (  String trusted : original) {
    safeCopy.add(trusted);
  }
  return safeCopy;
}
Program: 20061
Project: 20061
Buggy source:
/** 
 * Finds a file by name in classpath
 * @param fileName
 * @return
 */
private static InputStream findFileInClasspath(String fileName){
  InputStream is=null;
  try {
    ClassLoader classLoader=ConfigLoader.class.getClassLoader();
    is=classLoader.getResourceAsStream(fileName);
    return is == null ? null : is;
  }
 catch (  Exception ex) {
    log.error(String.format("String_Node_Str",fileName),ex);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Finds a file by name in classpath
 * @param fileName
 * @return
 */
private static InputStream findFileInClasspath(String fileName){
  InputStream is=null;
  try {
    ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
    is=classLoader.getResourceAsStream(fileName);
    return is;
  }
 catch (  Exception ex) {
    log.error(String.format("String_Node_Str",fileName),ex);
    return null;
  }
}
Program: 20063
Project: 20063
Buggy source:
@Test public void getList() throws Exception {
  logTestName(logger);
  Client client=createAuthenticatedHTTPClient();
  WebResource discoveryRequest=client.resource(discoveryApiUrl).path(InformationService.DOCTYPE);
  SoaNodeInformation[] soaNodes=discoveryRequest.get(SoaNodeInformation[].class);
  Assert.assertEquals("String_Node_Str",SERVICE_COUNT,soaNodes.length);
  SoaNodeId firstSoaNodeId=soaNodes[0].getSoaNodeId();
  Assert.assertEquals("String_Node_Str",InformationService.DOCTYPE,firstSoaNodeId.getType());
  Assert.assertEquals("String_Node_Str","String_Node_Str",firstSoaNodeId.getName());
}

Fixed version (ground truth):
@Test public void getList() throws Exception {
  logTestName(logger);
  Client client=createAuthenticatedHTTPClient();
  WebResource discoveryRequest=client.resource(discoveryApiUrl).path(InformationService.DOCTYPE);
  SoaNodeInformations soaNodes=discoveryRequest.get(SoaNodeInformations.class);
  Assert.assertEquals("String_Node_Str",SERVICE_COUNT,soaNodes.getSoaNodeInformationList().size());
  SoaNodeId firstSoaNodeId=soaNodes.getSoaNodeInformationList().get(0).getSoaNodeId();
  Assert.assertEquals("String_Node_Str",InformationService.DOCTYPE,firstSoaNodeId.getType());
  Assert.assertEquals("String_Node_Str","String_Node_Str",firstSoaNodeId.getName());
}
Program: 20064
Project: 20064
Buggy source:
@Test public void query() throws Exception {
  logTestName(logger);
  EndpointId endpointToQuery=new EndpointId("String_Node_Str","String_Node_Str");
  documentService.create(documentManager,endpointToQuery);
  Client client=createAuthenticatedHTTPClient();
  Builder discoveryRequest=client.resource(discoveryApiUrl).path("String_Node_Str").type(MediaType.TEXT_PLAIN);
  SoaNodeInformation[] foundEndpoints=discoveryRequest.post(SoaNodeInformation[].class,"String_Node_Str" + Endpoint.XPATH_URL + "String_Node_Str");
  Assert.assertEquals(1,foundEndpoints.length);
  Assert.assertEquals(endpointToQuery.getEnvironment(),foundEndpoints[0].getProperties().get(Endpoint.XPATH_ENDP_ENVIRONMENT));
}

Fixed version (ground truth):
@Test public void query() throws Exception {
  logTestName(logger);
  EndpointId endpointToQuery=new EndpointId("String_Node_Str","String_Node_Str");
  documentService.create(documentManager,endpointToQuery);
  Client client=createAuthenticatedHTTPClient();
  Builder discoveryRequest=client.resource(discoveryApiUrl).path("String_Node_Str").type(MediaType.TEXT_PLAIN);
  SoaNodeInformations foundEndpoints=discoveryRequest.post(SoaNodeInformations.class,"String_Node_Str" + Endpoint.XPATH_URL + "String_Node_Str");
  Assert.assertEquals(1,foundEndpoints.getSoaNodeInformationList().size());
  Assert.assertEquals(endpointToQuery.getEnvironment(),foundEndpoints.getSoaNodeInformationList().get(0).getProperties().get(Endpoint.XPATH_ENDP_ENVIRONMENT));
}