Program: 165253
Project: 165253
Buggy source:
private void startInstallConfirm(){
  final Drawable appIcon=mAppDiff.mPkgInfo.applicationInfo.loadIcon(mPm);
  final String appLabel=(String)mAppDiff.mPkgInfo.applicationInfo.loadLabel(mPm);
  View appSnippet=findViewById(R.id.app_snippet);
  ((ImageView)appSnippet.findViewById(R.id.app_icon)).setImageDrawable(appIcon);
  ((TextView)appSnippet.findViewById(R.id.app_name)).setText(appLabel);
  TabHost tabHost=(TabHost)findViewById(android.R.id.tabhost);
  tabHost.setup();
  ViewPager viewPager=(ViewPager)findViewById(R.id.pager);
  TabsAdapter adapter=new TabsAdapter(this,tabHost,viewPager);
  adapter.setOnTabChangedListener(new TabHost.OnTabChangeListener(){
    @Override public void onTabChanged(    String tabId){
    }
  }
);
  boolean permVisible=false;
  mScrollView=null;
  mOkCanInstall=false;
  int msg=0;
  AppSecurityPermissions perms=new AppSecurityPermissions(this,mAppDiff.mPkgInfo);
  if (mAppDiff.mInstalledAppInfo != null) {
    msg=(mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_update_system : R.string.install_confirm_update;
    mScrollView=new CaffeinatedScrollView(this);
    mScrollView.setFillViewport(true);
    final boolean newPermissionsFound=perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0;
    if (newPermissionsFound) {
      permVisible=true;
      mScrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_NEW));
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
    adapter.addTab(tabHost.newTabSpec(TAB_ID_NEW).setIndicator(getText(R.string.newPerms)),mScrollView);
  }
 else {
    findViewById(R.id.tabscontainer).setVisibility(View.GONE);
    findViewById(R.id.divider).setVisibility(View.VISIBLE);
  }
  final int N=perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL);
  if (N > 0) {
    permVisible=true;
    LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View root=inflater.inflate(R.layout.permissions_list,null);
    if (mScrollView == null) {
      mScrollView=(CaffeinatedScrollView)root.findViewById(R.id.scrollview);
    }
    final ViewGroup permList=(ViewGroup)root.findViewById(R.id.permission_list);
    permList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
    adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator(getText(R.string.allPerms)),root);
  }
  if (!permVisible) {
    if (mAppDiff.mInstalledAppInfo != null) {
      msg=(mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_update_system_no_perms : R.string.install_confirm_update_no_perms;
    }
 else {
      msg=R.string.install_confirm_no_perms;
    }
    tabHost.setVisibility(View.GONE);
    findViewById(R.id.filler).setVisibility(View.VISIBLE);
    findViewById(R.id.divider).setVisibility(View.GONE);
    mScrollView=null;
  }
  if (msg != 0) {
    ((TextView)findViewById(R.id.install_confirm)).setText(msg);
  }
  mInstallConfirm.setVisibility(View.VISIBLE);
  mOk=(Button)findViewById(R.id.ok_button);
  mCancel=(Button)findViewById(R.id.cancel_button);
  mOk.setOnClickListener(this);
  mCancel.setOnClickListener(this);
  if (mScrollView == null) {
    mOk.setText(R.string.menu_install);
    mOkCanInstall=true;
  }
 else {
    mScrollView.setFullScrollAction(new Runnable(){
      @Override public void run(){
        mOk.setText(R.string.menu_install);
        mOkCanInstall=true;
      }
    }
);
  }
}

Fixed version (ground truth):
private void startInstallConfirm(){
  final Drawable appIcon=mAppDiff.mPkgInfo.applicationInfo.loadIcon(mPm);
  final String appLabel=(String)mAppDiff.mPkgInfo.applicationInfo.loadLabel(mPm);
  View appSnippet=findViewById(R.id.app_snippet);
  ((ImageView)appSnippet.findViewById(R.id.app_icon)).setImageDrawable(appIcon);
  ((TextView)appSnippet.findViewById(R.id.app_name)).setText(appLabel);
  TabHost tabHost=(TabHost)findViewById(android.R.id.tabhost);
  tabHost.setup();
  ViewPager viewPager=(ViewPager)findViewById(R.id.pager);
  TabsAdapter adapter=new TabsAdapter(this,tabHost,viewPager);
  adapter.setOnTabChangedListener(new TabHost.OnTabChangeListener(){
    @Override public void onTabChanged(    String tabId){
    }
  }
);
  boolean permVisible=false;
  mScrollView=null;
  mOkCanInstall=false;
  int msg=0;
  AppSecurityPermissions perms=new AppSecurityPermissions(this,mAppDiff.mPkgInfo);
  if (mAppDiff.mInstalledAppInfo != null) {
    msg=(mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_update_system : R.string.install_confirm_update;
    mScrollView=new CaffeinatedScrollView(this);
    mScrollView.setFillViewport(true);
    final boolean newPermissionsFound=perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0;
    if (newPermissionsFound) {
      permVisible=true;
      mScrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_NEW));
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
    adapter.addTab(tabHost.newTabSpec(TAB_ID_NEW).setIndicator(getText(R.string.newPerms)),mScrollView);
  }
 else {
    findViewById(R.id.tabscontainer).setVisibility(View.GONE);
    findViewById(R.id.divider).setVisibility(View.VISIBLE);
  }
  final int n=perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL);
  if (n > 0) {
    permVisible=true;
    LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View root=inflater.inflate(R.layout.permissions_list,null);
    if (mScrollView == null) {
      mScrollView=(CaffeinatedScrollView)root.findViewById(R.id.scrollview);
    }
    final ViewGroup permList=(ViewGroup)root.findViewById(R.id.permission_list);
    permList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
    adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator(getText(R.string.allPerms)),root);
  }
  if (!permVisible) {
    if (mAppDiff.mInstalledAppInfo != null) {
      msg=(mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_update_system_no_perms : R.string.install_confirm_update_no_perms;
    }
 else {
      msg=R.string.install_confirm_no_perms;
    }
    tabHost.setVisibility(View.GONE);
    findViewById(R.id.filler).setVisibility(View.VISIBLE);
    findViewById(R.id.divider).setVisibility(View.GONE);
    mScrollView=null;
  }
  if (msg != 0) {
    ((TextView)findViewById(R.id.install_confirm)).setText(msg);
  }
  mInstallConfirm.setVisibility(View.VISIBLE);
  mOk=(Button)findViewById(R.id.ok_button);
  mCancel=(Button)findViewById(R.id.cancel_button);
  mOk.setOnClickListener(this);
  mCancel.setOnClickListener(this);
  if (mScrollView == null) {
    mOk.setText(R.string.menu_install);
    mOkCanInstall=true;
  }
 else {
    mScrollView.setFullScrollAction(new Runnable(){
      @Override public void run(){
        mOk.setText(R.string.menu_install);
        mOkCanInstall=true;
      }
    }
);
  }
}