Program: 198315
Project: 198315
Buggy source:
protected void onIntentSelected(ResolveInfo ri,Intent intent,boolean alwaysCheck){
  if ((mAlwaysUseOption || mAdapter.hasFilteredItem()) && mAdapter.mOrigResolveList != null) {
    IntentFilter filter=new IntentFilter();
    if (intent.getAction() != null) {
      filter.addAction(intent.getAction());
    }
    Set<String> categories=intent.getCategories();
    if (categories != null) {
      for (      String cat : categories) {
        filter.addCategory(cat);
      }
    }
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    int cat=ri.match & IntentFilter.MATCH_CATEGORY_MASK;
    Uri data=intent.getData();
    if (cat == IntentFilter.MATCH_CATEGORY_TYPE) {
      String mimeType=intent.resolveType(this);
      if (mimeType != null) {
        try {
          filter.addDataType(mimeType);
        }
 catch (        IntentFilter.MalformedMimeTypeException e) {
          Log.w("String_Node_Str",e);
          filter=null;
        }
      }
    }
    if (data != null && data.getScheme() != null) {
      if (cat != IntentFilter.MATCH_CATEGORY_TYPE || (!"String_Node_Str".equals(data.getScheme()) && !"String_Node_Str".equals(data.getScheme()))) {
        filter.addDataScheme(data.getScheme());
        Iterator<PatternMatcher> pIt=ri.filter.schemeSpecificPartsIterator();
        if (pIt != null) {
          String ssp=data.getSchemeSpecificPart();
          while (ssp != null && pIt.hasNext()) {
            PatternMatcher p=pIt.next();
            if (p.match(ssp)) {
              filter.addDataSchemeSpecificPart(p.getPath(),p.getType());
              break;
            }
          }
        }
        Iterator<IntentFilter.AuthorityEntry> aIt=ri.filter.authoritiesIterator();
        if (aIt != null) {
          while (aIt.hasNext()) {
            IntentFilter.AuthorityEntry a=aIt.next();
            if (a.match(data) >= 0) {
              int port=a.getPort();
              filter.addDataAuthority(a.getHost(),port >= 0 ? Integer.toString(port) : null);
              break;
            }
          }
        }
        pIt=ri.filter.pathsIterator();
        if (pIt != null) {
          String path=data.getPath();
          while (path != null && pIt.hasNext()) {
            PatternMatcher p=pIt.next();
            if (p.match(path)) {
              filter.addDataPath(p.getPath(),p.getType());
              break;
            }
          }
        }
      }
    }
    if (filter != null) {
      final int N=mAdapter.mOrigResolveList.size();
      ComponentName[] set=new ComponentName[N];
      int bestMatch=0;
      for (int i=0; i < N; i++) {
        ResolveInfo r=mAdapter.mOrigResolveList.get(i);
        set[i]=new ComponentName(r.activityInfo.packageName,r.activityInfo.name);
        if (r.match > bestMatch)         bestMatch=r.match;
      }
      if (alwaysCheck) {
        getPackageManager().addPreferredActivity(filter,bestMatch,set,intent.getComponent());
      }
 else {
        try {
          AppGlobals.getPackageManager().setLastChosenActivity(intent,intent.resolveTypeIfNeeded(getContentResolver()),PackageManager.MATCH_DEFAULT_ONLY,filter,bestMatch,intent.getComponent());
        }
 catch (        RemoteException re) {
          Log.d(TAG,"String_Node_Str" + re);
        }
      }
    }
  }
  if (intent != null) {
    startActivity(intent);
  }
}

Fixed version (ground truth):
protected void onIntentSelected(ResolveInfo ri,Intent intent,boolean alwaysCheck){
  if ((mAlwaysUseOption || mAdapter.hasFilteredItem()) && mAdapter.mOrigResolveList != null) {
    IntentFilter filter=new IntentFilter();
    if (intent.getAction() != null) {
      filter.addAction(intent.getAction());
    }
    Set<String> categories=intent.getCategories();
    if (categories != null) {
      for (      String cat : categories) {
        filter.addCategory(cat);
      }
    }
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    int cat=ri.match & IntentFilter.MATCH_CATEGORY_MASK;
    Uri data=intent.getData();
    if (cat == IntentFilter.MATCH_CATEGORY_TYPE) {
      String mimeType=intent.resolveType(this);
      if (mimeType != null) {
        try {
          filter.addDataType(mimeType);
        }
 catch (        IntentFilter.MalformedMimeTypeException e) {
          Log.w("String_Node_Str",e);
          filter=null;
        }
      }
    }
    if (data != null && data.getScheme() != null) {
      if (cat != IntentFilter.MATCH_CATEGORY_TYPE || (!"String_Node_Str".equals(data.getScheme()) && !"String_Node_Str".equals(data.getScheme()))) {
        filter.addDataScheme(data.getScheme());
        Iterator<PatternMatcher> pIt=ri.filter.schemeSpecificPartsIterator();
        if (pIt != null) {
          String ssp=data.getSchemeSpecificPart();
          while (ssp != null && pIt.hasNext()) {
            PatternMatcher p=pIt.next();
            if (p.match(ssp)) {
              filter.addDataSchemeSpecificPart(p.getPath(),p.getType());
              break;
            }
          }
        }
        Iterator<IntentFilter.AuthorityEntry> aIt=ri.filter.authoritiesIterator();
        if (aIt != null) {
          while (aIt.hasNext()) {
            IntentFilter.AuthorityEntry a=aIt.next();
            if (a.match(data) >= 0) {
              int port=a.getPort();
              filter.addDataAuthority(a.getHost(),port >= 0 ? Integer.toString(port) : null);
              break;
            }
          }
        }
        pIt=ri.filter.pathsIterator();
        if (pIt != null) {
          String path=data.getPath();
          while (path != null && pIt.hasNext()) {
            PatternMatcher p=pIt.next();
            if (p.match(path)) {
              filter.addDataPath(p.getPath(),p.getType());
              break;
            }
          }
        }
      }
    }
    if (filter != null) {
      final int N=mAdapter.mOrigResolveList.size();
      ComponentName[] set=new ComponentName[N];
      int bestMatch=0;
      for (int i=0; i < N; i++) {
        ResolveInfo r=mAdapter.mOrigResolveList.get(i);
        set[i]=new ComponentName(r.activityInfo.packageName,r.activityInfo.name);
        if (r.match > bestMatch)         bestMatch=r.match;
      }
      if (alwaysCheck) {
        getPackageManager().addPreferredActivity(filter,bestMatch,set,intent.getComponent());
      }
 else {
        try {
          AppGlobals.getPackageManager().setLastChosenActivity(intent,intent.resolveTypeIfNeeded(getContentResolver()),PackageManager.MATCH_DEFAULT_ONLY,filter,bestMatch,intent.getComponent());
        }
 catch (        RemoteException re) {
          Log.d(TAG,"String_Node_Str" + re);
        }
      }
    }
  }
  if (intent != null) {
    safelyStartActivity(intent);
  }
}