Program: 32211
Project: 32211
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_home);
  ArrayList<String> menuEntries=new ArrayList<String>();
  for (  int id : mSlideMenuTitleIds) {
    menuEntries.add(getString(id));
  }
  mDrawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  mDrawerList=(ListView)findViewById(R.id.left_drawer);
  mDrawerList.setAdapter(new ArrayAdapter<>(this,R.layout.adapter_drawer_item,menuEntries));
  mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
  mDrawerToggle=new ActionBarDrawerToggle(this,mDrawerLayout,R.drawable.ic_drawer,R.string.action_open,R.string.action_open){
    public void onDrawerClosed(    View view){
    }
    public void onDrawerOpened(    View drawerView){
    }
  }
;
  mDrawerLayout.setDrawerListener(mDrawerToggle);
  if (null != getSupportActionBar()) {
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
  }
  mSession=Matrix.getInstance(getApplicationContext()).getDefaultSession();
  if (mSession == null) {
    finish();
    return;
  }
  mMyRoomList=(ExpandableListView)findViewById(R.id.listView_myRooms);
  mAdapter=new RoomSummaryAdapter(this,R.layout.adapter_item_my_rooms);
  if (null != savedInstanceState) {
    if (savedInstanceState.containsKey(UNREAD_MESSAGE_MAP)) {
      Serializable map=savedInstanceState.getSerializable(UNREAD_MESSAGE_MAP);
      if (null != map) {
        mAdapter.setUnreadCountMap((HashMap<String,Integer>)map);
      }
    }
    if (savedInstanceState.containsKey(PUBLIC_ROOMS_LIST)) {
      Serializable map=savedInstanceState.getSerializable(PUBLIC_ROOMS_LIST);
      if (null != map) {
        HashMap<String,PublicRoom> hash=(HashMap<String,PublicRoom>)map;
        mPublicRooms=new ArrayList<PublicRoom>(hash.values());
      }
    }
  }
  Intent intent=getIntent();
  if (intent.hasExtra(EXTRA_JUMP_TO_ROOM_ID)) {
    mAutomaticallyOpenedRoomId=intent.getStringExtra(EXTRA_JUMP_TO_ROOM_ID);
  }
  mMyRoomList.setAdapter(mAdapter);
  mSession.getDataHandler().addListener(mListener);
  mMyRoomList.setOnChildClickListener(new ExpandableListView.OnChildClickListener(){
    @Override public boolean onChildClick(    ExpandableListView parent,    View v,    int groupPosition,    int childPosition,    long id){
      String roomId=null;
      if (mAdapter.isRecentsGroupIndex(groupPosition)) {
        roomId=mAdapter.getRoomSummaryAt(childPosition).getRoomId();
        mAdapter.resetUnreadCount(roomId);
      }
 else       if (mAdapter.isPublicsGroupIndex(groupPosition)) {
        roomId=mAdapter.getPublicRoomAt(childPosition).roomId;
      }
      if (null != roomId) {
        CommonActivityUtils.goToRoomPage(roomId,HomeActivity.this);
      }
      return true;
    }
  }
);
  mMyRoomList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener(){
    @Override public void onGroupExpand(    int groupPosition){
      if (mAdapter.isPublicsGroupIndex(groupPosition)) {
        refreshPublicRoomsList();
      }
    }
  }
);
  mMyRoomList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener(){
    @Override public boolean onGroupClick(    ExpandableListView parent,    View v,    int groupPosition,    long id){
      return mAdapter.getGroupCount() < 2;
    }
  }
);
  mSearchRoomEditText=(EditText)this.findViewById(R.id.editText_search_room);
  mSearchRoomEditText.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    android.text.Editable s){
      mAdapter.setSearchedPattern(s.toString());
      mMyRoomList.smoothScrollToPosition(0);
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_home);
  ArrayList<String> menuEntries=new ArrayList<String>();
  for (  int id : mSlideMenuTitleIds) {
    menuEntries.add(getString(id));
  }
  mDrawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  mDrawerList=(ListView)findViewById(R.id.left_drawer);
  mDrawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.adapter_drawer_item,menuEntries));
  mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
  mDrawerToggle=new ActionBarDrawerToggle(this,mDrawerLayout,R.drawable.ic_drawer,R.string.action_open,R.string.action_open){
    public void onDrawerClosed(    View view){
    }
    public void onDrawerOpened(    View drawerView){
    }
  }
;
  mDrawerLayout.setDrawerListener(mDrawerToggle);
  if (null != getSupportActionBar()) {
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
  }
  mSession=Matrix.getInstance(getApplicationContext()).getDefaultSession();
  if (mSession == null) {
    finish();
    return;
  }
  mMyRoomList=(ExpandableListView)findViewById(R.id.listView_myRooms);
  mAdapter=new RoomSummaryAdapter(this,R.layout.adapter_item_my_rooms);
  if (null != savedInstanceState) {
    if (savedInstanceState.containsKey(UNREAD_MESSAGE_MAP)) {
      Serializable map=savedInstanceState.getSerializable(UNREAD_MESSAGE_MAP);
      if (null != map) {
        mAdapter.setUnreadCountMap((HashMap<String,Integer>)map);
      }
    }
    if (savedInstanceState.containsKey(PUBLIC_ROOMS_LIST)) {
      Serializable map=savedInstanceState.getSerializable(PUBLIC_ROOMS_LIST);
      if (null != map) {
        HashMap<String,PublicRoom> hash=(HashMap<String,PublicRoom>)map;
        mPublicRooms=new ArrayList<PublicRoom>(hash.values());
      }
    }
  }
  Intent intent=getIntent();
  if (intent.hasExtra(EXTRA_JUMP_TO_ROOM_ID)) {
    mAutomaticallyOpenedRoomId=intent.getStringExtra(EXTRA_JUMP_TO_ROOM_ID);
  }
  mMyRoomList.setAdapter(mAdapter);
  mSession.getDataHandler().addListener(mListener);
  mMyRoomList.setOnChildClickListener(new ExpandableListView.OnChildClickListener(){
    @Override public boolean onChildClick(    ExpandableListView parent,    View v,    int groupPosition,    int childPosition,    long id){
      String roomId=null;
      if (mAdapter.isRecentsGroupIndex(groupPosition)) {
        roomId=mAdapter.getRoomSummaryAt(childPosition).getRoomId();
        mAdapter.resetUnreadCount(roomId);
      }
 else       if (mAdapter.isPublicsGroupIndex(groupPosition)) {
        roomId=mAdapter.getPublicRoomAt(childPosition).roomId;
      }
      if (null != roomId) {
        CommonActivityUtils.goToRoomPage(roomId,HomeActivity.this);
      }
      return true;
    }
  }
);
  mMyRoomList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener(){
    @Override public void onGroupExpand(    int groupPosition){
      if (mAdapter.isPublicsGroupIndex(groupPosition)) {
        refreshPublicRoomsList();
      }
    }
  }
);
  mMyRoomList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener(){
    @Override public boolean onGroupClick(    ExpandableListView parent,    View v,    int groupPosition,    long id){
      return mAdapter.getGroupCount() < 2;
    }
  }
);
  mSearchRoomEditText=(EditText)this.findViewById(R.id.editText_search_room);
  mSearchRoomEditText.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    android.text.Editable s){
      mAdapter.setSearchedPattern(s.toString());
      mMyRoomList.smoothScrollToPosition(0);
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
}