Program: 14146
Project: 14146
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.new_edit_post_activity);
  PreferenceManager.setDefaultValues(this,R.xml.account_settings,false);
  mShowNewEditor=AppPrefs.isVisualEditorEnabled();
  final ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  FragmentManager fragmentManager=getFragmentManager();
  Bundle extras=getIntent().getExtras();
  String action=getIntent().getAction();
  if (savedInstanceState == null) {
    if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action) || NEW_MEDIA_GALLERY.equals(action)|| 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);
        Blog quickPressBlog=WordPress.wpDB.instantiateBlogByLocalId(blogId);
        if (quickPressBlog == null) {
          showErrorAndFinish(R.string.blog_not_found);
          return;
        }
        if (quickPressBlog.isHidden()) {
          showErrorAndFinish(R.string.error_blog_hidden);
          return;
        }
        WordPress.currentBlog=quickPressBlog;
      }
      mPost=new Post(WordPress.getCurrentLocalTableBlogId(),false);
      mPost.setCategories("String_Node_Str" + SiteSettingsInterface.getDefaultCategory(this) + "String_Node_Str");
      mPost.setPostFormat(SiteSettingsInterface.getDefaultFormat(this));
      WordPress.wpDB.savePost(mPost);
      mIsNewPost=true;
    }
 else     if (extras != null) {
      long localTablePostId=extras.getLong(EXTRA_POSTID,-1);
      mIsPage=extras.getBoolean(EXTRA_IS_PAGE);
      mIsNewPost=extras.getBoolean(EXTRA_IS_NEW_POST);
      mPost=WordPress.wpDB.getPostForLocalTablePostId(localTablePostId);
      mOriginalPost=WordPress.wpDB.getPostForLocalTablePostId(localTablePostId);
    }
 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;
      }
    }
    mEditorFragment=(EditorFragmentAbstract)fragmentManager.getFragment(savedInstanceState,STATE_KEY_EDITOR_FRAGMENT);
    if (mEditorFragment instanceof EditorMediaUploadListener) {
      mEditorMediaUploadListener=(EditorMediaUploadListener)mEditorFragment;
    }
  }
  if (mHasSetPostContent=mEditorFragment != null) {
    mEditorFragment.setImageLoader(WordPress.imageLoader);
  }
  if (WordPress.getCurrentBlog() == null) {
    showErrorAndFinish(R.string.blog_not_found);
    return;
  }
  if (mPost == null) {
    showErrorAndFinish(R.string.post_not_found);
    return;
  }
  if (mIsNewPost) {
    trackEditorCreatedPost(action,getIntent());
  }
  setTitle(StringUtils.unescapeHTML(WordPress.getCurrentBlog().getBlogName()));
  mSectionsPagerAdapter=new SectionsPagerAdapter(fragmentManager);
  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){
      invalidateOptionsMenu();
      if (position == PAGE_CONTENT) {
        setTitle(StringUtils.unescapeHTML(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();
        }
      }
    }
  }
);
  ActivityId.trackLastActivity(ActivityId.POST_EDITOR);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.new_edit_post_activity);
  PreferenceManager.setDefaultValues(this,R.xml.account_settings,false);
  mShowNewEditor=AppPrefs.isVisualEditorEnabled();
  final ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  FragmentManager fragmentManager=getFragmentManager();
  Bundle extras=getIntent().getExtras();
  String action=getIntent().getAction();
  if (savedInstanceState == null) {
    if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action) || NEW_MEDIA_GALLERY.equals(action)|| 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);
        Blog quickPressBlog=WordPress.wpDB.instantiateBlogByLocalId(blogId);
        if (quickPressBlog == null) {
          showErrorAndFinish(R.string.blog_not_found);
          return;
        }
        if (quickPressBlog.isHidden()) {
          showErrorAndFinish(R.string.error_blog_hidden);
          return;
        }
        WordPress.currentBlog=quickPressBlog;
      }
      mPost=new Post(WordPress.getCurrentLocalTableBlogId(),false);
      mPost.setCategories("String_Node_Str" + SiteSettingsInterface.getDefaultCategory(this) + "String_Node_Str");
      mPost.setPostFormat(SiteSettingsInterface.getDefaultFormat(this));
      WordPress.wpDB.savePost(mPost);
      mIsNewPost=true;
    }
 else     if (extras != null) {
      long localTablePostId=extras.getLong(EXTRA_POSTID,-1);
      mIsPage=extras.getBoolean(EXTRA_IS_PAGE);
      mIsNewPost=extras.getBoolean(EXTRA_IS_NEW_POST);
      mPost=WordPress.wpDB.getPostForLocalTablePostId(localTablePostId);
      mOriginalPost=WordPress.wpDB.getPostForLocalTablePostId(localTablePostId);
    }
 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;
      }
    }
    mEditorFragment=(EditorFragmentAbstract)fragmentManager.getFragment(savedInstanceState,STATE_KEY_EDITOR_FRAGMENT);
    if (mEditorFragment instanceof EditorMediaUploadListener) {
      mEditorMediaUploadListener=(EditorMediaUploadListener)mEditorFragment;
    }
  }
  if (mHasSetPostContent=mEditorFragment != null) {
    mEditorFragment.setImageLoader(WordPress.imageLoader);
  }
  if (WordPress.getCurrentBlog() == null) {
    showErrorAndFinish(R.string.blog_not_found);
    return;
  }
  if (mPost == null) {
    showErrorAndFinish(R.string.post_not_found);
    return;
  }
  if (mIsNewPost) {
    trackEditorCreatedPost(action,getIntent());
  }
  setTitle(StringUtils.unescapeHTML(WordPress.getCurrentBlog().getBlogName()));
  mSectionsPagerAdapter=new SectionsPagerAdapter(fragmentManager);
  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){
      invalidateOptionsMenu();
      if (position == PAGE_CONTENT) {
        setTitle(StringUtils.unescapeHTML(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);
        savePostAsync();
        if (mEditPostPreviewFragment != null) {
          mEditPostPreviewFragment.loadPost();
        }
      }
    }
  }
);
  ActivityId.trackLastActivity(ActivityId.POST_EDITOR);
}