Program: 14806
Project: 14806
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_new_edit_post);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  Bundle extras=getIntent().getExtras();
  String action=getIntent().getAction();
  if (savedInstanceState == null) {
    if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action) || EditPostContentFragment.NEW_MEDIA_GALLERY.equals(action)|| EditPostContentFragment.NEW_MEDIA_POST.equals(action)|| getIntent().hasExtra(EXTRA_IS_QUICKPRESS)|| (extras != null && extras.getInt("String_Node_Str",-1) > -1)) {
      if (getIntent().hasExtra(EXTRA_QUICKPRESS_BLOG_ID)) {
        int blogId=getIntent().getIntExtra(EXTRA_QUICKPRESS_BLOG_ID,-1);
        try {
          Blog quickPressBlog=WordPress.wpDB.instantiateBlogByLocalId(blogId);
          if (quickPressBlog.isHidden()) {
            showErrorAndFinish(R.string.error_blog_hidden);
            return;
          }
          WordPress.currentBlog=quickPressBlog;
        }
 catch (        Exception e) {
          showErrorAndFinish(R.string.blog_not_found);
          return;
        }
      }
      mPost=new Post(WordPress.getCurrentLocalTableBlogId(),false);
      mIsNewPost=true;
    }
 else     if (extras != null) {
      long postId=extras.getLong(EXTRA_POSTID,-1);
      boolean isPage=extras.getBoolean(EXTRA_IS_PAGE);
      mIsNewPost=extras.getBoolean(EXTRA_IS_NEW_POST);
      mPost=new Post(WordPress.getCurrentLocalTableBlogId(),postId,isPage);
      mOriginalPost=new Post(WordPress.getCurrentLocalTableBlogId(),postId,isPage);
      if (isPage) {
        WPMobileStatsUtil.trackEventForWPCom(WPMobileStatsUtil.StatsEventPageDetailOpenedEditor);
        mStatEventEditorClosed=WPMobileStatsUtil.StatsEventPageDetailClosedEditor;
      }
 else {
        WPMobileStatsUtil.trackEventForWPCom(WPMobileStatsUtil.StatsEventPostDetailOpenedEditor);
        mStatEventEditorClosed=WPMobileStatsUtil.StatsEventPostDetailClosedEditor;
      }
    }
 else {
      showErrorAndFinish(R.string.post_not_found);
      return;
    }
  }
 else   if (savedInstanceState.containsKey(STATE_KEY_ORIGINAL_POST)) {
    try {
      mPost=(Post)savedInstanceState.getSerializable(STATE_KEY_CURRENT_POST);
      mOriginalPost=(Post)savedInstanceState.getSerializable(STATE_KEY_ORIGINAL_POST);
    }
 catch (    ClassCastException e) {
      mPost=null;
    }
  }
  if (WordPress.getCurrentBlog() == null) {
    showErrorAndFinish(R.string.blog_not_found);
    return;
  }
  if (mPost == null || mPost.getId() < 0) {
    showErrorAndFinish(R.string.post_not_found);
    return;
  }
  setTitle(WordPress.getCurrentBlog().getBlogName());
  mSectionsPagerAdapter=new SectionsPagerAdapter(getSupportFragmentManager());
  mViewPager=(WPViewPager)findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);
  mViewPager.setOffscreenPageLimit(2);
  mViewPager.setPagingEnabled(false);
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      supportInvalidateOptionsMenu();
      if (position == PAGE_CONTENT) {
        setTitle(WordPress.getCurrentBlog().getBlogName());
      }
 else       if (position == PAGE_SETTINGS) {
        setTitle(mPost.isPage() ? R.string.page_settings : R.string.post_settings);
      }
 else       if (position == PAGE_PREVIEW) {
        setTitle(mPost.isPage() ? R.string.preview_page : R.string.preview_post);
        savePost(true);
        if (mEditPostPreviewFragment != null)         mEditPostPreviewFragment.loadPost(mPost);
      }
    }
  }
);
  mAutoSaveHandler=new Handler();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_new_edit_post);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  Bundle extras=getIntent().getExtras();
  String action=getIntent().getAction();
  if (savedInstanceState == null) {
    if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action) || EditPostContentFragment.NEW_MEDIA_GALLERY.equals(action)|| EditPostContentFragment.NEW_MEDIA_POST.equals(action)|| getIntent().hasExtra(EXTRA_IS_QUICKPRESS)|| (extras != null && extras.getInt("String_Node_Str",-1) > -1)) {
      if (getIntent().hasExtra(EXTRA_QUICKPRESS_BLOG_ID)) {
        int blogId=getIntent().getIntExtra(EXTRA_QUICKPRESS_BLOG_ID,-1);
        try {
          Blog quickPressBlog=WordPress.wpDB.instantiateBlogByLocalId(blogId);
          if (quickPressBlog.isHidden()) {
            showErrorAndFinish(R.string.error_blog_hidden);
            return;
          }
          WordPress.currentBlog=quickPressBlog;
        }
 catch (        Exception e) {
          showErrorAndFinish(R.string.blog_not_found);
          return;
        }
      }
      mPost=new Post(WordPress.getCurrentLocalTableBlogId(),false);
      WordPress.wpDB.savePost(mPost);
      mIsNewPost=true;
    }
 else     if (extras != null) {
      long localTablePostId=extras.getLong(EXTRA_POSTID,-1);
      boolean isPage=extras.getBoolean(EXTRA_IS_PAGE);
      mIsNewPost=extras.getBoolean(EXTRA_IS_NEW_POST);
      mPost=WordPress.wpDB.getPostForLocalTablePostId(localTablePostId);
      mOriginalPost=WordPress.wpDB.getPostForLocalTablePostId(localTablePostId);
      if (isPage) {
        WPMobileStatsUtil.trackEventForWPCom(WPMobileStatsUtil.StatsEventPageDetailOpenedEditor);
        mStatEventEditorClosed=WPMobileStatsUtil.StatsEventPageDetailClosedEditor;
      }
 else {
        WPMobileStatsUtil.trackEventForWPCom(WPMobileStatsUtil.StatsEventPostDetailOpenedEditor);
        mStatEventEditorClosed=WPMobileStatsUtil.StatsEventPostDetailClosedEditor;
      }
    }
 else {
      showErrorAndFinish(R.string.post_not_found);
      return;
    }
  }
 else   if (savedInstanceState.containsKey(STATE_KEY_ORIGINAL_POST)) {
    try {
      mPost=(Post)savedInstanceState.getSerializable(STATE_KEY_CURRENT_POST);
      mOriginalPost=(Post)savedInstanceState.getSerializable(STATE_KEY_ORIGINAL_POST);
    }
 catch (    ClassCastException e) {
      mPost=null;
    }
  }
  if (WordPress.getCurrentBlog() == null) {
    showErrorAndFinish(R.string.blog_not_found);
    return;
  }
  if (mPost == null) {
    showErrorAndFinish(R.string.post_not_found);
    return;
  }
  setTitle(WordPress.getCurrentBlog().getBlogName());
  mSectionsPagerAdapter=new SectionsPagerAdapter(getSupportFragmentManager());
  mViewPager=(WPViewPager)findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);
  mViewPager.setOffscreenPageLimit(2);
  mViewPager.setPagingEnabled(false);
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      supportInvalidateOptionsMenu();
      if (position == PAGE_CONTENT) {
        setTitle(WordPress.getCurrentBlog().getBlogName());
      }
 else       if (position == PAGE_SETTINGS) {
        setTitle(mPost.isPage() ? R.string.page_settings : R.string.post_settings);
      }
 else       if (position == PAGE_PREVIEW) {
        setTitle(mPost.isPage() ? R.string.preview_page : R.string.preview_post);
        savePost(true);
        if (mEditPostPreviewFragment != null)         mEditPostPreviewFragment.loadPost(mPost);
      }
    }
  }
);
  mAutoSaveHandler=new Handler();
}