Program: 20149
Project: 20149
Buggy source:
@Override protected void onNewIntent(final Intent intent){
  super.onNewIntent(intent);
  new SimpleAsyncTask(){
    /** 
 * Tag
 */
    private Tag mTag;
    /** 
 * Tag comm
 */
    private IsoDep mTagcomm;
    /** 
 * Emv Card
 */
    private EMVCard mCard;
    /** 
 * Boolean to indicate exception
 */
    private boolean mException;
    @Override protected void onPreExecute(){
      super.onPreExecute();
      if (mDialog == null) {
        mDialog=ProgressDialog.show(HomeActivity.this,getString(R.string.card_reading),getString(R.string.card_reading_desc),true,false);
      }
 else {
        mDialog.show();
      }
    }
    @Override protected void doInBackground(){
      mTag=intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
      mTagcomm=IsoDep.get(mTag);
      if (mTagcomm == null) {
        display(getText(R.string.error_communication_nfc),false);
        return;
      }
      mException=false;
      try {
        mTagcomm.connect();
        IProvider prov=new Provider(mTagcomm);
        EMVParser parser=new EMVParser(prov,true);
        mCard=parser.readEmvCard();
      }
 catch (      IOException e) {
        mException=true;
      }
 finally {
        if (mTagcomm != null) {
          try {
            mTagcomm.close();
          }
 catch (          IOException e) {
          }
        }
      }
    }
    @Override protected void onPostExecute(    final Object result){
      if (mDialog != null) {
        mDialog.cancel();
      }
      if (!mException) {
        if (mCard != null && StringUtils.isNotBlank(mCard.getCardNumber())) {
          if (!mList.contains(mCard)) {
            mList.add(mCard);
            mAdapter.notifyDataSetChanged();
            display(getText(R.string.card_added),true);
          }
 else {
            display(getText(R.string.error_card_already_added),false);
          }
        }
 else {
          display(getText(R.string.error_card_unknown),false);
        }
      }
 else {
        display(getResources().getText(R.string.error_communication_nfc),false);
      }
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void onNewIntent(final Intent intent){
  super.onNewIntent(intent);
  final Tag mTag=intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
  if (mTag != null) {
    new SimpleAsyncTask(){
      /** 
 * Tag comm
 */
      private IsoDep mTagcomm;
      /** 
 * Emv Card
 */
      private EMVCard mCard;
      /** 
 * Boolean to indicate exception
 */
      private boolean mException;
      @Override protected void onPreExecute(){
        super.onPreExecute();
        if (mDialog == null) {
          mDialog=ProgressDialog.show(HomeActivity.this,getString(R.string.card_reading),getString(R.string.card_reading_desc),true,false);
        }
 else {
          mDialog.show();
        }
      }
      @Override protected void doInBackground(){
        mTagcomm=IsoDep.get(mTag);
        if (mTagcomm == null) {
          display(getText(R.string.error_communication_nfc),false);
          return;
        }
        mException=false;
        try {
          mTagcomm.connect();
          IProvider prov=new Provider(mTagcomm);
          EMVParser parser=new EMVParser(prov,true);
          mCard=parser.readEmvCard();
        }
 catch (        IOException e) {
          mException=true;
        }
 finally {
          if (mTagcomm != null) {
            try {
              mTagcomm.close();
            }
 catch (            IOException e) {
            }
          }
        }
      }
      @Override protected void onPostExecute(      final Object result){
        if (mDialog != null) {
          mDialog.cancel();
        }
        if (!mException) {
          if (mCard != null && StringUtils.isNotBlank(mCard.getCardNumber())) {
            if (!mList.contains(mCard)) {
              mList.add(mCard);
              mAdapter.notifyDataSetChanged();
              display(getText(R.string.card_added),true);
            }
 else {
              display(getText(R.string.error_card_already_added),false);
            }
          }
 else {
            display(getText(R.string.error_card_unknown),false);
          }
        }
 else {
          display(getResources().getText(R.string.error_communication_nfc),false);
        }
      }
    }
.execute();
  }
}