nus-yam/ex-repair huggingface dataset:
Program: 54955
Project: 54955
Buggy source:
/** 
 * Will set the screen orientation of the hosting activity
 * @param orientation		auto, landscape, portrait, reverse_landscape or reverse_portrait
 */
public void setScreenOrientation(String orientation){
  if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
}

Fixed version (ground truth):
/** 
 * Will set the screen orientation of the hosting activity
 * @param orientation		auto, landscape, portrait, reverse_landscape or reverse_portrait
 */
public void setScreenOrientation(String orientation){
  if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
 else   if (orientation.equals("String_Node_Str"))   getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
}
Program: 54956
Project: 54956
Buggy source:
@Override public void onUpdateSquelchSatisfied(boolean squelchSatisfied){
  scheduler.setSquelchSatisfied(squelchSatisfied);
}

Fixed version (ground truth):
@Override public void onUpdateSquelchSatisfied(boolean squelchSatisfied){
  if (scheduler != null)   scheduler.setSquelchSatisfied(squelchSatisfied);
}
Program: 54957
Project: 54957
Buggy source:
/** 
 * Called by the analyzer surface after the user changed the channel width
 * @param newChannelWidth    new channel width (single sided) in Hz
 * @return true if channel width is valid; false if out of range
 */
@Override public boolean onUpdateChannelWidth(int newChannelWidth){
  return demodulator.setChannelWidth(newChannelWidth);
}

Fixed version (ground truth):
/** 
 * Called by the analyzer surface after the user changed the channel width
 * @param newChannelWidth    new channel width (single sided) in Hz
 * @return true if channel width is valid; false if out of range
 */
@Override public boolean onUpdateChannelWidth(int newChannelWidth){
  if (demodulator != null)   return demodulator.setChannelWidth(newChannelWidth);
 else   return false;
}
Program: 54958
Project: 54958
Buggy source:
@Override public void onUpdateChannelFrequency(long newChannelFrequency){
  scheduler.setChannelFrequency(newChannelFrequency);
}

Fixed version (ground truth):
@Override public void onUpdateChannelFrequency(long newChannelFrequency){
  if (scheduler != null)   scheduler.setChannelFrequency(newChannelFrequency);
}
Program: 54959
Project: 54959
Buggy source:
@Override public void run(){
  SamplePacket inputSamples=null;
  SamplePacket audioBuffer=null;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  audioSink.start();
  decimator.start();
  while (!stopRequested) {
    inputSamples=decimator.getDecimatedPacket(1000);
    if (inputSamples == null) {
      continue;
    }
    applyUserFilter(inputSamples,quadratureSamples);
    decimator.returnDecimatedPacket(inputSamples);
    audioBuffer=audioSink.getPacketBuffer(1000);
switch (demodulationMode) {
case DEMODULATION_OFF:
      break;
case DEMODULATION_AM:
    demodulateAM(quadratureSamples,audioBuffer);
  break;
case DEMODULATION_NFM:
demodulateFM(quadratureSamples,audioBuffer,5000);
break;
case DEMODULATION_WFM:
demodulateFM(quadratureSamples,audioBuffer,75000);
break;
case DEMODULATION_LSB:
demodulateSSB(quadratureSamples,audioBuffer,false);
break;
case DEMODULATION_USB:
demodulateSSB(quadratureSamples,audioBuffer,true);
break;
default :
Log.e(LOGTAG,"String_Node_Str" + demodulationMode);
}
audioSink.enqueuePacket(audioBuffer);
}
audioSink.stopSink();
decimator.stopDecimator();
this.stopRequested=true;
Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  SamplePacket inputSamples=null;
  SamplePacket audioBuffer=null;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  audioSink.start();
  decimator.start();
  while (!stopRequested) {
    inputSamples=decimator.getDecimatedPacket(1000);
    if (inputSamples == null) {
      continue;
    }
    applyUserFilter(inputSamples,quadratureSamples);
    decimator.returnDecimatedPacket(inputSamples);
    audioBuffer=audioSink.getPacketBuffer(1000);
    if (audioBuffer == null) {
      Log.d(LOGTAG,"String_Node_Str");
      continue;
    }
switch (demodulationMode) {
case DEMODULATION_OFF:
      break;
case DEMODULATION_AM:
    demodulateAM(quadratureSamples,audioBuffer);
  break;
case DEMODULATION_NFM:
demodulateFM(quadratureSamples,audioBuffer,5000);
break;
case DEMODULATION_WFM:
demodulateFM(quadratureSamples,audioBuffer,75000);
break;
case DEMODULATION_LSB:
demodulateSSB(quadratureSamples,audioBuffer,false);
break;
case DEMODULATION_USB:
demodulateSSB(quadratureSamples,audioBuffer,true);
break;
default :
Log.e(LOGTAG,"String_Node_Str" + demodulationMode);
}
audioSink.enqueuePacket(audioBuffer);
}
audioSink.stopSink();
decimator.stopDecimator();
this.stopRequested=true;
Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}
Program: 54960
Project: 54960
Buggy source:
/** 
 * Set the font size
 * @param fontSize FONT_SIZE_SMALL, *_MEDIUM or *_LARGE
 */
public void setFontSize(int fontSize){
  int normalTextSize;
  int smallTextSize;
switch (fontSize) {
case FONT_SIZE_SMALL:
    normalTextSize=(int)(getGridSize() * 0.3);
  smallTextSize=(int)(getGridSize() * 0.2);
break;
case FONT_SIZE_MEDIUM:
normalTextSize=(int)(getGridSize() * 0.476);
smallTextSize=(int)(getGridSize() * 0.25);
break;
case FONT_SIZE_LARGE:
normalTextSize=(int)(getGridSize() * 0.7);
smallTextSize=(int)(getGridSize() * 0.35);
break;
default :
Log.e(LOGTAG,"String_Node_Str" + fontSize);
return;
}
this.fontSize=fontSize;
this.textPaint.setTextSize(normalTextSize);
this.textSmallPaint.setTextSize(smallTextSize);
Log.i(LOGTAG,"String_Node_Str" + getResources().getDisplayMetrics().xdpi + "String_Node_Str"+ fontSize+ "String_Node_Str"+ normalTextSize+ "String_Node_Str"+ smallTextSize);
}

Fixed version (ground truth):
/** 
 * Set the font size
 * @param fontSize FONT_SIZE_SMALL, *_MEDIUM or *_LARGE
 */
public void setFontSize(int fontSize){
  int normalTextSize;
  int smallTextSize;
switch (fontSize) {
case FONT_SIZE_SMALL:
    normalTextSize=(int)(getGridSize() * 0.3);
  smallTextSize=(int)(getGridSize() * 0.2);
break;
case FONT_SIZE_MEDIUM:
normalTextSize=(int)(getGridSize() * 0.476);
smallTextSize=(int)(getGridSize() * 0.25);
break;
case FONT_SIZE_LARGE:
normalTextSize=(int)(getGridSize() * 0.7);
smallTextSize=(int)(getGridSize() * 0.35);
break;
default :
Log.e(LOGTAG,"String_Node_Str" + fontSize);
return;
}
this.fontSize=fontSize;
this.textPaint.setTextSize(normalTextSize);
this.textSmallPaint.setTextSize(smallTextSize);
Log.i(LOGTAG,"String_Node_Str" + getResources().getDisplayMetrics().xdpi + "String_Node_Str"+ getResources().getDisplayMetrics().widthPixels+ "String_Node_Str"+ fontSize+ "String_Node_Str"+ normalTextSize+ "String_Node_Str"+ smallTextSize);
}
Program: 54962
Project: 54962
Buggy source:
@Override public String getName(){
  if (hackrf != null) {
    try {
      return Hackrf.convertBoardIdToString(hackrf.getBoardID());
    }
 catch (    HackrfUsbException e) {
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getName(){
  if (name == null && hackrf != null) {
    try {
      name=Hackrf.convertBoardIdToString(hackrf.getBoardID());
    }
 catch (    HackrfUsbException e) {
    }
  }
  if (name != null)   return name;
 else   return "String_Node_Str";
}
Program: 54963
Project: 54963
Buggy source:
@Override public void setFrequency(long frequency){
  frequency+=upconverterFrequencyShift;
  if (hackrf != null) {
    try {
      hackrf.setFrequency(frequency);
    }
 catch (    HackrfUsbException e) {
      Log.e(LOGTAG,"String_Node_Str" + e.getMessage());
      reportError("String_Node_Str");
      return;
    }
  }
  this.flushQueue();
  this.frequency=frequency;
  this.iqConverter.setFrequency(frequency);
}

Fixed version (ground truth):
@Override public void setFrequency(long frequency){
  long actualFrequency=frequency - frequencyShift;
  if (hackrf != null) {
    try {
      hackrf.setFrequency(actualFrequency);
    }
 catch (    HackrfUsbException e) {
      Log.e(LOGTAG,"String_Node_Str" + e.getMessage());
      reportError("String_Node_Str");
      return;
    }
  }
  this.flushQueue();
  this.frequency=actualFrequency;
  this.iqConverter.setFrequency(frequency);
}
Program: 54964
Project: 54964
Buggy source:
@Override public long getMinFrequency(){
  return MIN_FREQUENCY - upconverterFrequencyShift;
}

Fixed version (ground truth):
@Override public long getMinFrequency(){
  return MIN_FREQUENCY + frequencyShift;
}
Program: 54965
Project: 54965
Buggy source:
@Override public long getFrequency(){
  return frequency - upconverterFrequencyShift;
}

Fixed version (ground truth):
@Override public long getFrequency(){
  return frequency + frequencyShift;
}
Program: 54966
Project: 54966
Buggy source:
@Override public long getMaxFrequency(){
  return MAX_FREQUENCY - upconverterFrequencyShift;
}

Fixed version (ground truth):
@Override public long getMaxFrequency(){
  return MAX_FREQUENCY + frequencyShift;
}
Program: 54967
Project: 54967
Buggy source:
@Override public void onUpdateSquelchSatisfied(boolean squelchSatisfied){
  scheduler.setSquelchSatisfied(squelchSatisfied);
}

Fixed version (ground truth):
@Override public void onUpdateSquelchSatisfied(boolean squelchSatisfied){
  if (scheduler != null)   scheduler.setSquelchSatisfied(squelchSatisfied);
}
Program: 54968
Project: 54968
Buggy source:
/** 
 * Called by the analyzer surface after the user changed the channel width
 * @param newChannelWidth    new channel width (single sided) in Hz
 * @return true if channel width is valid; false if out of range
 */
@Override public boolean onUpdateChannelWidth(int newChannelWidth){
  return demodulator.setChannelWidth(newChannelWidth);
}

Fixed version (ground truth):
/** 
 * Called by the analyzer surface after the user changed the channel width
 * @param newChannelWidth    new channel width (single sided) in Hz
 * @return true if channel width is valid; false if out of range
 */
@Override public boolean onUpdateChannelWidth(int newChannelWidth){
  if (demodulator != null)   return demodulator.setChannelWidth(newChannelWidth);
 else   return false;
}
Program: 54970
Project: 54970
Buggy source:
@Override public void onUpdateChannelFrequency(long newChannelFrequency){
  scheduler.setChannelFrequency(newChannelFrequency);
}

Fixed version (ground truth):
@Override public void onUpdateChannelFrequency(long newChannelFrequency){
  if (scheduler != null)   scheduler.setChannelFrequency(newChannelFrequency);
}
Program: 54972
Project: 54972
Buggy source:
@Override public void setFrequency(long frequency){
  frequency+=upconverterFrequencyShift;
  if (isOpen()) {
    if (frequency < getMinFrequency() || frequency > getMaxFrequency()) {
      Log.e(LOGTAG,"String_Node_Str" + frequency + "String_Node_Str"+ upconverterFrequencyShift+ "String_Node_Str");
      return;
    }
    commandThread.executeFrequencyChangeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_FREQUENCY,(int)frequency));
  }
  this.flushQueue();
  this.frequency=frequency;
  this.iqConverter.setFrequency(frequency);
}

Fixed version (ground truth):
@Override public void setFrequency(long frequency){
  long actualSourceFrequency=frequency - frequencyShift;
  if (isOpen()) {
    if (actualSourceFrequency < getMinFrequency() || actualSourceFrequency > getMaxFrequency()) {
      Log.e(LOGTAG,"String_Node_Str" + frequency + "String_Node_Str"+ frequencyShift+ "String_Node_Str");
      return;
    }
    commandThread.executeFrequencyChangeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_FREQUENCY,(int)actualSourceFrequency));
  }
  this.flushQueue();
  this.frequency=actualSourceFrequency;
  this.iqConverter.setFrequency(frequency);
}
Program: 54973
Project: 54973
Buggy source:
@Override public long getMinFrequency(){
  return MIN_FREQUENCY[tuner] - upconverterFrequencyShift;
}

Fixed version (ground truth):
@Override public long getMinFrequency(){
  return MIN_FREQUENCY[tuner] + frequencyShift;
}
Program: 54974
Project: 54974
Buggy source:
@Override public long getMaxFrequency(){
  return MAX_FREQUENCY[tuner] - upconverterFrequencyShift;
}

Fixed version (ground truth):
@Override public long getMaxFrequency(){
  return MAX_FREQUENCY[tuner] + frequencyShift;
}
Program: 54976
Project: 54976
Buggy source:
@Override public long getFrequency(){
  return frequency - upconverterFrequencyShift;
}

Fixed version (ground truth):
@Override public long getFrequency(){
  return frequency + frequencyShift;
}
Program: 54978
Project: 54978
Buggy source:
@Override public void setFrequency(long frequency){
  long actualSourceFrequency=frequency - frequencyShift;
  if (isOpen()) {
    if (actualSourceFrequency < getMinFrequency() || actualSourceFrequency > getMaxFrequency()) {
      Log.e(LOGTAG,"String_Node_Str" + frequency + "String_Node_Str"+ frequencyShift+ "String_Node_Str");
      return;
    }
    commandThread.executeFrequencyChangeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_FREQUENCY,(int)actualSourceFrequency));
  }
  this.flushQueue();
  this.frequency=actualSourceFrequency;
  this.iqConverter.setFrequency(frequency);
}

Fixed version (ground truth):
@Override public void setFrequency(long frequency){
  long actualSourceFrequency=frequency - frequencyShift;
  if (isOpen()) {
    if (frequency < getMinFrequency() || frequency > getMaxFrequency()) {
      Log.e(LOGTAG,"String_Node_Str" + frequency + "String_Node_Str"+ frequencyShift+ "String_Node_Str");
      return;
    }
    commandThread.executeFrequencyChangeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_FREQUENCY,(int)actualSourceFrequency));
  }
  this.flushQueue();
  this.frequency=actualSourceFrequency;
  this.iqConverter.setFrequency(frequency);
}
Program: 54979
Project: 54979
Buggy source:
@Override public void run(){
  SamplePacket inputSamples=null;
  SamplePacket audioBuffer=null;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  audioSink.start();
  decimator.start();
  while (!stopRequested) {
    inputSamples=decimator.getDecimatedPacket(1000);
    if (inputSamples == null) {
      continue;
    }
    applyUserFilter(inputSamples,quadratureSamples);
    decimator.returnDecimatedPacket(inputSamples);
    audioBuffer=audioSink.getPacketBuffer(1000);
switch (demodulationMode) {
case DEMODULATION_OFF:
      break;
case DEMODULATION_AM:
    demodulateAM(quadratureSamples,audioBuffer);
  break;
case DEMODULATION_NFM:
demodulateFM(quadratureSamples,audioBuffer,5000);
break;
case DEMODULATION_WFM:
demodulateFM(quadratureSamples,audioBuffer,75000);
break;
case DEMODULATION_LSB:
demodulateSSB(quadratureSamples,audioBuffer,false);
break;
case DEMODULATION_USB:
demodulateSSB(quadratureSamples,audioBuffer,true);
break;
default :
Log.e(LOGTAG,"String_Node_Str" + demodulationMode);
}
audioSink.enqueuePacket(audioBuffer);
}
audioSink.stopSink();
decimator.stopDecimator();
this.stopRequested=true;
Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  SamplePacket inputSamples=null;
  SamplePacket audioBuffer=null;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  audioSink.start();
  decimator.start();
  while (!stopRequested) {
    inputSamples=decimator.getDecimatedPacket(1000);
    if (inputSamples == null) {
      continue;
    }
    applyUserFilter(inputSamples,quadratureSamples);
    decimator.returnDecimatedPacket(inputSamples);
    audioBuffer=audioSink.getPacketBuffer(1000);
    if (audioBuffer == null) {
      Log.d(LOGTAG,"String_Node_Str");
      continue;
    }
switch (demodulationMode) {
case DEMODULATION_OFF:
      break;
case DEMODULATION_AM:
    demodulateAM(quadratureSamples,audioBuffer);
  break;
case DEMODULATION_NFM:
demodulateFM(quadratureSamples,audioBuffer,5000);
break;
case DEMODULATION_WFM:
demodulateFM(quadratureSamples,audioBuffer,75000);
break;
case DEMODULATION_LSB:
demodulateSSB(quadratureSamples,audioBuffer,false);
break;
case DEMODULATION_USB:
demodulateSSB(quadratureSamples,audioBuffer,true);
break;
default :
Log.e(LOGTAG,"String_Node_Str" + demodulationMode);
}
audioSink.enqueuePacket(audioBuffer);
}
audioSink.stopSink();
decimator.stopDecimator();
this.stopRequested=true;
Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}
Program: 54980
Project: 54980
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case RTL2832U_RESULT_CODE:
    if (resultCode == RESULT_OK)     Log.i(LOGTAG,"String_Node_Str");
 else {
      String[] errInfo={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      int errorId=data.getIntExtra("String_Node_Str",-1);
      int exceptionCode=data.getIntExtra("String_Node_Str",0);
      String detailedDescription=data.getStringExtra("String_Node_Str");
      String errorMsg="String_Node_Str";
      if (errorId >= 0 && errorId < errInfo.length)       errorMsg=errInfo[errorId];
      Log.e(LOGTAG,"String_Node_Str" + errorMsg + "String_Node_Str"+ errorId+ "String_Node_Str");
      if (source != null && source instanceof RtlsdrSource) {
        Toast.makeText(MainActivity.this,"String_Node_Str" + source.getName() + "String_Node_Str"+ errorMsg+ "String_Node_Str"+ errorId+ "String_Node_Str"+ (detailedDescription != null ? "String_Node_Str" + detailedDescription + "String_Node_Str"+ exceptionCode+ "String_Node_Str" : "String_Node_Str"),Toast.LENGTH_LONG).show();
        source.close();
      }
    }
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case RTL2832U_RESULT_CODE:
    if (resultCode == RESULT_OK)     Log.i(LOGTAG,"String_Node_Str");
 else {
      String[] errInfo={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      int errorId=data.getIntExtra("String_Node_Str",-1);
      int exceptionCode=data.getIntExtra("String_Node_Str",0);
      String detailedDescription=data.getStringExtra("String_Node_Str");
      String errorMsg="String_Node_Str";
      if (errorId >= 0 && errorId < errInfo.length)       errorMsg=errInfo[errorId];
      Log.e(LOGTAG,"String_Node_Str" + errorMsg + "String_Node_Str"+ errorId+ "String_Node_Str");
      try {
        if (source != null && source instanceof RtlsdrSource) {
          Toast.makeText(MainActivity.this,"String_Node_Str" + source.getName() + "String_Node_Str"+ errorMsg+ "String_Node_Str"+ errorId+ "String_Node_Str"+ (detailedDescription != null ? "String_Node_Str" + detailedDescription + "String_Node_Str"+ exceptionCode+ "String_Node_Str" : "String_Node_Str"),Toast.LENGTH_LONG).show();
          source.close();
        }
      }
 catch (      NullPointerException e) {
        Log.e(LOGTAG,"String_Node_Str");
      }
    }
}
}
Program: 54981
Project: 54981
Buggy source:
@Override public void onIQSourceError(final IQSourceInterface source,final String message){
  this.runOnUiThread(new Runnable(){
    @Override public void run(){
      Toast.makeText(MainActivity.this,"String_Node_Str" + source.getName() + "String_Node_Str"+ message,Toast.LENGTH_LONG).show();
    }
  }
);
  stopAnalyzer();
  if (this.source != null && this.source.isOpen())   this.source.close();
  this.source=null;
}

Fixed version (ground truth):
@Override public void onIQSourceError(final IQSourceInterface source,final String message){
  this.runOnUiThread(new Runnable(){
    @Override public void run(){
      Toast.makeText(MainActivity.this,"String_Node_Str" + source.getName() + "String_Node_Str"+ message,Toast.LENGTH_LONG).show();
    }
  }
);
  stopAnalyzer();
  try {
    if (this.source != null && this.source.isOpen())     this.source.close();
  }
 catch (  NullPointerException e) {
    Log.e(LOGTAG,"String_Node_Str");
  }
  this.source=null;
  analyzerSurface.setSource(null);
}
Program: 54982
Project: 54982
Buggy source:
@Override public void setSampleRate(int sampleRate){
  if (isOpen()) {
    if (sampleRate < getMinSampleRate() || sampleRate > getMaxSampleRate()) {
      Log.e(LOGTAG,"String_Node_Str" + sampleRate);
      return;
    }
    if (!commandThread.executeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_SAMPLERATE,sampleRate))) {
      Log.e(LOGTAG,"String_Node_Str");
    }
  }
  this.sampleRate=sampleRate;
}

Fixed version (ground truth):
@Override public void setSampleRate(int sampleRate){
  if (isOpen()) {
    if (sampleRate < getMinSampleRate() || sampleRate > getMaxSampleRate()) {
      Log.e(LOGTAG,"String_Node_Str" + sampleRate);
      return;
    }
    if (!commandThread.executeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_SAMPLERATE,sampleRate))) {
      Log.e(LOGTAG,"String_Node_Str");
    }
  }
  this.flushQueue();
  this.sampleRate=sampleRate;
}
Program: 54983
Project: 54983
Buggy source:
public void run(){
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  byte[] nextCommand=null;
  if (connect(10000)) {
    callback.onIQSourceReady(RtlsdrSource.this);
  }
 else {
    Log.e(LOGTAG,"String_Node_Str");
    reportError("String_Node_Str");
    stopRequested=true;
  }
  while (!stopRequested && outputStream != null) {
    try {
      nextCommand=commandQueue.poll(1000,TimeUnit.MILLISECONDS);
      if (nextCommand == null)       continue;
      outputStream.write(nextCommand);
      Log.d(LOGTAG,"String_Node_Str" + COMMAND_NAME[nextCommand[0]]);
    }
 catch (    IOException e) {
      Log.e(LOGTAG,"String_Node_Str" + COMMAND_NAME[nextCommand[0]] + "String_Node_Str"+ e.getMessage());
      reportError("String_Node_Str" + COMMAND_NAME[nextCommand[0]]);
      break;
    }
catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str" + COMMAND_NAME[nextCommand[0]] + "String_Node_Str");
      reportError("String_Node_Str" + COMMAND_NAME[nextCommand[0]]);
      break;
    }
  }
  if (socket != null) {
    try {
      socket.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  socket=null;
  inputStream=null;
  outputStream=null;
  RtlsdrSource.this.commandThread=null;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  threadName=this.getName();
  byte[] nextCommand=null;
  if (connect(10000)) {
    callback.onIQSourceReady(RtlsdrSource.this);
  }
 else {
    Log.e(LOGTAG,"String_Node_Str");
    reportError("String_Node_Str");
    stopRequested=true;
  }
  while (!stopRequested && outputStream != null) {
    try {
      nextCommand=commandQueue.poll(1000,TimeUnit.MILLISECONDS);
      if (nextCommand == null)       continue;
      outputStream.write(nextCommand);
      Log.d(LOGTAG,"String_Node_Str" + COMMAND_NAME[nextCommand[0]]);
    }
 catch (    IOException e) {
      Log.e(LOGTAG,"String_Node_Str" + COMMAND_NAME[nextCommand[0]] + "String_Node_Str"+ e.getMessage());
      reportError("String_Node_Str" + COMMAND_NAME[nextCommand[0]]);
      break;
    }
catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str" + COMMAND_NAME[nextCommand[0]] + "String_Node_Str");
      reportError("String_Node_Str" + COMMAND_NAME[nextCommand[0]]);
      break;
    }
  }
  if (socket != null) {
    try {
      socket.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  socket=null;
  inputStream=null;
  outputStream=null;
  RtlsdrSource.this.commandThread=null;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}
Program: 54984
Project: 54984
Buggy source:
@Override public void setFrequency(long frequency){
  if (isOpen()) {
    if (frequency < getMinFrequency() || frequency > getMaxFrequency()) {
      Log.e(LOGTAG,"String_Node_Str" + frequency);
      return;
    }
    if (!commandThread.executeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_FREQUENCY,(int)frequency))) {
      Log.e(LOGTAG,"String_Node_Str");
    }
  }
  this.frequency=frequency;
}

Fixed version (ground truth):
@Override public void setFrequency(long frequency){
  if (isOpen()) {
    if (frequency < getMinFrequency() || frequency > getMaxFrequency()) {
      Log.e(LOGTAG,"String_Node_Str" + frequency);
      return;
    }
    if (!commandThread.executeCommand(commandToByteArray(RTL_TCP_COMMAND_SET_FREQUENCY,(int)frequency))) {
      Log.e(LOGTAG,"String_Node_Str");
    }
  }
  this.flushQueue();
  this.frequency=frequency;
}
Program: 54985
Project: 54985
Buggy source:
@Override public void stopSampling(){
  if (receiverThread != null) {
    receiverThread.stopReceiving();
    try {
      receiverThread.join();
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str" + e.getMessage());
    }
    receiverThread=null;
  }
}

Fixed version (ground truth):
@Override public void stopSampling(){
  if (receiverThread != null) {
    receiverThread.stopReceiving();
    if (Thread.currentThread().getName().equals(receiverThread.threadName)) {
      try {
        receiverThread.join();
      }
 catch (      InterruptedException e) {
        Log.e(LOGTAG,"String_Node_Str" + e.getMessage());
      }
    }
    receiverThread=null;
  }
}
Program: 54986
Project: 54986
Buggy source:
@Override public boolean close(){
  if (receiverThread != null)   stopSampling();
  if (commandThread != null) {
    commandThread.stopCommandThread();
    try {
      commandThread.join();
    }
 catch (    InterruptedException e) {
    }
    commandThread=null;
  }
  this.tuner=0;
  this.magic=null;
  this.name="String_Node_Str";
  callback=null;
  return true;
}

Fixed version (ground truth):
@Override public boolean close(){
  if (receiverThread != null)   stopSampling();
  if (commandThread != null) {
    commandThread.stopCommandThread();
    if (Thread.currentThread().getName().equals(commandThread.threadName)) {
      try {
        commandThread.join();
      }
 catch (      InterruptedException e) {
      }
    }
    commandThread=null;
  }
  this.tuner=0;
  this.magic=null;
  this.name="String_Node_Str";
  return true;
}
Program: 54988
Project: 54988
Buggy source:
@Override public boolean onScroll(MotionEvent e1,MotionEvent e2,float distanceX,float distanceY){
  if (source != null) {
    virtualFrequency=Math.min(Math.max(virtualFrequency + (long)(((virtualSampleRate / (float)width) * distanceX)),source.getMinFrequency() - source.getSampleRate() / 2),source.getMaxFrequency() + source.getSampleRate() / 2);
    if (virtualFrequency <= 0)     virtualFrequency=1;
    if (verticalScrollEnabled) {
      float yDiff=(maxDB - minDB) * (distanceY / (float)getFftHeight());
      if (maxDB - yDiff > MAX_DB)       yDiff=MAX_DB - maxDB;
      if (minDB - yDiff < MIN_DB)       yDiff=MIN_DB - minDB;
      this.setDBScale(minDB - yDiff,maxDB - yDiff);
    }
    if (source.getFrequency() + source.getSampleRate() / 2 < virtualFrequency + virtualSampleRate / 3 || source.getFrequency() - source.getSampleRate() / 2 > virtualFrequency - virtualSampleRate / 3) {
      if (virtualFrequency >= source.getMinFrequency() && virtualFrequency <= source.getMaxFrequency())       source.setFrequency(virtualFrequency);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onScroll(MotionEvent e1,MotionEvent e2,float distanceX,float distanceY){
  if (source != null) {
    virtualFrequency=Math.min(Math.max(virtualFrequency + (long)(((virtualSampleRate / (float)width) * distanceX)),source.getMinFrequency() - source.getSampleRate() / 2),source.getMaxFrequency() + source.getSampleRate() / 2);
    if (virtualFrequency <= 0)     virtualFrequency=1;
    if (verticalScrollEnabled) {
      float yDiff=(maxDB - minDB) * (distanceY / (float)getFftHeight());
      if (maxDB - yDiff > MAX_DB)       yDiff=MAX_DB - maxDB;
      if (minDB - yDiff < MIN_DB)       yDiff=MIN_DB - minDB;
      this.setDBScale(minDB - yDiff,maxDB - yDiff);
    }
    if (source.getFrequency() + source.getSampleRate() / 2 < virtualFrequency + virtualSampleRate / 2 || source.getFrequency() - source.getSampleRate() / 2 > virtualFrequency - virtualSampleRate / 2) {
      if (virtualFrequency >= source.getMinFrequency() && virtualFrequency <= source.getMaxFrequency())       source.setFrequency(virtualFrequency);
    }
  }
  return true;
}
Program: 54989
Project: 54989
Buggy source:
@Override public void run(){
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  long startTime;
  long sleepTime;
  long frequency;
  int sampleRate;
  while (!stopRequested) {
    startTime=System.currentTimeMillis();
    SamplePacket samples;
    try {
      samples=inputQueue.poll(1000 / frameRate,TimeUnit.MILLISECONDS);
      if (samples == null) {
        Log.d(LOGTAG,"String_Node_Str");
        continue;
      }
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      this.stopLoop();
      break;
    }
    frequency=samples.getFrequency();
    sampleRate=samples.getSampleRate();
    this.doProcessing(samples);
    returnQueue.offer(samples);
    view.draw(mag,frequency,sampleRate,frameRate,load);
    sleepTime=(1000 / frameRate) - (System.currentTimeMillis() - startTime);
    try {
      if (sleepTime > 0) {
        load=(System.currentTimeMillis() - startTime) / (1000.0 / frameRate);
        if (dynamicFrameRate && load < LOW_THRESHOLD && frameRate < MAX_FRAMERATE)         frameRate++;
        if (dynamicFrameRate && load > HIGH_THRESHOLD && frameRate > 1)         frameRate--;
        sleep(sleepTime);
      }
 else {
        if (dynamicFrameRate && frameRate > 1)         frameRate--;
        Log.w(LOGTAG,"String_Node_Str");
        load=1;
      }
    }
 catch (    Exception e) {
      Log.e(LOGTAG,"String_Node_Str");
    }
  }
  this.stopRequested=true;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  long startTime;
  long sleepTime;
  long frequency;
  int sampleRate;
  while (!stopRequested) {
    startTime=System.currentTimeMillis();
    SamplePacket samples;
    try {
      samples=inputQueue.poll(1000 / frameRate,TimeUnit.MILLISECONDS);
      if (samples == null) {
        Log.d(LOGTAG,"String_Node_Str");
        continue;
      }
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      this.stopLoop();
      break;
    }
    frequency=samples.getFrequency();
    sampleRate=samples.getSampleRate();
    this.doProcessing(samples);
    returnQueue.offer(samples);
    view.draw(mag,frequency,sampleRate,frameRate,load);
    sleepTime=(1000 / frameRate) - (System.currentTimeMillis() - startTime);
    try {
      if (sleepTime > 0) {
        load=(System.currentTimeMillis() - startTime) / (1000.0 / frameRate);
        if (dynamicFrameRate && load < LOW_THRESHOLD && frameRate < MAX_FRAMERATE)         frameRate++;
        if (dynamicFrameRate && load > HIGH_THRESHOLD && frameRate > 1)         frameRate--;
        sleep(sleepTime);
      }
 else {
        if (dynamicFrameRate && frameRate > 1)         frameRate--;
        load=1;
      }
    }
 catch (    Exception e) {
      Log.e(LOGTAG,"String_Node_Str");
    }
  }
  this.stopRequested=true;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}
Program: 54991
Project: 54991
Buggy source:
@Override public boolean onDown(MotionEvent e){
  float hzPerPx=virtualSampleRate / (float)width;
  float dbPerPx=(maxDB - minDB) / (float)getFftHeight();
  float frequencyVariation=(float)Math.min(channelWidth / 2.0,virtualSampleRate / 10);
  long touchedFrequency=virtualFrequency - virtualSampleRate / 2 + (long)(e.getX() * hzPerPx);
  float touchedDB=maxDB - e.getY() * dbPerPx;
  if (demodulationEnabled && touchedFrequency < channelFrequency + channelWidth && touchedFrequency > channelFrequency - channelWidth && touchedDB < squelch + (maxDB - minDB) / 10 && touchedDB > squelch - (maxDB - minDB) / 10)   this.scrollType=SCROLLTYPE_SQUELCH;
 else   if (demodulationEnabled && e.getY() <= getFftHeight() && touchedFrequency < channelFrequency + frequencyVariation && touchedFrequency > channelFrequency - frequencyVariation)   this.scrollType=SCROLLTYPE_CHANNEL_FREQUENCY;
 else   if (demodulationEnabled && e.getY() <= getFftHeight() && touchedFrequency < channelFrequency - channelWidth + frequencyVariation && touchedFrequency > channelFrequency - channelWidth - frequencyVariation)   this.scrollType=SCROLLTYPE_CHANNEL_WIDTH_LEFT;
 else   if (demodulationEnabled && e.getY() <= getFftHeight() && touchedFrequency < channelFrequency + channelWidth + frequencyVariation && touchedFrequency > channelFrequency + channelWidth - frequencyVariation)   this.scrollType=SCROLLTYPE_CHANNEL_WIDTH_RIGHT;
 else   this.scrollType=SCROLLTYPE_NORMAL;
  return true;
}

Fixed version (ground truth):
@Override public boolean onDown(MotionEvent e){
  float hzPerPx=virtualSampleRate / (float)width;
  float dbPerPx=(maxDB - minDB) / (float)getFftHeight();
  float channelFrequencyVariation=(float)Math.max(channelWidth * 0.8f,width / 15f * hzPerPx);
  float channelWidthVariation=width / 15 * hzPerPx;
  long touchedFrequency=virtualFrequency - virtualSampleRate / 2 + (long)(e.getX() * hzPerPx);
  float touchedDB=maxDB - e.getY() * dbPerPx;
  if (demodulationEnabled && touchedFrequency < channelFrequency + channelWidth && touchedFrequency > channelFrequency - channelWidth && touchedDB < squelch + (maxDB - minDB) / 7 && touchedDB > squelch - (maxDB - minDB) / 7)   this.scrollType=SCROLLTYPE_SQUELCH;
 else   if (demodulationEnabled && e.getY() <= getFftHeight() && touchedFrequency < channelFrequency + channelFrequencyVariation && touchedFrequency > channelFrequency - channelFrequencyVariation)   this.scrollType=SCROLLTYPE_CHANNEL_FREQUENCY;
 else   if (demodulationEnabled && e.getY() <= getFftHeight() && touchedFrequency < channelFrequency - channelWidth + channelWidthVariation && touchedFrequency > channelFrequency - channelWidth - channelWidthVariation)   this.scrollType=SCROLLTYPE_CHANNEL_WIDTH_LEFT;
 else   if (demodulationEnabled && e.getY() <= getFftHeight() && touchedFrequency < channelFrequency + channelWidth + channelWidthVariation && touchedFrequency > channelFrequency + channelWidth - channelWidthVariation)   this.scrollType=SCROLLTYPE_CHANNEL_WIDTH_RIGHT;
 else   this.scrollType=SCROLLTYPE_NORMAL;
  return true;
}
Program: 54992
Project: 54992
Buggy source:
/** 
 * Constructor. Will initialize the Paint instances and register the callback functions of the SurfaceHolder
 * @param context
 */
public AnalyzerSurface(Context context,CallbackInterface callbackHandler){
  super(context);
  this.callbackHandler=callbackHandler;
  this.defaultPaint=new Paint();
  this.blackPaint=new Paint();
  this.blackPaint.setColor(Color.BLACK);
  this.fftPaint=new Paint();
  this.fftPaint.setColor(Color.BLUE);
  this.fftPaint.setStyle(Paint.Style.FILL);
  this.peakHoldPaint=new Paint();
  this.peakHoldPaint.setColor(Color.YELLOW);
  this.textPaint=new Paint();
  this.textPaint.setColor(Color.WHITE);
  this.waterfallLinePaint=new Paint();
  this.demodSelectorPaint=new Paint();
  this.demodSelectorPaint.setColor(Color.WHITE);
  this.getHolder().addCallback(this);
  this.createWaterfallColorMap();
  this.scaleGestureDetector=new ScaleGestureDetector(context,this);
  this.gestureDetector=new GestureDetector(context,this);
}

Fixed version (ground truth):
/** 
 * Constructor. Will initialize the Paint instances and register the callback functions of the SurfaceHolder
 * @param context
 */
public AnalyzerSurface(Context context,CallbackInterface callbackHandler){
  super(context);
  this.callbackHandler=callbackHandler;
  this.defaultPaint=new Paint();
  this.blackPaint=new Paint();
  this.blackPaint.setColor(Color.BLACK);
  this.fftPaint=new Paint();
  this.fftPaint.setColor(Color.BLUE);
  this.fftPaint.setStyle(Paint.Style.FILL);
  this.peakHoldPaint=new Paint();
  this.peakHoldPaint.setColor(Color.YELLOW);
  this.textPaint=new Paint();
  this.textPaint.setColor(Color.WHITE);
  this.waterfallLinePaint=new Paint();
  this.demodSelectorPaint=new Paint();
  this.demodSelectorPaint.setColor(Color.WHITE);
  this.squelchPaint=new Paint();
  this.squelchPaint.setColor(Color.RED);
  this.getHolder().addCallback(this);
  this.createWaterfallColorMap();
  this.scaleGestureDetector=new ScaleGestureDetector(context,this);
  this.gestureDetector=new GestureDetector(context,this);
}
Program: 54993
Project: 54993
Buggy source:
public void setDemodulationEnabled(boolean demodulationEnabled){
synchronized (this.getHolder()) {
    if (demodulationEnabled) {
      this.virtualSampleRate=(int)(source.getSampleRate() * 0.9);
      source.setFrequency(virtualFrequency);
      if (channelFrequency < virtualFrequency - virtualSampleRate / 2 || channelFrequency > virtualFrequency + virtualSampleRate / 2) {
        this.channelFrequency=virtualFrequency;
        callbackHandler.onUpdateChannelFrequency(channelFrequency);
      }
      this.channelWidth=callbackHandler.onCurrentChannelWidthRequested();
      if (squelch < minDB || squelch > maxDB) {
        this.squelch=minDB + (maxDB - minDB) / 4;
        callbackHandler.onUpdateSquelch(squelch);
      }
    }
    this.demodulationEnabled=demodulationEnabled;
  }
}

Fixed version (ground truth):
public void setDemodulationEnabled(boolean demodulationEnabled){
synchronized (this.getHolder()) {
    if (demodulationEnabled) {
      if (virtualSampleRate > source.getSampleRate() * 0.9)       this.virtualSampleRate=(int)(source.getSampleRate() * 0.9);
      if (virtualFrequency - virtualSampleRate / 2 < source.getFrequency() - source.getSampleRate() / 2 || virtualFrequency + virtualSampleRate / 2 > source.getFrequency() + source.getSampleRate() / 2)       source.setFrequency(virtualFrequency);
      if (channelFrequency < virtualFrequency - virtualSampleRate / 2 || channelFrequency > virtualFrequency + virtualSampleRate / 2) {
        this.channelFrequency=virtualFrequency;
        callbackHandler.onUpdateChannelFrequency(channelFrequency);
      }
      if (!callbackHandler.onUpdateChannelWidth(channelWidth))       this.channelWidth=callbackHandler.onCurrentChannelWidthRequested();
      if (squelch < minDB || squelch > maxDB) {
        this.squelch=minDB + (maxDB - minDB) / 4;
      }
      callbackHandler.onUpdateSquelchSatisfied(squelchSatisfied);
    }
    this.demodulationEnabled=demodulationEnabled;
  }
}
Program: 54994
Project: 54994
Buggy source:
/** 
 * Returns height (in pixel) of each line in the waterfall plot
 * @return number of pixels (in vertical direction) of one line in the waterfall plot
 */
private int getPixelPerWaterfallLine(){
  return 3;
}

Fixed version (ground truth):
/** 
 * Returns height (in pixel) of each line in the waterfall plot
 * @return number of pixels (in vertical direction) of one line in the waterfall plot
 */
private int getPixelPerWaterfallLine(){
  return 1;
}
Program: 54997
Project: 54997
Buggy source:
/** 
 * This method will draw the performance information into the canvas
 * @param c				canvas of the surface view
 * @param frameRate 	current frame rate (FPS)
 * @param load			current load (percentage [0..1])
 */
private void drawPerformanceInfo(Canvas c,int frameRate,double load){
  Rect bounds=new Rect();
  String text;
  text=frameRate + "String_Node_Str";
  textPaint.getTextBounds(text,0,text.length(),bounds);
  c.drawText(text,width - bounds.width(),bounds.height(),textPaint);
  text=String.format("String_Node_Str",load * 100);
  textPaint.getTextBounds(text,0,text.length(),bounds);
  c.drawText(text,width - bounds.width(),bounds.height() * 2,textPaint);
}

Fixed version (ground truth):
/** 
 * This method will draw the performance information into the canvas
 * @param c				canvas of the surface view
 * @param frameRate 	current frame rate (FPS)
 * @param load			current load (percentage [0..1])
 * @param averageSignalStrength		average magnitude of the signal in the selected channel
 */
private void drawPerformanceInfo(Canvas c,int frameRate,double load,float averageSignalStrength){
  Rect bounds=new Rect();
  String text;
  float yPos=height * 0.01f;
  float rightBorder=width * 0.99f;
  if (demodulationEnabled) {
    text=String.format("String_Node_Str",averageSignalStrength);
    textPaint.getTextBounds(text,0,text.length(),bounds);
    float indicatorWidth=width / 10;
    float indicatorPosX=rightBorder - indicatorWidth;
    float indicatorPosY=yPos + bounds.height();
    float squelchTickPos=(squelch - minDB) / (maxDB - minDB) * indicatorWidth;
    float signalWidth=(averageSignalStrength - minDB) / (maxDB - minDB) * indicatorWidth;
    if (signalWidth < 0)     signalWidth=0;
    if (signalWidth > indicatorWidth)     signalWidth=indicatorWidth;
    c.drawRect(indicatorPosX,yPos + bounds.height() * 0.1f,indicatorPosX + signalWidth,indicatorPosY,squelchPaint);
    c.drawLine(indicatorPosX,indicatorPosY,indicatorPosX,yPos,textPaint);
    c.drawLine(rightBorder,indicatorPosY,rightBorder,yPos,textPaint);
    c.drawLine(indicatorPosX,indicatorPosY,rightBorder,indicatorPosY,textPaint);
    c.drawLine(indicatorPosX + squelchTickPos,indicatorPosY + 2,indicatorPosX + squelchTickPos,yPos + bounds.height() * 0.5f,textPaint);
    c.drawText(text,indicatorPosX - bounds.width() * 1.1f,indicatorPosY,textPaint);
    yPos+=bounds.height() * 1.1f;
  }
  text=frameRate + "String_Node_Str";
  textPaint.getTextBounds(text,0,text.length(),bounds);
  c.drawText(text,rightBorder - bounds.width(),yPos + bounds.height(),textPaint);
  yPos+=bounds.height() * 1.1f;
  text=String.format("String_Node_Str",load * 100);
  textPaint.getTextBounds(text,0,text.length(),bounds);
  c.drawText(text,rightBorder - bounds.width(),yPos + bounds.height(),textPaint);
  yPos+=bounds.height() * 1.1f;
}
Program: 55000
Project: 55000
Buggy source:
@Override public void run(){
  SamplePacket packet;
  SamplePacket filteredPacket=new SamplePacket(packetSize);
  double[] doublePacket;
  short[] shortPacket=new short[packetSize];
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  audioTrack.play();
  while (!stopRequested) {
    try {
      packet=inputQueue.poll(1000,TimeUnit.MILLISECONDS);
      if (packet == null) {
        Log.d(LOGTAG,"String_Node_Str");
        continue;
      }
      applyAudioFilter(packet,filteredPacket);
      doublePacket=filteredPacket.re();
      for (int i=0; i < filteredPacket.size(); i++) {
        shortPacket[i]=(short)(doublePacket[i] * 32767);
      }
      if (audioTrack.write(shortPacket,0,filteredPacket.size()) != filteredPacket.size()) {
        Log.e(LOGTAG,"String_Node_Str");
        stopRequested=true;
      }
      outputQueue.offer(packet);
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      stopRequested=true;
    }
  }
  audioTrack.stop();
  this.stopRequested=true;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  SamplePacket packet;
  SamplePacket filteredPacket=new SamplePacket(packetSize);
  double[] doublePacket;
  short[] shortPacket=new short[packetSize];
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  audioTrack.play();
  while (!stopRequested) {
    try {
      packet=inputQueue.poll(1000,TimeUnit.MILLISECONDS);
      if (packet == null) {
        continue;
      }
      applyAudioFilter(packet,filteredPacket);
      doublePacket=filteredPacket.re();
      for (int i=0; i < filteredPacket.size(); i++) {
        shortPacket[i]=(short)(doublePacket[i] * 32767);
      }
      if (audioTrack.write(shortPacket,0,filteredPacket.size()) != filteredPacket.size()) {
        Log.e(LOGTAG,"String_Node_Str");
        stopRequested=true;
      }
      outputQueue.offer(packet);
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      stopRequested=true;
    }
  }
  audioTrack.stop();
  this.stopRequested=true;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}
Program: 55001
Project: 55001
Buggy source:
@Override public void run(){
  SamplePacket inputSamples;
  SamplePacket outputSamples;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  while (!stopRequested) {
    try {
      inputSamples=inputQueue.poll(1000,TimeUnit.MILLISECONDS);
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      this.stopRequested=true;
      break;
    }
    if (inputSamples == null) {
      Log.d(LOGTAG,"String_Node_Str");
      continue;
    }
    if (inputSamples.getSampleRate() != INPUT_RATE) {
      Log.d(LOGTAG,"String_Node_Str" + inputSamples.getSampleRate() + "String_Node_Str"+ INPUT_RATE+ "String_Node_Str");
      continue;
    }
    try {
      outputSamples=outputReturnQueue.poll(1000,TimeUnit.MILLISECONDS);
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      this.stopRequested=true;
      break;
    }
    if (outputSamples == null) {
      Log.d(LOGTAG,"String_Node_Str");
      continue;
    }
    downsampling(inputSamples,outputSamples);
    inputReturnQueue.offer(inputSamples);
    outputQueue.offer(outputSamples);
  }
  this.stopRequested=true;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  SamplePacket inputSamples;
  SamplePacket outputSamples;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
  while (!stopRequested) {
    try {
      inputSamples=inputQueue.poll(1000,TimeUnit.MILLISECONDS);
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      this.stopRequested=true;
      break;
    }
    if (inputSamples == null) {
      continue;
    }
    if (inputSamples.getSampleRate() != INPUT_RATE) {
      Log.d(LOGTAG,"String_Node_Str" + inputSamples.getSampleRate() + "String_Node_Str"+ INPUT_RATE+ "String_Node_Str");
      continue;
    }
    try {
      outputSamples=outputReturnQueue.poll(1000,TimeUnit.MILLISECONDS);
    }
 catch (    InterruptedException e) {
      Log.e(LOGTAG,"String_Node_Str");
      this.stopRequested=true;
      break;
    }
    if (outputSamples == null) {
      Log.d(LOGTAG,"String_Node_Str");
      continue;
    }
    downsampling(inputSamples,outputSamples);
    inputReturnQueue.offer(inputSamples);
    outputQueue.offer(outputSamples);
  }
  this.stopRequested=true;
  Log.i(LOGTAG,"String_Node_Str" + this.getName() + "String_Node_Str");
}