Program: 8239
Project: 8239
Buggy source:
private void handleSecurityTokenError(IOException e){
  if (e instanceof TagLostException) {
    onSecurityTokenError(getString(R.string.security_token_error_tag_lost));
    return;
  }
  if (e instanceof IsoDepNotSupportedException) {
    onSecurityTokenError(getString(R.string.security_token_error_iso_dep_not_supported));
    return;
  }
  short status;
  if (e instanceof CardException) {
    status=((CardException)e).getResponseCode();
  }
 else {
    status=-1;
  }
  if ((status & (short)0xFFF0) == 0x63C0) {
    int tries=status & 0x000F;
    onSecurityTokenPinError(getResources().getQuantityString(R.plurals.security_token_error_pin,tries,tries));
    return;
  }
switch (status) {
case 0x6A80:
{
      onSecurityTokenError(getString(R.string.security_token_error_bad_data));
      break;
    }
case 0x6883:
{
    onSecurityTokenError(getString(R.string.security_token_error_chaining_error));
    break;
  }
case 0x6B00:
{
  onSecurityTokenError(getString(R.string.security_token_error_header,"String_Node_Str"));
  break;
}
case 0x6D00:
{
onSecurityTokenError(getString(R.string.security_token_error_header,"String_Node_Str"));
break;
}
case 0x6E00:
{
onSecurityTokenError(getString(R.string.security_token_error_header,"String_Node_Str"));
break;
}
case 0x6285:
{
onSecurityTokenError(getString(R.string.security_token_error_terminated));
break;
}
case 0x6700:
{
onSecurityTokenPinError(getString(R.string.security_token_error_wrong_length));
break;
}
case 0x6982:
{
onSecurityTokenError(getString(R.string.security_token_error_security_not_satisfied));
break;
}
case 0x6983:
{
onSecurityTokenError(getString(R.string.security_token_error_authentication_blocked));
break;
}
case 0x6985:
{
onSecurityTokenError(getString(R.string.security_token_error_conditions_not_satisfied));
break;
}
case 0x6A88:
case 0x6A83:
{
onSecurityTokenError(getString(R.string.security_token_error_data_not_found));
break;
}
case 0x6F00:
{
onSecurityTokenError(getString(R.string.security_token_error_unknown));
break;
}
case 0x6A82:
{
if (mSecurityTokenHelper.isFidesmoToken()) {
if (isAndroidAppInstalled(FIDESMO_APP_PACKAGE)) {
promptFidesmoPgpInstall();
}
 else {
promptFidesmoAppInstall();
}
}
 else {
onSecurityTokenError(getString(R.string.security_token_error_pgp_app_not_installed));
}
break;
}
default :
{
onSecurityTokenError(getString(R.string.security_token_error,e.getMessage()));
break;
}
}
}

Fixed version (ground truth):
private void handleSecurityTokenError(IOException e){
  if (e instanceof TagLostException) {
    onSecurityTokenError(getString(R.string.security_token_error_tag_lost));
    return;
  }
  if (e instanceof IsoDepNotSupportedException) {
    onSecurityTokenError(getString(R.string.security_token_error_iso_dep_not_supported));
    return;
  }
  short status;
  if (e instanceof CardException) {
    status=((CardException)e).getResponseCode();
  }
 else {
    status=-1;
  }
  if ((status & (short)0xFFF0) == 0x63C0) {
    int tries=status & 0x000F;
    onSecurityTokenPinError(getResources().getQuantityString(R.plurals.security_token_error_pin,tries,tries));
    return;
  }
switch (status) {
case 0x6982:
{
      onSecurityTokenPinError(getString(R.string.security_token_error_security_not_satisfied));
      break;
    }
case 0x6285:
{
    onSecurityTokenError(getString(R.string.security_token_error_terminated));
    break;
  }
case 0x6700:
{
  onSecurityTokenPinError(getString(R.string.security_token_error_wrong_length));
  break;
}
case 0x6A80:
{
onSecurityTokenPinError(getString(R.string.security_token_error_bad_data));
break;
}
case 0x6983:
{
onSecurityTokenError(getString(R.string.security_token_error_authentication_blocked));
break;
}
case 0x6985:
{
onSecurityTokenError(getString(R.string.security_token_error_conditions_not_satisfied));
break;
}
case 0x6A88:
case 0x6A83:
{
onSecurityTokenError(getString(R.string.security_token_error_data_not_found));
break;
}
case 0x6F00:
{
onSecurityTokenError(getString(R.string.security_token_error_unknown));
break;
}
case 0x6A82:
{
if (mSecurityTokenHelper.isFidesmoToken()) {
if (isAndroidAppInstalled(FIDESMO_APP_PACKAGE)) {
promptFidesmoPgpInstall();
}
 else {
promptFidesmoAppInstall();
}
}
 else {
onSecurityTokenError(getString(R.string.security_token_error_pgp_app_not_installed));
}
break;
}
case 0x6883:
{
onSecurityTokenError(getString(R.string.security_token_error_chaining_error));
break;
}
case 0x6B00:
{
onSecurityTokenError(getString(R.string.security_token_error_header,"String_Node_Str"));
break;
}
case 0x6D00:
{
onSecurityTokenError(getString(R.string.security_token_error_header,"String_Node_Str"));
break;
}
case 0x6E00:
{
onSecurityTokenError(getString(R.string.security_token_error_header,"String_Node_Str"));
break;
}
default :
{
onSecurityTokenError(getString(R.string.security_token_error,e.getMessage()));
break;
}
}
}