Program: 54291
Project: 54291
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.target_layout);
  if (mTargetAdapter == null) {
    isWifiAvailable=Network.isWifiConnected(this);
    isConnectivityAvailable=isWifiAvailable || Network.isConnectivityAvailable(this);
    if (isConnectivityAvailable == false) {
      new FatalDialog("String_Node_Str","String_Node_Str",this).show();
      return;
    }
    if (System.isInitialized() == false) {
      if (isWifiAvailable == true) {
        new FatalDialog("String_Node_Str",System.getLastError(),this).show();
        return;
      }
 else       createUpdateLayout();
    }
    final ProgressDialog dialog=ProgressDialog.show(this,"String_Node_Str","String_Node_Str",true,false);
    new Thread(new Runnable(){
      @Override public void run(){
        dialog.show();
        String fatal=null;
        ToolsInstaller installer=new ToolsInstaller(MainActivity.this.getApplicationContext());
        if (Shell.isRootGranted() == false)         fatal="String_Node_Str";
 else         if (Shell.isBinaryAvailable("String_Node_Str") == false)         fatal="String_Node_Str";
 else         if (installer.needed() && installer.install() == false)         fatal="String_Node_Str";
        dialog.dismiss();
        if (fatal != null) {
          final String ffatal=fatal;
          MainActivity.this.runOnUiThread(new Runnable(){
            @Override public void run(){
              new FatalDialog("String_Node_Str",ffatal,MainActivity.this).show();
            }
          }
);
        }
 else         if (isWifiAvailable) {
          startService(new Intent(MainActivity.this,NetworkMonitorService.class));
        }
        MainActivity.this.runOnUiThread(new Runnable(){
          @Override public void run(){
            try {
              mTargetAdapter=new TargetAdapter(R.layout.target_list_item);
              if (isWifiAvailable) {
                setListAdapter(mTargetAdapter);
                getListView().setOnItemLongClickListener(new OnItemLongClickListener(){
                  @Override public boolean onItemLongClick(                  AdapterView<?> parent,                  View view,                  int position,                  long id){
                    final Target target=System.getTarget(position);
                    new InputDialog("String_Node_Str","String_Node_Str",target.hasAlias() ? target.getAlias() : "String_Node_Str",true,MainActivity.this,new InputDialogListener(){
                      @Override public void onInputEntered(                      String input){
                        target.setAlias(input);
                        mTargetAdapter.notifyDataSetChanged();
                      }
                    }
).show();
                    return false;
                  }
                }
);
              }
              mMessageReceiver=new BroadcastReceiver(){
                @Override public void onReceive(                Context context,                Intent intent){
                  if (isWifiAvailable && intent.getAction().equals(NetworkMonitorService.NEW_ENDPOINT)) {
                    String address=(String)intent.getExtras().get(NetworkMonitorService.ENDPOINT_ADDRESS), hardware=(String)intent.getExtras().get(NetworkMonitorService.ENDPOINT_HARDWARE);
                    final Target target=Target.getFromString(address);
                    target.getEndpoint().setHardware(Endpoint.parseMacAddress(hardware));
                    MainActivity.this.runOnUiThread(new Runnable(){
                      @Override public void run(){
                        if (System.addOrderedTarget(target) == true) {
                          mTargetAdapter.notifyDataSetChanged();
                        }
                      }
                    }
);
                  }
 else                   if (intent.getAction().equals(UpdateService.UPDATE_CHECKING) && mUpdateStatus != null) {
                    mUpdateStatus.setText(NO_WIFI_UPDATE_MESSAGE.replace("String_Node_Str","String_Node_Str"));
                  }
 else                   if (intent.getAction().equals(UpdateService.UPDATE_NOT_AVAILABLE) && mUpdateStatus != null) {
                    mUpdateStatus.setText(NO_WIFI_UPDATE_MESSAGE.replace("String_Node_Str","String_Node_Str"));
                  }
 else                   if (intent.getAction().equals(UpdateService.UPDATE_AVAILABLE)) {
                    final String remoteVersion=(String)intent.getExtras().get(UpdateService.AVAILABLE_VERSION);
                    if (mUpdateStatus != null)                     mUpdateStatus.setText(NO_WIFI_UPDATE_MESSAGE.replace("String_Node_Str","String_Node_Str" + remoteVersion + "String_Node_Str"));
                    MainActivity.this.runOnUiThread(new Runnable(){
                      @Override public void run(){
                        new ConfirmDialog("String_Node_Str","String_Node_Str" + remoteVersion + "String_Node_Str",MainActivity.this,new ConfirmDialogListener(){
                          @Override public void onConfirm(){
                            final ProgressDialog dialog=new ProgressDialog(MainActivity.this);
                            dialog.setMessage("String_Node_Str");
                            dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                            dialog.setMax(100);
                            dialog.setCancelable(false);
                            dialog.show();
                            new Thread(new Runnable(){
                              @Override public void run(){
                                if (System.getUpdateManager().downloadUpdate(MainActivity.this,dialog) == false) {
                                  MainActivity.this.runOnUiThread(new Runnable(){
                                    @Override public void run(){
                                      new ErrorDialog("String_Node_Str","String_Node_Str",MainActivity.this).show();
                                    }
                                  }
);
                                }
                                dialog.dismiss();
                              }
                            }
).start();
                          }
                        }
).show();
                      }
                    }
);
                  }
                }
              }
;
              mIntentFilter=new IntentFilter();
              mIntentFilter.addAction(NetworkMonitorService.NEW_ENDPOINT);
              mIntentFilter.addAction(UpdateService.UPDATE_CHECKING);
              mIntentFilter.addAction(UpdateService.UPDATE_AVAILABLE);
              mIntentFilter.addAction(UpdateService.UPDATE_NOT_AVAILABLE);
              registerReceiver(mMessageReceiver,mIntentFilter);
              if (System.getSettings().getBoolean("String_Node_Str",true))               startService(new Intent(MainActivity.this,UpdateService.class));
            }
 catch (            Exception e) {
              new FatalDialog("String_Node_Str",e.getMessage(),MainActivity.this).show();
            }
          }
        }
);
      }
    }
).start();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.target_layout);
  if (mTargetAdapter == null) {
    isWifiAvailable=Network.isWifiConnected(this);
    isConnectivityAvailable=isWifiAvailable || Network.isConnectivityAvailable(this);
    if (isConnectivityAvailable == false) {
      new FatalDialog("String_Node_Str","String_Node_Str",this).show();
      return;
    }
    if (System.isInitialized() == false) {
      if (isWifiAvailable == true) {
        new FatalDialog("String_Node_Str",System.getLastError(),this).show();
        return;
      }
 else       createUpdateLayout();
    }
    final ProgressDialog dialog=ProgressDialog.show(this,"String_Node_Str","String_Node_Str",true,false);
    new Thread(new Runnable(){
      @Override public void run(){
        dialog.show();
        Context appContext=MainActivity.this.getApplicationContext();
        String fatal=null;
        ToolsInstaller installer=new ToolsInstaller(appContext);
        if (Shell.isRootGranted() == false)         fatal="String_Node_Str";
 else         if (Shell.isBinaryAvailable("String_Node_Str") == false)         fatal="String_Node_Str";
 else         if (installer.needed() && installer.install() == false)         fatal="String_Node_Str";
 else         if (Shell.isLibraryPathOverridable(appContext) == false)         fatal="String_Node_Str" + "String_Node_Str";
        dialog.dismiss();
        if (fatal != null) {
          final String ffatal=fatal;
          MainActivity.this.runOnUiThread(new Runnable(){
            @Override public void run(){
              new FatalDialog("String_Node_Str",ffatal,ffatal.contains("String_Node_Str"),MainActivity.this).show();
            }
          }
);
        }
 else         if (isWifiAvailable) {
          startService(new Intent(MainActivity.this,NetworkMonitorService.class));
        }
        MainActivity.this.runOnUiThread(new Runnable(){
          @Override public void run(){
            try {
              mTargetAdapter=new TargetAdapter(R.layout.target_list_item);
              if (isWifiAvailable) {
                setListAdapter(mTargetAdapter);
                getListView().setOnItemLongClickListener(new OnItemLongClickListener(){
                  @Override public boolean onItemLongClick(                  AdapterView<?> parent,                  View view,                  int position,                  long id){
                    final Target target=System.getTarget(position);
                    new InputDialog("String_Node_Str","String_Node_Str",target.hasAlias() ? target.getAlias() : "String_Node_Str",true,MainActivity.this,new InputDialogListener(){
                      @Override public void onInputEntered(                      String input){
                        target.setAlias(input);
                        mTargetAdapter.notifyDataSetChanged();
                      }
                    }
).show();
                    return false;
                  }
                }
);
              }
              mMessageReceiver=new BroadcastReceiver(){
                @Override public void onReceive(                Context context,                Intent intent){
                  if (isWifiAvailable && intent.getAction().equals(NetworkMonitorService.NEW_ENDPOINT)) {
                    String address=(String)intent.getExtras().get(NetworkMonitorService.ENDPOINT_ADDRESS), hardware=(String)intent.getExtras().get(NetworkMonitorService.ENDPOINT_HARDWARE);
                    final Target target=Target.getFromString(address);
                    target.getEndpoint().setHardware(Endpoint.parseMacAddress(hardware));
                    MainActivity.this.runOnUiThread(new Runnable(){
                      @Override public void run(){
                        if (System.addOrderedTarget(target) == true) {
                          mTargetAdapter.notifyDataSetChanged();
                        }
                      }
                    }
);
                  }
 else                   if (intent.getAction().equals(UpdateService.UPDATE_CHECKING) && mUpdateStatus != null) {
                    mUpdateStatus.setText(NO_WIFI_UPDATE_MESSAGE.replace("String_Node_Str","String_Node_Str"));
                  }
 else                   if (intent.getAction().equals(UpdateService.UPDATE_NOT_AVAILABLE) && mUpdateStatus != null) {
                    mUpdateStatus.setText(NO_WIFI_UPDATE_MESSAGE.replace("String_Node_Str","String_Node_Str"));
                  }
 else                   if (intent.getAction().equals(UpdateService.UPDATE_AVAILABLE)) {
                    final String remoteVersion=(String)intent.getExtras().get(UpdateService.AVAILABLE_VERSION);
                    if (mUpdateStatus != null)                     mUpdateStatus.setText(NO_WIFI_UPDATE_MESSAGE.replace("String_Node_Str","String_Node_Str" + remoteVersion + "String_Node_Str"));
                    MainActivity.this.runOnUiThread(new Runnable(){
                      @Override public void run(){
                        new ConfirmDialog("String_Node_Str","String_Node_Str" + remoteVersion + "String_Node_Str",MainActivity.this,new ConfirmDialogListener(){
                          @Override public void onConfirm(){
                            final ProgressDialog dialog=new ProgressDialog(MainActivity.this);
                            dialog.setMessage("String_Node_Str");
                            dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                            dialog.setMax(100);
                            dialog.setCancelable(false);
                            dialog.show();
                            new Thread(new Runnable(){
                              @Override public void run(){
                                if (System.getUpdateManager().downloadUpdate(MainActivity.this,dialog) == false) {
                                  MainActivity.this.runOnUiThread(new Runnable(){
                                    @Override public void run(){
                                      new ErrorDialog("String_Node_Str","String_Node_Str",MainActivity.this).show();
                                    }
                                  }
);
                                }
                                dialog.dismiss();
                              }
                            }
).start();
                          }
                        }
).show();
                      }
                    }
);
                  }
                }
              }
;
              mIntentFilter=new IntentFilter();
              mIntentFilter.addAction(NetworkMonitorService.NEW_ENDPOINT);
              mIntentFilter.addAction(UpdateService.UPDATE_CHECKING);
              mIntentFilter.addAction(UpdateService.UPDATE_AVAILABLE);
              mIntentFilter.addAction(UpdateService.UPDATE_NOT_AVAILABLE);
              registerReceiver(mMessageReceiver,mIntentFilter);
              if (System.getSettings().getBoolean("String_Node_Str",true))               startService(new Intent(MainActivity.this,UpdateService.class));
            }
 catch (            Exception e) {
              new FatalDialog("String_Node_Str",e.getMessage(),MainActivity.this).show();
            }
          }
        }
);
      }
    }
).start();
  }
}