nus-yam/ex-repair huggingface dataset:
Program: 45323
Project: 45323
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.game);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.personal);
}
Program: 45326
Project: 45326
Buggy source:
@Override public void handleImageLoaded(final ViewSwitcher vs,final ImageView iv,final Drawable draw){
  mHandler.post(new Runnable(){
    public void run(){
      iv.setImageDrawable(draw);
      vs.setDisplayedChild(1);
    }
  }
);
}

Fixed version (ground truth):
@Override public void handleImageLoaded(final ViewSwitcher vs,final ImageView iv,final Bitmap draw){
  mHandler.post(new Runnable(){
    public void run(){
      Bitmap resizedBitmap=Bitmap.createScaledBitmap(draw,85,85,true);
      draw.recycle();
      iv.setImageBitmap(resizedBitmap);
      vs.setDisplayedChild(1);
    }
  }
);
}
Program: 45327
Project: 45327
Buggy source:
public void run(){
  iv.setImageDrawable(draw);
  vs.setDisplayedChild(1);
}

Fixed version (ground truth):
public void run(){
  Bitmap resizedBitmap=Bitmap.createScaledBitmap(draw,85,85,true);
  draw.recycle();
  iv.setImageBitmap(resizedBitmap);
  vs.setDisplayedChild(1);
}
Program: 45328
Project: 45328
Buggy source:
public int getCount(){
  return mUrls.length;
}

Fixed version (ground truth):
public int getCount(){
  return mUrls.length - 1;
}
Program: 45329
Project: 45329
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.game);
  choices[0]=(Button)findViewById(R.id.Button0);
  choices[1]=(Button)findViewById(R.id.Button1);
  choices[2]=(Button)findViewById(R.id.Button2);
  choices[3]=(Button)findViewById(R.id.Button3);
  tableLayout=(TableLayout)findViewById(R.id.buttonLayout);
  popup=(Button)findViewById(R.id.Popup);
  vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  timerHandler=new Handler();
  timerUpdateRunnable=new Runnable(){
    public void run(){
      long secLeft=((timerEndTime - System.currentTimeMillis()) / 1000);
      timerText.setText("String_Node_Str" + secLeft);
      if (secLeft < 10) {
        vibrator.vibrate(200 * (10 - secLeft) / 10);
      }
      if (secLeft > 0)       timerHandler.postAtTime(this,SystemClock.uptimeMillis() + 200);
 else       gameOver();
    }
  }
;
  initializeGame();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.game);
  choices[0]=(Button)findViewById(R.id.Button0);
  choices[1]=(Button)findViewById(R.id.Button1);
  choices[2]=(Button)findViewById(R.id.Button2);
  choices[3]=(Button)findViewById(R.id.Button3);
  tableLayout=(TableLayout)findViewById(R.id.buttonLayout);
  title=(TextView)findViewById(R.id.Title);
  popup=(Button)findViewById(R.id.Popup);
  vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  timerText=(TextView)findViewById(R.id.Timer);
  cardsText=(TextView)findViewById(R.id.CardsLeft);
  timerHandler=new Handler();
  timerUpdateRunnable=new Runnable(){
    public void run(){
      long secLeft=((timerEndTime - System.currentTimeMillis()) / 1000);
      timerText.setText("String_Node_Str" + secLeft);
      if (secLeft < 10) {
        vibrator.vibrate(200 * (10 - secLeft) / 10);
      }
      if (secLeft > 0)       timerHandler.postAtTime(this,SystemClock.uptimeMillis() + 200);
 else       gameOver();
    }
  }
;
  initializeGame();
}
Program: 45331
Project: 45331
Buggy source:
@Override public void handleMessage(Message msg){
  CharSequence text="String_Node_Str";
  Toast toast=Toast.makeText(getApplicationContext(),text,Toast.LENGTH_SHORT);
  toast.show();
  if (dialog) {
    dialog=false;
    mDialog.dismiss();
  }
  tookPic=false;
  iv_Image.setImageDrawable(null);
  tv_Translation.setText("String_Node_Str");
  if (resizedBitmap != null)   resizedBitmap.recycle();
  iv_Image.setVisibility(View.INVISIBLE);
  b_AddCard.setVisibility(View.INVISIBLE);
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  CharSequence text="String_Node_Str";
  Toast toast=Toast.makeText(getApplicationContext(),text,Toast.LENGTH_SHORT);
  toast.show();
  if (dialog) {
    dialog=false;
    mDialog.dismiss();
  }
  tookPic=false;
  iv_Image.setImageDrawable(null);
  tv_Translation.setText("String_Node_Str");
  if (resizedBitmap != null)   resizedBitmap.recycle();
  iv_Image.setVisibility(View.INVISIBLE);
  b_AddCard.setVisibility(View.INVISIBLE);
  addingCard=false;
}
Program: 45333
Project: 45333
Buggy source:
@Override public void handleMessage(Message msg){
  Bundle bundle=msg.getData();
  final int numOfCards=bundle.getInt("String_Node_Str");
  final String[] listOfWords=bundle.getStringArray("String_Node_Str");
  final String[] listOfForeign=bundle.getStringArray("String_Node_Str");
  final String[] listOfImageUrls=bundle.getStringArray("String_Node_Str");
  final GridView gridview=(GridView)findViewById(R.id.currentCards);
  ThumbnailAdapter gridAdapter=new ThumbnailAdapter(Startup.this.getApplicationContext(),listOfImageUrls,listOfWords,listOfForeign,numOfCards);
  gridview.setAdapter(gridAdapter);
  gridview.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View v,    int position,    long id){
      Toast.makeText(Startup.this,"String_Node_Str" + position,Toast.LENGTH_SHORT).show();
      Intent myIntent=new Intent(Startup.this,ViewCard.class);
      myIntent.putExtra("String_Node_Str",position);
      myIntent.putExtra("String_Node_Str",numOfCards);
      for (int i=0; i < numOfCards; i++) {
        myIntent.putExtra("String_Node_Str" + i,listOfWords[i]);
        myIntent.putExtra("String_Node_Str" + i,listOfForeign[i]);
        myIntent.putExtra("String_Node_Str" + i,listOfImageUrls[i]);
      }
      startActivityForResult(myIntent,0);
    }
  }
);
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  Bundle bundle=msg.getData();
  final int numOfCards=bundle.getInt("String_Node_Str");
  final String[] listOfWords=bundle.getStringArray("String_Node_Str");
  final String[] listOfForeign=bundle.getStringArray("String_Node_Str");
  final String[] listOfThumbnailUrls=bundle.getStringArray("String_Node_Str");
  final String[] listOfImageUrls=bundle.getStringArray("String_Node_Str");
  final GridView gridview=(GridView)findViewById(R.id.currentCards);
  if (numOfCards > 0) {
    ThumbnailAdapter gridAdapter=new ThumbnailAdapter(Startup.this.getApplicationContext(),listOfThumbnailUrls,listOfWords,listOfForeign,numOfCards);
    gridview.setAdapter(gridAdapter);
    gridview.setOnItemClickListener(new OnItemClickListener(){
      public void onItemClick(      AdapterView<?> parent,      View v,      int position,      long id){
        Toast.makeText(Startup.this,"String_Node_Str" + position,Toast.LENGTH_SHORT).show();
        Intent myIntent=new Intent(Startup.this,ViewCard.class);
        myIntent.putExtra("String_Node_Str",position);
        myIntent.putExtra("String_Node_Str",numOfCards);
        for (int i=0; i < numOfCards; i++) {
          myIntent.putExtra("String_Node_Str" + i,listOfWords[i]);
          myIntent.putExtra("String_Node_Str" + i,listOfForeign[i]);
          myIntent.putExtra("String_Node_Str" + i,listOfImageUrls[i]);
        }
        startActivityForResult(myIntent,0);
      }
    }
);
  }
}
Program: 45334
Project: 45334
Buggy source:
public void run(){
  try {
    ThumbnailObtainer tbo=new ThumbnailObtainer();
    Message msg=Message.obtain();
    Bundle bundle=new Bundle();
    bundle.putStringArray("String_Node_Str",tbo.listOfWords);
    bundle.putStringArray("String_Node_Str",tbo.listOfForeign);
    bundle.putStringArray("String_Node_Str",tbo.listOfImageUrls);
    bundle.putInt("String_Node_Str",tbo.numOfCards);
    msg.setData(bundle);
    thumbnailHandler.sendMessage(msg);
  }
 catch (  Exception e) {
    System.out.println(e.toString());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    ThumbnailObtainer tbo=new ThumbnailObtainer();
    Message msg=Message.obtain();
    Bundle bundle=new Bundle();
    bundle.putStringArray("String_Node_Str",tbo.listOfWords);
    bundle.putStringArray("String_Node_Str",tbo.listOfForeign);
    bundle.putStringArray("String_Node_Str",tbo.listOfImageUrls);
    bundle.putStringArray("String_Node_Str",tbo.listOfThumbnailUrls);
    bundle.putInt("String_Node_Str",tbo.numOfCards);
    msg.setData(bundle);
    thumbnailHandler.sendMessage(msg);
  }
 catch (  Exception e) {
    System.out.println(e.toString());
  }
}
Program: 45336
Project: 45336
Buggy source:
public int getCount(){
  return mUrls.length - 1;
}

Fixed version (ground truth):
public int getCount(){
  return mUrls.length;
}
Program: 45337
Project: 45337
Buggy source:
public ThumbnailObtainer(){
  HttpGet get=new HttpGet("String_Node_Str");
  ResponseHandler<String> responseHandler=new BasicResponseHandler();
  HttpClient client=new DefaultHttpClient();
  get.addHeader(BasicScheme.authenticate(new UsernamePasswordCredentials("String_Node_Str","String_Node_Str"),"String_Node_Str",false));
  try {
    String responseBody=client.execute(get,responseHandler);
    System.out.println(responseBody);
    JSONObject jObject=new JSONObject(responseBody);
    JSONArray items=jObject.getJSONArray("String_Node_Str");
    listOfWords=new String[items.length() + 1];
    listOfForeign=new String[items.length() + 1];
    listOfImageUrls=new String[items.length() + 1];
    for (int i=0; i < items.length(); i++) {
      numOfCards++;
      JSONObject item=items.getJSONObject(i);
      String image_url=item.getString("String_Node_Str");
      String word=item.getString("String_Node_Str");
      String answer=item.getString("String_Node_Str");
      String flashcard_id=item.getString("String_Node_Str");
      listOfWords[i]=word;
      listOfForeign[i]=answer;
      image_url=image_url.substring(image_url.lastIndexOf("String_Node_Str"));
      listOfImageUrls[i]=image_url;
    }
  }
 catch (  Throwable t) {
    Log.e("String_Node_Str","String_Node_Str",t);
  }
}

Fixed version (ground truth):
public ThumbnailObtainer(){
  HttpGet get=new HttpGet("String_Node_Str");
  ResponseHandler<String> responseHandler=new BasicResponseHandler();
  HttpClient client=new DefaultHttpClient();
  get.addHeader(BasicScheme.authenticate(new UsernamePasswordCredentials("String_Node_Str","String_Node_Str"),"String_Node_Str",false));
  try {
    String responseBody=client.execute(get,responseHandler);
    System.out.println(responseBody);
    JSONObject jObject=new JSONObject(responseBody);
    JSONArray items=jObject.getJSONArray("String_Node_Str");
    listOfWords=new String[items.length()];
    listOfForeign=new String[items.length()];
    listOfImageUrls=new String[items.length()];
    listOfThumbnailUrls=new String[items.length()];
    for (int i=0; i < items.length(); i++) {
      numOfCards++;
      JSONObject item=items.getJSONObject(i);
      String image_url=item.getString("String_Node_Str");
      String thumbnail_url=item.getString("String_Node_Str");
      String word=item.getString("String_Node_Str");
      String answer=item.getString("String_Node_Str");
      String flashcard_id=item.getString("String_Node_Str");
      listOfWords[i]=word;
      listOfForeign[i]=answer;
      image_url=image_url.substring(image_url.lastIndexOf("String_Node_Str"));
      thumbnail_url=thumbnail_url.substring(thumbnail_url.lastIndexOf("String_Node_Str"));
      listOfImageUrls[i]=image_url;
      listOfThumbnailUrls[i]=thumbnail_url;
    }
  }
 catch (  Throwable t) {
    Log.e("String_Node_Str","String_Node_Str",t);
  }
}
Program: 45338
Project: 45338
Buggy source:
public Drawable loadDrawable(String image_url){
  URL url=null;
  InputStream inputStream=null;
  try {
    url=new URL(image_url);
    inputStream=(InputStream)url.getContent();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Drawable drawable=Drawable.createFromStream(inputStream,"String_Node_Str");
  Toast.makeText(this.getApplicationContext(),"String_Node_Str" + url.toString(),Toast.LENGTH_LONG).show();
  return drawable;
}

Fixed version (ground truth):
public Drawable loadDrawable(String image_url){
  URL url=null;
  InputStream inputStream=null;
  try {
    url=new URL(image_url);
    inputStream=(InputStream)url.getContent();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Drawable drawable=Drawable.createFromStream(inputStream,"String_Node_Str");
  Toast.makeText(this.getApplicationContext(),"String_Node_Str" + url.toString(),Toast.LENGTH_SHORT).show();
  return drawable;
}
Program: 45339
Project: 45339
Buggy source:
public void onChoiceClicked(View view){
  Button button=(Button)view;
  this.questionCorrect=(choices[correctChoice] == button);
  if (this.questionCorrect) {
    view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
    popup.setText("String_Node_Str" + title.getText().toString() + "String_Node_Str"+ button.getText());
    popup.setBackgroundColor(0xaa00ff00);
    popup.setVisibility(View.VISIBLE);
  }
 else {
    Log.i("String_Node_Str","String_Node_Str" + button.getText().toString());
    button.setVisibility(View.INVISIBLE);
    int i;
    for (i=0; i < choices.length; i++) {
      if (choices[i] == button)       break;
    }
    popup.setText("String_Node_Str" + button.getText().toString() + "String_Node_Str"+ translatedChoices[i]);
    popup.setBackgroundColor(0xaaff0000);
    popup.setVisibility(View.VISIBLE);
    vibrator.vibrate(500);
  }
}

Fixed version (ground truth):
public void onChoiceClicked(View view){
  Button button=(Button)view;
  this.questionCorrect=(choices[correctChoice] == button);
  if (this.questionCorrect) {
    if (!this.wrong) {
      flashcards[currentFlashcardIndex].setCorrect();
      correctPicks++;
    }
    view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
    popup.setText("String_Node_Str" + title.getText().toString() + "String_Node_Str"+ button.getText());
    popup.setBackgroundColor(0xaa00ff00);
    popup.setVisibility(View.VISIBLE);
  }
 else {
    Log.i("String_Node_Str","String_Node_Str" + button.getText().toString());
    this.wrong=true;
    button.setVisibility(View.INVISIBLE);
    int i;
    for (i=0; i < choices.length; i++) {
      if (choices[i] == button)       break;
    }
    popup.setText("String_Node_Str" + button.getText().toString() + "String_Node_Str"+ translatedChoices[i]);
    popup.setBackgroundColor(0xaaff0000);
    popup.setVisibility(View.VISIBLE);
    vibrator.vibrate(500);
  }
}
Program: 45340
Project: 45340
Buggy source:
public void loadCurrentFlashCard(){
  FlashCard flashcard=this.flashcards[this.currentFlashcardIndex];
  tableLayout.setBackgroundDrawable(flashcard.drawable);
  for (int i=0; i < 4; i++) {
    choices[i].setText(flashcard.choices[i]);
  }
  title.setText(flashcard.title);
  this.correctChoice=flashcard.correctChoice;
  popup.setVisibility(View.INVISIBLE);
  this.currentFlashcardIndex++;
}

Fixed version (ground truth):
public void loadCurrentFlashCard(){
  this.wrong=false;
  FlashCard flashcard=this.flashcards[this.currentFlashcardIndex];
  if (flashcard != null) {
    tableLayout.setBackgroundDrawable(flashcard.drawable);
    for (int i=0; i < 4; i++) {
      choices[i].setText(flashcard.choices[i]);
    }
    title.setText(flashcard.title);
    this.correctChoice=flashcard.correctChoice;
    popup.setVisibility(View.INVISIBLE);
  }
 else   Toast.makeText(this.getApplicationContext(),"String_Node_Str" + this.currentFlashcardIndex + "String_Node_Str"+ this.flashcards.length,Toast.LENGTH_LONG).show();
  setAllVisible();
}
Program: 45341
Project: 45341
Buggy source:
public void onPopupClicked(View v){
  popup.setVisibility(View.INVISIBLE);
  if (this.questionCorrect) {
    this.currentFlashcardIndex++;
    loadCurrentFlashCard();
  }
}

Fixed version (ground truth):
public void onPopupClicked(View v){
  popup.setVisibility(View.INVISIBLE);
  if (this.questionCorrect && this.currentFlashcardIndex < (this.flashcards.length - 1)) {
    this.currentFlashcardIndex++;
    loadCurrentFlashCard();
    Toast.makeText(this.getApplicationContext(),"String_Node_Str" + this.currentFlashcardIndex + "String_Node_Str"+ this.flashcards.length,Toast.LENGTH_SHORT).show();
  }
 else   if (this.questionCorrect && this.currentFlashcardIndex >= (this.flashcards.length - 1)) {
    Toast.makeText(this.getApplicationContext(),"String_Node_Str" + correctPicks + "String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}
Program: 45342
Project: 45342
Buggy source:
public ArrayList<Double> method1(int a,int b){
  int nnumberofFilters=24;
  int nlifteringCoefficient=b;
  boolean oisLifteringEnabled=true;
  boolean oisZeroThCepstralCoefficientCalculated=false;
  int nnumberOfMFCCParameters=a;
  double dsamplingFrequency=8000.0;
  int nFFTLength=512;
  ArrayList<Double> mfcc_parameters=new ArrayList<Double>();
  if (oisZeroThCepstralCoefficientCalculated) {
    nnumberOfMFCCParameters=nnumberOfMFCCParameters + 1;
  }
 else {
    nnumberOfMFCCParameters=nnumberOfMFCCParameters;
  }
  MFCC mfcc=new MFCC(nnumberOfMFCCParameters,dsamplingFrequency,nnumberofFilters,nFFTLength,oisLifteringEnabled,nlifteringCoefficient,oisZeroThCepstralCoefficientCalculated);
  double[] x=new double[160];
  Random rand=new Random();
  x[2]=rand.nextDouble();
  x[4]=rand.nextDouble();
  double[] dparameters=mfcc.getParameters(x);
  for (int i=0; i < dparameters.length; i++) {
    mfcc_parameters.add(dparameters[i]);
  }
  if (Preferences.DEBUG_MODE)   System.out.println("String_Node_Str" + mfcc_parameters);
  return mfcc_parameters;
}

Fixed version (ground truth):
public ArrayList<Double> method1(int a,int b){
  if (a > b) {
    int temp=a;
    a=b;
    b=temp;
  }
  int nnumberofFilters=24;
  int nlifteringCoefficient=b;
  boolean oisLifteringEnabled=true;
  boolean oisZeroThCepstralCoefficientCalculated=false;
  int nnumberOfMFCCParameters=a;
  double dsamplingFrequency=8000.0;
  int nFFTLength=512;
  ArrayList<Double> mfcc_parameters=new ArrayList<Double>();
  if (oisZeroThCepstralCoefficientCalculated) {
    nnumberOfMFCCParameters=nnumberOfMFCCParameters + 1;
  }
 else {
    nnumberOfMFCCParameters=nnumberOfMFCCParameters;
  }
  MFCC mfcc=new MFCC(nnumberOfMFCCParameters,dsamplingFrequency,nnumberofFilters,nFFTLength,oisLifteringEnabled,nlifteringCoefficient,oisZeroThCepstralCoefficientCalculated);
  double[] x=new double[160];
  Random rand=new Random();
  x[2]=rand.nextDouble();
  x[4]=rand.nextDouble();
  double[] dparameters=mfcc.getParameters(x);
  for (int i=0; i < dparameters.length; i++) {
    mfcc_parameters.add(dparameters[i]);
  }
  if (Preferences.DEBUG_MODE)   System.out.println("String_Node_Str" + mfcc_parameters);
  return mfcc_parameters;
}
Program: 45348
Project: 45348
Buggy source:
private void sendAndRetryTaskAdv(final TaskLookup taskLookup,final Message advMsg){
  (new Thread(){
    public void run(){
      while (taskLookup.getStatus() == Preferences.TASK_STATUS.ADVERTISED && taskLookup.getRetry() < Preferences.NUMBER_OF_RETRIES_BEFORE_QUITTING) {
        logMessage("String_Node_Str" + taskLookup.getStatus() + "String_Node_Str"+ taskLookup.getRetry());
        try {
synchronized (mp) {
synchronized (nodes) {
              Collection<Node> nodesTemp=nodes.values();
              for (              Node n : nodesTemp) {
                if (!n.getName().equalsIgnoreCase(host)) {
                  advMsg.setDest(n.getName());
                  mp.send(advMsg);
                  Thread.sleep(100);
                }
              }
            }
          }
        }
 catch (        InterruptedException ex) {
          Logger.getLogger(TaskDistributor.class.getName()).log(Level.SEVERE,null,ex);
        }
catch (        InvalidMessageException e) {
          e.printStackTrace();
        }
        taskLookup.incrRetry();
        try {
          if (taskLookup.getRetry() < Preferences.NUMBER_OF_RETRIES_BEFORE_QUITTING) {
            Thread.sleep(Preferences.WAIT_TIME_BEFORE_RETRYING);
          }
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
).start();
}

Fixed version (ground truth):
private void sendAndRetryTaskAdv(final TaskLookup taskLookup,final Message advMsg){
  (new Thread(){
    public void run(){
      while (taskLookup.getStatus() == Preferences.TASK_STATUS.ADVERTISED && taskLookup.getRetry() < Preferences.NUMBER_OF_RETRIES_BEFORE_QUITTING) {
        logMessage("String_Node_Str" + taskLookup.getStatus() + "String_Node_Str"+ taskLookup.getRetry());
        try {
synchronized (mp) {
synchronized (nodes) {
              Collection<Node> nodesTemp=nodes.values();
              for (              Node n : nodesTemp) {
                if (!n.getName().equalsIgnoreCase(host)) {
                  advMsg.setDest(n.getName());
                  if (taskLookup.getStatus() == Preferences.TASK_STATUS.DISTRIBUTED)                   break;
                  mp.send(advMsg);
                  Thread.sleep(100);
                }
              }
            }
          }
        }
 catch (        InterruptedException ex) {
          Logger.getLogger(TaskDistributor.class.getName()).log(Level.SEVERE,null,ex);
        }
catch (        InvalidMessageException e) {
          e.printStackTrace();
        }
        taskLookup.incrRetry();
        try {
          if (taskLookup.getRetry() < Preferences.NUMBER_OF_RETRIES_BEFORE_QUITTING) {
            Thread.sleep(Preferences.WAIT_TIME_BEFORE_RETRYING);
          }
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
).start();
}
Program: 45350
Project: 45350
Buggy source:
/** 
 * Runs the command and adds the command output to the output box on the owner form.
 */
public void run(){
  Matcher passesMatcher;
  Matcher failuresMatcher;
  Matcher exceptionsMatcher;
  try {
    Process p=Runtime.getRuntime().exec(this.command,this.env);
    BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line=br.readLine();
    while (line != null) {
      output+=line + "String_Node_Str";
      line=br.readLine();
    }
    passesMatcher=getPassesPattern.matcher(output);
    failuresMatcher=getFailuresPattern.matcher(output);
    exceptionsMatcher=getExceptionsPattern.matcher(output);
    if (passesMatcher.find()) {
      passes+=Integer.parseInt(passesMatcher.group(1));
    }
    if (failuresMatcher.find()) {
      failures+=Integer.parseInt(failuresMatcher.group(1));
    }
    if (exceptionsMatcher.find()) {
      exceptions+=Integer.parseInt(exceptionsMatcher.group(1));
    }
    br.close();
  }
 catch (  Exception e) {
    output+="String_Node_Str" + command + "String_Node_Str";
    for (int i=0; i < env.length; i++) {
      output+=env[i] + "String_Node_Str";
    }
  }
}

Fixed version (ground truth):
/** 
 * Runs the command and adds the command output to the output box on the owner form.
 */
@Override public void run(){
  Matcher passesMatcher;
  Matcher failuresMatcher;
  Matcher exceptionsMatcher;
  System.out.println("String_Node_Str" + this.command);
  System.out.println("String_Node_Str");
  for (int i=0; i < env.length; i++) {
    System.out.println(env[i]);
  }
  try {
    Process p=Runtime.getRuntime().exec(this.command,this.env);
    BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader br_err=new BufferedReader(new InputStreamReader(p.getErrorStream()));
    String line=br.readLine();
    while (line != null) {
      output+=line + "String_Node_Str";
      line=br.readLine();
    }
    line=br_err.readLine();
    while (line != null) {
      error+=line + "String_Node_Str";
      line=br_err.readLine();
    }
    passesMatcher=getPassesPattern.matcher(output);
    failuresMatcher=getFailuresPattern.matcher(output);
    exceptionsMatcher=getExceptionsPattern.matcher(output);
    if (passesMatcher.find()) {
      passes+=Integer.parseInt(passesMatcher.group(1));
    }
    if (failuresMatcher.find()) {
      failures+=Integer.parseInt(failuresMatcher.group(1));
    }
    if (exceptionsMatcher.find()) {
      exceptions+=Integer.parseInt(exceptionsMatcher.group(1));
    }
    br.close();
  }
 catch (  Exception e) {
    output+="String_Node_Str" + command + "String_Node_Str";
    for (int i=0; i < env.length; i++) {
      output+=env[i] + "String_Node_Str";
    }
  }
}
Program: 45351
Project: 45351
Buggy source:
/** 
 * Initialises the RunCommand object with the owner form, the command to execute and the environment variables to use.
 * @param owner The owner form.
 * @param command
 * @param env
 */
public RunCommand(MainForm owner,String command,String[] env){
  this.owner=owner;
  this.command=command;
  this.env=env;
  System.out.println("String_Node_Str" + this.command);
  System.out.println("String_Node_Str");
  for (int i=0; i < env.length; i++) {
    System.out.println(env[i]);
  }
}

Fixed version (ground truth):
/** 
 * Initialises the RunCommand object with the owner form, the command to execute and the environment variables to use.
 * @param owner The owner form.
 * @param command
 * @param env
 */
public RunCommand(MainForm owner,String command,String[] env){
  this.owner=owner;
  this.command=command;
  this.env=env;
}
Program: 45352
Project: 45352
Buggy source:
public String getOutput(){
  return output;
}

Fixed version (ground truth):
/** 
 * Returns whatever was output to stdout during the run of the command.
 * @return The stdout for the command.
 */
public String getOutput(){
  return output;
}
Program: 45354
Project: 45354
Buggy source:
private static Boolean set_ip(String url,String ip,LinkedList<Addr_pair> at){
  Addr_pair ap;
  ListIterator iter=at.listIterator();
  while (iter.hasNext()) {
    ap=(Addr_pair)iter.next();
    if (ap.url == url) {
      ap.ip=ip;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean set_ip(String url,String ip,LinkedList<Addr_pair> at){
  System.out.println("String_Node_Str" + url + "String_Node_Str"+ ip);
  Addr_pair ap;
  ListIterator<Addr_pair> iter=at.listIterator();
  while (iter.hasNext()) {
    ap=(Addr_pair)iter.next();
    if (ap.url == url) {
      ap.ip=ip;
      return true;
    }
  }
  at.add(new Addr_pair(url,ip));
  return false;
}
Program: 45355
Project: 45355
Buggy source:
private static String get_ip(String url,LinkedList<Addr_pair> at){
  Addr_pair ap;
  ListIterator iter=at.listIterator();
  while (iter.hasNext()) {
    ap=(Addr_pair)iter.next();
    if (ap.url == url)     return ap.ip;
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
private static String get_ip(String url,LinkedList<Addr_pair> at){
  for (  Addr_pair cur : at) {
    if (cur.url.equals(url)) {
      return cur.ip;
    }
  }
  return null;
}
Program: 45356
Project: 45356
Buggy source:
private static String get_rsp(Message req,LinkedList<Addr_pair> at){
  String reply=null;
  if (req != DNS_REQ && req != DNS_UPDATE_REQ) {
    if (req.type == DNS_REQ) {
      reply=get_ip(req.url,at);
    }
 else     if (req.type == DNS_UPDATE_REQ) {
      if (set_ip(req.url,req.ip,at))       reply="String_Node_Str";
 else       reply="String_Node_Str";
    }
  }
  return reply;
}

Fixed version (ground truth):
private byte[] get_rsp(Message req,String ip,LinkedList<Addr_pair> at){
  String reply=null;
  if (req.type == Message.DNS_REQ || req.type == Message.DNS_UPDATE_REQ) {
    if (req.type == Message.DNS_REQ) {
      System.out.println("String_Node_Str" + req.text1);
      return Message.newDNS_RSP(get_ip(req.text1,at));
    }
 else     if (req.type == Message.DNS_UPDATE_REQ) {
      System.out.println("String_Node_Str");
      int response=0;
      if (set_ip(req.text1,ip,at))       return Message.newDNS_UPDATE_RSP(response);
      String IDD=null;
      for (      Addr_pair a : at) {
        if (a.url.equals(Constants.IDD_NAME)) {
          IDD=a.ip;
          break;
        }
      }
      if (IDD != null)       return Message.newDNS_UPDATE_RSP(response,IDD);
    }
  }
  return null;
}
Program: 45357
Project: 45357
Buggy source:
public TCPIDDServer(InterDIFDirectory IDD){
  this.IDD=IDD;
  try {
    Socket toDNS=new Socket(Constants.DNS_IP,Constants.DNS_PORT);
    toDNS.getOutputStream().write(Message.newDNS_UPDATE_REQ(Constants.IDD_NAME));
    Message dnsReply=Message.readFromSocket(toDNS);
    if (dnsReply.errorCode != 0) {
      throw new Exception();
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  try {
    serverSocket=new ServerSocket(PORT);
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public TCPIDDServer(){
  this.IDD=new InterDIFDirectory();
  try {
    Socket toDNS=new Socket(Constants.DNS_IP,Constants.DNS_PORT);
    toDNS.getOutputStream().write(Message.newDNS_UPDATE_REQ(Constants.IDD_NAME));
    Message dnsReply=Message.readFromSocket(toDNS);
    if (dnsReply.errorCode != 0) {
      throw new Exception();
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  try {
    serverSocket=new ServerSocket(Constants.IDD_PORT);
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  this.start();
}
Program: 45358
Project: 45358
Buggy source:
/** 
 * Return the SHA1 sum of a given string
 * @param str The string to be hashed
 * @return The SHA1 sum as a hex encoded string
 */
protected String getMboxSha1Sum(String str){
  try {
    MessageDigest md=MessageDigest.getInstance("String_Node_Str");
    md.update(str.getBytes());
    return new BigInteger(1,md.digest()).toString(16);
  }
 catch (  NoSuchAlgorithmException e) {
    log.error(e.getMessage(),e);
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Return the SHA1 sum of a given string
 * @param str The string to be hashed
 * @return The SHA1 sum as a hex encoded string
 */
protected String getMboxSha1Sum(String str){
  try {
    MessageDigest md=MessageDigest.getInstance("String_Node_Str");
    md.update(str.getBytes());
    return String.format("String_Node_Str",new BigInteger(1,md.digest()));
  }
 catch (  NoSuchAlgorithmException e) {
    log.error(e.getMessage(),e);
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 45359
Project: 45359
Buggy source:
@Override public void run(){
  try {
    if (getArgList().isEmpty()) {
      usage();
    }
    if (noTDB() || hasOption("String_Node_Str")) {
      FileUtils.deleteQuietly(getTDBFile());
      FileUtils.forceMkdir(getTDBFile());
      SetupTDB.setOptimizerWarningFlag(false);
      Dataset dataset=TDBFactory.createDataset(getTdbLocation());
      String projectName=getArgs()[0];
      String projectURI=projectNamespace() + projectName;
      Resource project=dataset.getDefaultModel().createResource(projectURI);
      project.addProperty(RDF.type,DOAP.Project);
      project.addProperty(DOAP.name,projectName);
      addOptionalProperty(project,DOAP.shortdesc,"String_Node_Str");
      addOptionalProperty(project,DOAP.description,"String_Node_Str");
      System.out.println(String.format("String_Node_Str",projectName,dataset.getDefaultModel().size()));
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    if (getArgList().isEmpty()) {
      usage();
    }
    if (noTDB() || hasOption("String_Node_Str")) {
      FileUtils.deleteQuietly(getTDBFile());
      FileUtils.forceMkdir(getTDBFile());
      SetupTDB.setOptimizerWarningFlag(false);
      Dataset dataset=TDBFactory.createDataset(getTdbLocation());
      String projectName=getArgs()[0];
      String projectURI=projectNamespace() + projectName;
      Resource project=dataset.getDefaultModel().createResource(projectURI);
      project.addProperty(RDF.type,DOAP.Project).addProperty(RDF.type,projectRootType()).addProperty(DOAP.name,projectName);
      addOptionalProperty(project,DOAP.shortdesc,"String_Node_Str");
      addOptionalProperty(project,DOAP.description,"String_Node_Str");
      System.out.println(String.format("String_Node_Str",projectName,dataset.getDefaultModel().size()));
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
}
Program: 45360
Project: 45360
Buggy source:
/** 
 * Get the DOAP project resource 
 */
public Resource getProjectResource(){
  ResIterator i=getTDBModel().listSubjectsWithProperty(RDF.type,DOAP.Project);
  if (i.hasNext()) {
    return i.next();
  }
 else {
    System.err.println("String_Node_Str");
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Get the DOAP project resource 
 */
public Resource getProjectResource(){
  ResIterator i=getTDBModel().listSubjectsWithProperty(RDF.type,projectRootType());
  if (i.hasNext()) {
    return i.next();
  }
 else {
    System.err.println("String_Node_Str");
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 45361
Project: 45361
Buggy source:
public void send_startVariableDeclare(String name,List<String> type,String attributes) throws org.apache.thrift.TException {
  oprot_.writeMessageBegin(new org.apache.thrift.protocol.TMessage("String_Node_Str",org.apache.thrift.protocol.TMessageType.CALL,++seqid_));
  startVariableDeclare_args args=new startVariableDeclare_args();
  args.setName(name);
  args.setType(type);
  args.setAttributes(attributes);
  args.write(oprot_);
  oprot_.writeMessageEnd();
  oprot_.getTransport().flush();
}

Fixed version (ground truth):
public void send_startVariableDeclare(String name,List<String> type,List<String> attributes) throws org.apache.thrift.TException {
  oprot_.writeMessageBegin(new org.apache.thrift.protocol.TMessage("String_Node_Str",org.apache.thrift.protocol.TMessageType.CALL,++seqid_));
  startVariableDeclare_args args=new startVariableDeclare_args();
  args.setName(name);
  args.setType(type);
  args.setAttributes(attributes);
  args.write(oprot_);
  oprot_.writeMessageEnd();
  oprot_.getTransport().flush();
}
Program: 45362
Project: 45362
Buggy source:
public startVariableDeclare_call(String name,List<String> type,String attributes,org.apache.thrift.async.AsyncMethodCallback<startVariableDeclare_call> resultHandler,org.apache.thrift.async.TAsyncClient client,org.apache.thrift.protocol.TProtocolFactory protocolFactory,org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
  super(client,protocolFactory,transport,resultHandler,true);
  this.name=name;
  this.type=type;
  this.attributes=attributes;
}

Fixed version (ground truth):
public startVariableDeclare_call(String name,List<String> type,List<String> attributes,org.apache.thrift.async.AsyncMethodCallback<startVariableDeclare_call> resultHandler,org.apache.thrift.async.TAsyncClient client,org.apache.thrift.protocol.TProtocolFactory protocolFactory,org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
  super(client,protocolFactory,transport,resultHandler,true);
  this.name=name;
  this.type=type;
  this.attributes=attributes;
}
Program: 45363
Project: 45363
Buggy source:
public void startVariableDeclare(String name,List<String> type,String attributes,org.apache.thrift.async.AsyncMethodCallback<startVariableDeclare_call> resultHandler) throws org.apache.thrift.TException {
  checkReady();
  startVariableDeclare_call method_call=new startVariableDeclare_call(name,type,attributes,resultHandler,this,protocolFactory,transport);
  this.currentMethod=method_call;
  manager.call(method_call);
}

Fixed version (ground truth):
public void startVariableDeclare(String name,List<String> type,List<String> attributes,org.apache.thrift.async.AsyncMethodCallback<startVariableDeclare_call> resultHandler) throws org.apache.thrift.TException {
  checkReady();
  startVariableDeclare_call method_call=new startVariableDeclare_call(name,type,attributes,resultHandler,this,protocolFactory,transport);
  this.currentMethod=method_call;
  manager.call(method_call);
}
Program: 45364
Project: 45364
Buggy source:
public String getAttributes(){
  return this.attributes;
}

Fixed version (ground truth):
public List<String> getAttributes(){
  return this.attributes;
}
Program: 45365
Project: 45365
Buggy source:
public startVariableDeclare_args setAttributes(String attributes){
  this.attributes=attributes;
  return this;
}

Fixed version (ground truth):
public startVariableDeclare_args setAttributes(List<String> attributes){
  this.attributes=attributes;
  return this;
}
Program: 45366
Project: 45366
Buggy source:
/** 
 * Performs a deep copy on <i>other</i>.
 */
public startVariableDeclare_args(startVariableDeclare_args other){
  if (other.isSetName()) {
    this.name=other.name;
  }
  if (other.isSetType()) {
    this.type=other.type;
  }
  if (other.isSetAttributes()) {
    this.attributes=other.attributes;
  }
}

Fixed version (ground truth):
/** 
 * Performs a deep copy on <i>other</i>.
 */
public startVariableDeclare_args(startVariableDeclare_args other){
  if (other.isSetName()) {
    this.name=other.name;
  }
  if (other.isSetType()) {
    this.type=other.type;
  }
  if (other.isSetAttributes()) {
    List<String> __this__attributes=new ArrayList<String>();
    for (    String other_element : other.attributes) {
      __this__attributes.add(other_element);
    }
    this.attributes=__this__attributes;
  }
}
Program: 45367
Project: 45367
Buggy source:
private void addPositionMetadata(Context cx,DefinitionNode def){
  MetaDataNode mn=cx.getNodeFactory().metaData(null,-1);
  mn.id="String_Node_Str";
  mn.values=new Value[2];
  mn.values[0]=new KeyValuePair("String_Node_Str",cx.getErrorOrigin());
  mn.values[1]=new KeyValuePair("String_Node_Str",String.valueOf(def.pos()));
  def.addMetaDataNode(mn);
}

Fixed version (ground truth):
private void addPositionMetadata(Context cx,DefinitionNode def){
  def.addMetaDataNode(makePositionMetadata(cx,def,false));
}
Program: 45369
Project: 45369
Buggy source:
public static int getLanguageID(String language){
  int langID=ContextStatics.LANG_EN;
  if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_EN;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_CN;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_CS;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_DE;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_ES;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_FR;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_IT;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_JP;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_KR;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_NL;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_PL;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_PT;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_RU;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_SV;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_TR;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_TW;
  return langID;
}

Fixed version (ground truth):
public static int getLanguageID(String language){
  int langID=ContextStatics.LANG_EN;
  if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_EN;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_CN;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_CS;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_DA;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_DE;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_ES;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_FI;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_FR;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_IT;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_JP;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_KR;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_NB;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_NL;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_PL;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_PT;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_RU;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_SV;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_TR;
 else   if (language.equals("String_Node_Str"))   langID=ContextStatics.LANG_TW;
  return langID;
}
Program: 45371
Project: 45371
Buggy source:
private final int makeToken(int id){
  currentToken.id=id;
  currentToken.text=null;
  return id;
}

Fixed version (ground truth):
private final int makeToken(int id){
  currentToken.id=id;
  currentToken.lookback=id;
  currentToken.text=null;
  return id;
}
Program: 45372
Project: 45372
Buggy source:
private Node parseSuperStatement(int mode){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  Node result;
  shift();
  SuperExpressionNode first=nodeFactory.superExpression(null,scanner.input.positionOfMark());
  if (lookahead() == LEFTPAREN_TOKEN) {
    CallExpressionNode call=(CallExpressionNode)parseArguments(first);
    if (lookaheadSemicolon(mode)) {
      result=nodeFactory.superStatement(call);
      matchSemicolon(mode);
    }
 else {
      if (call == null || call.args == null || call.args.size() != 1) {
        error(kError_Parser_WrongNumberOfSuperArgs);
      }
 else {
        first.expr=call.args.items.get(0);
      }
      Node t=parseFullPostfixExpressionPrime(first);
      result=nodeFactory.expressionStatement(parseListExpressionPrime(mode,nodeFactory.list(null,t)));
      matchSemicolon(mode);
    }
  }
 else {
    Node t=parseFullPostfixExpressionPrime(first);
    if (lookahead() == ASSIGN_TOKEN) {
      t=parseAssignmentExpressionSuffix(mode,t);
    }
    result=nodeFactory.expressionStatement(parseListExpressionPrime(mode,nodeFactory.list(null,t)));
    matchSemicolon(mode);
  }
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
private Node parseSuperStatement(int mode){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  Node result;
  shift();
  SuperExpressionNode first=nodeFactory.superExpression(null,scanner.input.positionOfMark());
  if (lookahead() == LEFTPAREN_TOKEN) {
    CallExpressionNode call=(CallExpressionNode)parseArguments(first);
    if (lookaheadSemicolon(mode)) {
      result=nodeFactory.superStatement(call);
      matchSemicolon(mode);
    }
 else {
      if (call == null || call.args == null || call.args.size() != 1) {
        error(kError_Parser_WrongNumberOfSuperArgs);
      }
 else {
        first.expr=call.args.items.get(0);
      }
      Node t=parseFullPostfixExpressionPrime(first);
      result=nodeFactory.expressionStatement(parseListExpressionPrime(mode,nodeFactory.list(null,t)));
      matchSemicolon(mode);
    }
  }
 else   if (lookahead() == DOT_TOKEN || lookahead() == LEFTBRACKET_TOKEN) {
    Node t=parseFullPostfixExpressionPrime(first);
    if (lookahead() == ASSIGN_TOKEN) {
      t=parseAssignmentExpressionSuffix(mode,t);
    }
    result=nodeFactory.expressionStatement(parseListExpressionPrime(mode,nodeFactory.list(null,t)));
    matchSemicolon(mode);
  }
 else {
    error(ParseError.EOS,kError_Parser_ExpectedToken,Token.getTokenClassName(LEFTPAREN_TOKEN),scanner.getCurrentTokenTextOrTypeText(lookahead()));
    result=nodeFactory.error(kError_Parser_ExpectedToken);
    skiperror(SEMICOLON_TOKEN);
  }
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}
Program: 45374
Project: 45374
Buggy source:
public void processUnresolvedNamespaces(){
  if (unresolved_namespaces != null) {
    List<UnresolvedNamespace> nsList=new ArrayList<UnresolvedNamespace>(unresolved_namespaces.keySet());
    for (int i=0, size=nsList.size(); i < size; i++) {
      UnresolvedNamespace ns=nsList.get(i);
      ObjectList<ObjectValue> scopes=unresolved_namespaces.get(ns);
      ObjectList<ObjectValue> temp=statics.scopes;
      statics.scopes=unresolved_namespaces.get(ns);
      Slot slot=ns.ref.getSlot(this);
      statics.scopes=temp;
      if (slot != null) {
        Value val=slot.getValue();
        ObjectValue realNamespace=(val instanceof ObjectValue) ? (ObjectValue)val : null;
        if (realNamespace != null) {
          ns.name=realNamespace.name;
          ns.ns_kind=realNamespace.getNamespaceKind();
          ns.resolved=true;
        }
      }
 else {
        ns.cx.error(ns.node.pos(),kError_Unknown_Namespace);
      }
      ns.cx=null;
      ns.node=null;
    }
    unresolved_namespaces.clear();
    unresolved_namespaces=null;
  }
}

Fixed version (ground truth):
public void processUnresolvedNamespaces(){
  if (unresolved_namespaces != null) {
    List<UnresolvedNamespace> nsList=new ArrayList<UnresolvedNamespace>(unresolved_namespaces.keySet());
    for (int i=0, size=nsList.size(); i < size; i++) {
      UnresolvedNamespace ns=nsList.get(i);
      ObjectList<ObjectValue> temp=statics.scopes;
      statics.scopes=unresolved_namespaces.get(ns);
      Slot slot=ns.ref.getSlot(this);
      statics.scopes=temp;
      if (slot != null) {
        Value val=slot.getValue();
        ObjectValue realNamespace=(val instanceof ObjectValue) ? (ObjectValue)val : null;
        if (realNamespace != null) {
          unresolved_namespaces.remove(ns);
          ns.name=realNamespace.name;
          ns.ns_kind=realNamespace.getNamespaceKind();
          ns.resolved=true;
        }
      }
 else {
        ns.cx.error(ns.node.pos(),kError_Unknown_Namespace);
      }
      ns.cx=null;
      ns.node=null;
    }
    unresolved_namespaces.clear();
    unresolved_namespaces=null;
  }
}