Program: 15228
Project: 15228
Buggy source:
@Override protected void onFinishInflate(){
  super.onFinishInflate();
  if (WordPress.wpDB == null)   WordPress.wpDB=new WordPressDB(context);
  accounts=WordPress.wpDB.getAccounts(context);
  dashboard=(LinearLayout)findViewById(R.id.dashboard_overlay);
  commentBadgeText=(TextView)findViewById(R.id.comment_badge_text);
  blogNames=new CharSequence[accounts.size()];
  blogIDs=new int[accounts.size()];
  for (int i=0; i < accounts.size(); i++) {
    HashMap<?,?> defHash=(HashMap<?,?>)accounts.get(i);
    String curBlogName=EscapeUtils.unescapeHtml(defHash.get("String_Node_Str").toString());
    blogNames[i]=curBlogName;
    blogIDs[i]=Integer.valueOf(defHash.get("String_Node_Str").toString());
    blogTitle=(TextView)findViewById(R.id.blog_title);
  }
  int lastBlogID=WordPress.wpDB.getLastBlogID(context);
  if (lastBlogID != -1) {
    try {
      boolean matchedID=false;
      for (int i=0; i < blogIDs.length; i++) {
        if (blogIDs[i] == lastBlogID) {
          matchedID=true;
          WordPress.currentBlog=new Blog(blogIDs[i],context);
        }
      }
      if (!matchedID) {
        WordPress.currentBlog=new Blog(blogIDs[0],context);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else {
    if (blogIDs.length > 0)     WordPress.currentBlog=new Blog(blogIDs[0],context);
  }
  if (WordPress.currentBlog != null) {
    updateBlavatarImage();
    updateCommentBadge();
    refreshButton=(Button)findViewById(R.id.action_refresh);
    blogTitle.setText(EscapeUtils.unescapeHtml(WordPress.currentBlog.getBlogName()));
    rl=(RelativeLayout)findViewById(R.id.blogSelector);
    rl.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View v){
        dialogBuilder=new AlertDialog.Builder(context);
        dialogBuilder.setTitle(getResources().getText(R.string.choose_blog));
        dialogBuilder.setItems(blogNames,new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int pos){
            blogTitle.setText(blogNames[pos]);
            WordPress.currentBlog=new Blog(blogIDs[pos],context);
            WordPress.wpDB.updateLastBlogID(blogIDs[pos]);
            updateBlavatarImage();
            updateCommentBadge();
            if (onBlogChangedListener != null) {
              onBlogChangedListener.OnBlogChanged();
            }
          }
        }
);
        dialogBuilder.show();
      }
    }
);
    final ImageButton showDashboard=(ImageButton)findViewById(R.id.home_small);
    showDashboard.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View v){
        if (dashboard.getVisibility() == View.GONE) {
          showDashboardOverlay(0);
          isShowingDashboard=true;
        }
 else {
          hideDashboardOverlay();
        }
      }
    }
);
    setupDashboardButtons();
  }
}

Fixed version (ground truth):
@Override protected void onFinishInflate(){
  super.onFinishInflate();
  initViews();
  for (int i=0; i < accounts.size(); i++) {
    HashMap<?,?> defHash=(HashMap<?,?>)accounts.get(i);
    String curBlogName=EscapeUtils.unescapeHtml(defHash.get("String_Node_Str").toString());
    blogNames[i]=curBlogName;
    blogIDs[i]=Integer.valueOf(defHash.get("String_Node_Str").toString());
    blogTitle=(TextView)findViewById(R.id.blog_title);
  }
  int lastBlogID=WordPress.wpDB.getLastBlogID(context);
  if (lastBlogID != -1) {
    try {
      boolean matchedID=false;
      for (int i=0; i < blogIDs.length; i++) {
        if (blogIDs[i] == lastBlogID) {
          matchedID=true;
          WordPress.currentBlog=new Blog(blogIDs[i],context);
        }
      }
      if (!matchedID) {
        WordPress.currentBlog=new Blog(blogIDs[0],context);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else {
    if (blogIDs.length > 0)     WordPress.currentBlog=new Blog(blogIDs[0],context);
  }
  if (WordPress.currentBlog != null) {
    WordPress.wpDB.updateLastBlogID(WordPress.currentBlog.getId());
    updateBlavatarImage();
    updateCommentBadge();
    refreshButton=(Button)findViewById(R.id.action_refresh);
    blogTitle.setText(EscapeUtils.unescapeHtml(WordPress.currentBlog.getBlogName()));
    rl=(RelativeLayout)findViewById(R.id.blogSelector);
    rl.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View v){
        dialogBuilder=new AlertDialog.Builder(context);
        dialogBuilder.setTitle(getResources().getText(R.string.choose_blog));
        dialogBuilder.setItems(blogNames,new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int pos){
            blogTitle.setText(blogNames[pos]);
            WordPress.currentBlog=new Blog(blogIDs[pos],context);
            WordPress.wpDB.updateLastBlogID(blogIDs[pos]);
            updateBlavatarImage();
            updateCommentBadge();
            if (onBlogChangedListener != null) {
              onBlogChangedListener.OnBlogChanged();
            }
          }
        }
);
        dialogBuilder.show();
      }
    }
);
    final ImageButton showDashboard=(ImageButton)findViewById(R.id.home_small);
    showDashboard.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View v){
        if (dashboard.getVisibility() == View.GONE) {
          showDashboardOverlay(0);
          isShowingDashboard=true;
        }
 else {
          hideDashboardOverlay();
        }
      }
    }
);
    setupDashboardButtons();
  }
}