Program: 142307
Project: 142307
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  EntitySelectActivity oldActivity=(EntitySelectActivity)this.getDestroyedActivityState();
  if (savedInstanceState != null) {
    mResultIsMap=savedInstanceState.getBoolean(EXTRA_IS_MAP,false);
  }
  try {
    session=CommCareApplication._().getCurrentSession();
  }
 catch (  SessionUnavailableException sue) {
    this.setResult(Activity.RESULT_CANCELED);
    this.finish();
    return;
  }
  selectDatum=session.getNeededDatum();
  mNoDetailMode=selectDatum.getLongDetail() == null;
  if (this.getString(R.string.panes).equals("String_Node_Str") && !mNoDetailMode) {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      setContentView(R.layout.screen_compound_select);
      View.inflate(this,R.layout.entity_select_layout,(ViewGroup)findViewById(R.id.screen_compound_select_left_pane));
      inAwesomeMode=true;
      rightFrame=(FrameLayout)findViewById(R.id.screen_compound_select_right_pane);
      TextView message=(TextView)findViewById(R.id.screen_compound_select_prompt);
      message.setText(Localization.get("String_Node_Str",new String[]{Localization.get("String_Node_Str")}));
    }
 else {
      setContentView(R.layout.entity_select_layout);
      if (oldActivity != null) {
        if (oldActivity.selectedIntent != null) {
          startActivityForResult(oldActivity.selectedIntent,CONFIRM_SELECT);
          startOther=true;
        }
      }
    }
  }
 else {
    setContentView(R.layout.entity_select_layout);
  }
  ((ListView)this.findViewById(R.id.screen_entity_select_list)).setOnItemClickListener(this);
  TextView searchLabel=(TextView)findViewById(R.id.screen_entity_select_search_label);
  searchLabel.setText(Localization.get("String_Node_Str"));
  searchbox=(EditText)findViewById(R.id.searchbox);
  header=(LinearLayout)findViewById(R.id.entity_select_header);
  barcodeButton=(ImageButton)findViewById(R.id.barcodeButton);
  Vector<Entry> entries=session.getEntriesForCommand(session.getCommand());
  prototype=entries.elementAt(0);
  if (entries.size() == 1 && prototype.getXFormNamespace() == null || prototype.getXFormNamespace().equals("String_Node_Str")) {
    mViewMode=true;
  }
  barcodeButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Intent i=new Intent("String_Node_Str");
      try {
        startActivityForResult(i,BARCODE_FETCH);
      }
 catch (      ActivityNotFoundException anfe) {
        Toast noReader=Toast.makeText(EntitySelectActivity.this,"String_Node_Str",Toast.LENGTH_LONG);
        noReader.show();
      }
    }
  }
);
  searchbox.addTextChangedListener(this);
  searchbox.requestFocus();
  if (oldActivity != null) {
    adapter=oldActivity.adapter;
    ((ListView)this.findViewById(R.id.screen_entity_select_list)).setAdapter(adapter);
    findViewById(R.id.entity_select_loading).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  EntitySelectActivity oldActivity=(EntitySelectActivity)this.getDestroyedActivityState();
  if (savedInstanceState != null) {
    mResultIsMap=savedInstanceState.getBoolean(EXTRA_IS_MAP,false);
  }
  try {
    session=CommCareApplication._().getCurrentSession();
  }
 catch (  SessionUnavailableException sue) {
    this.setResult(Activity.RESULT_CANCELED);
    this.finish();
    return;
  }
  selectDatum=session.getNeededDatum();
  mNoDetailMode=selectDatum.getLongDetail() == null;
  if (this.getString(R.string.panes).equals("String_Node_Str") && !mNoDetailMode) {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      setContentView(R.layout.screen_compound_select);
      View.inflate(this,R.layout.entity_select_layout,(ViewGroup)findViewById(R.id.screen_compound_select_left_pane));
      inAwesomeMode=true;
      rightFrame=(FrameLayout)findViewById(R.id.screen_compound_select_right_pane);
      TextView message=(TextView)findViewById(R.id.screen_compound_select_prompt);
      message.setText(Localization.get("String_Node_Str",new String[]{Localization.get("String_Node_Str")}));
    }
 else {
      setContentView(R.layout.entity_select_layout);
      if (oldActivity != null) {
        if (oldActivity.selectedIntent != null) {
          startActivityForResult(oldActivity.selectedIntent,CONFIRM_SELECT);
          startOther=true;
        }
      }
    }
  }
 else {
    setContentView(R.layout.entity_select_layout);
  }
  ((ListView)this.findViewById(R.id.screen_entity_select_list)).setOnItemClickListener(this);
  TextView searchLabel=(TextView)findViewById(R.id.screen_entity_select_search_label);
  searchLabel.setText(Localization.get("String_Node_Str"));
  searchbox=(EditText)findViewById(R.id.searchbox);
  header=(LinearLayout)findViewById(R.id.entity_select_header);
  barcodeButton=(ImageButton)findViewById(R.id.barcodeButton);
  Vector<Entry> entries=session.getEntriesForCommand(session.getCommand());
  prototype=entries.elementAt(0);
  if (entries.size() == 1 && (prototype.getXFormNamespace() == null || prototype.getXFormNamespace().equals("String_Node_Str"))) {
    mViewMode=true;
  }
  barcodeButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Intent i=new Intent("String_Node_Str");
      try {
        startActivityForResult(i,BARCODE_FETCH);
      }
 catch (      ActivityNotFoundException anfe) {
        Toast noReader=Toast.makeText(EntitySelectActivity.this,"String_Node_Str",Toast.LENGTH_LONG);
        noReader.show();
      }
    }
  }
);
  searchbox.addTextChangedListener(this);
  searchbox.requestFocus();
  if (oldActivity != null) {
    adapter=oldActivity.adapter;
    ((ListView)this.findViewById(R.id.screen_entity_select_list)).setAdapter(adapter);
    findViewById(R.id.entity_select_loading).setVisibility(View.GONE);
  }
}