Program: 13949
Project: 13949
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.new_edit_post_activity);
  if (savedInstanceState == null) {
    mSite=(SiteModel)getIntent().getSerializableExtra(WordPress.SITE);
  }
 else {
    mSite=(SiteModel)savedInstanceState.getSerializable(WordPress.SITE);
  }
  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 (!getIntent().hasExtra(EXTRA_POST) || 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 localSiteId=getIntent().getIntExtra(EXTRA_QUICKPRESS_BLOG_ID,-1);
        SiteModel site=mSiteStore.getSiteByLocalId(localSiteId);
        if (site == null) {
          showErrorAndFinish(R.string.blog_not_found);
          return;
        }
        if (!site.isVisible()) {
          showErrorAndFinish(R.string.error_blog_hidden);
          return;
        }
        mSite=site;
      }
      mIsPage=extras.getBoolean(EXTRA_IS_PAGE);
      mIsNewPost=true;
      mNewPostLatch=new CountDownLatch(1);
      List<Long> categories=new ArrayList<>();
      String postFormat=SiteSettingsInterface.getDefaultFormat(WordPress.getContext());
      InstantiatePostPayload payload=new InstantiatePostPayload(mSite,mIsPage,categories,postFormat);
      mDispatcher.dispatch(PostActionBuilder.newInstantiatePostAction(payload));
      try {
        mNewPostLatch.await(1000,TimeUnit.MILLISECONDS);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      if (mPost == null) {
        throw new RuntimeException("String_Node_Str");
      }
    }
 else     if (extras != null) {
      mPost=(PostModel)extras.getSerializable(EXTRA_POST);
      if (mPost != null) {
        mOriginalPost=mPost.clone();
        mIsPage=mPost.isPage();
      }
    }
 else {
      showErrorAndFinish(R.string.post_not_found);
      return;
    }
  }
 else {
    mDroppedMediaUris=savedInstanceState.getParcelable(STATE_KEY_DROPPED_MEDIA_URIS);
    if (savedInstanceState.containsKey(STATE_KEY_ORIGINAL_POST)) {
      try {
        mPost=(PostModel)savedInstanceState.getSerializable(STATE_KEY_CURRENT_POST);
        mOriginalPost=(PostModel)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 (mSite == null) {
    ToastUtils.showToast(this,R.string.blog_not_found,ToastUtils.Duration.SHORT);
    finish();
    return;
  }
  if (mHasSetPostContent=mEditorFragment != null) {
    mEditorFragment.setImageLoader(WordPress.imageLoader);
  }
  if (mPost == null) {
    showErrorAndFinish(R.string.post_not_found);
    return;
  }
  if (mIsNewPost) {
    trackEditorCreatedPost(action,getIntent());
  }
  setTitle(StringUtils.unescapeHTML(SiteUtils.getSiteNameOrHomeURL(mSite)));
  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(SiteUtils.getSiteNameOrHomeURL(mSite)));
      }
 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(new AfterSavePostListener(){
          @Override public void onPostSave(){
            if (mEditPostPreviewFragment != null) {
              runOnUiThread(new Runnable(){
                @Override public void run(){
                  if (mEditPostPreviewFragment != null) {
                    mEditPostPreviewFragment.loadPost();
                  }
                }
              }
);
            }
          }
        }
);
      }
    }
  }
);
  ActivityId.trackLastActivity(ActivityId.POST_EDITOR);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((WordPress)getApplication()).component().inject(this);
  mDispatcher.register(this);
  setContentView(R.layout.new_edit_post_activity);
  if (savedInstanceState == null) {
    mSite=(SiteModel)getIntent().getSerializableExtra(WordPress.SITE);
  }
 else {
    mSite=(SiteModel)savedInstanceState.getSerializable(WordPress.SITE);
  }
  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 (!getIntent().hasExtra(EXTRA_POST) || 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 localSiteId=getIntent().getIntExtra(EXTRA_QUICKPRESS_BLOG_ID,-1);
        SiteModel site=mSiteStore.getSiteByLocalId(localSiteId);
        if (site == null) {
          showErrorAndFinish(R.string.blog_not_found);
          return;
        }
        if (!site.isVisible()) {
          showErrorAndFinish(R.string.error_blog_hidden);
          return;
        }
        mSite=site;
      }
      mIsPage=extras.getBoolean(EXTRA_IS_PAGE);
      mIsNewPost=true;
      mNewPostLatch=new CountDownLatch(1);
      List<Long> categories=new ArrayList<>();
      String postFormat=SiteSettingsInterface.getDefaultFormat(WordPress.getContext());
      InstantiatePostPayload payload=new InstantiatePostPayload(mSite,mIsPage,categories,postFormat);
      mDispatcher.dispatch(PostActionBuilder.newInstantiatePostAction(payload));
      try {
        mNewPostLatch.await(1000,TimeUnit.MILLISECONDS);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      if (mPost == null) {
        throw new RuntimeException("String_Node_Str");
      }
    }
 else     if (extras != null) {
      mPost=(PostModel)extras.getSerializable(EXTRA_POST);
      if (mPost != null) {
        mOriginalPost=mPost.clone();
        mIsPage=mPost.isPage();
      }
    }
 else {
      showErrorAndFinish(R.string.post_not_found);
      return;
    }
  }
 else {
    mDroppedMediaUris=savedInstanceState.getParcelable(STATE_KEY_DROPPED_MEDIA_URIS);
    if (savedInstanceState.containsKey(STATE_KEY_ORIGINAL_POST)) {
      try {
        mPost=(PostModel)savedInstanceState.getSerializable(STATE_KEY_CURRENT_POST);
        mOriginalPost=(PostModel)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 (mSite == null) {
    ToastUtils.showToast(this,R.string.blog_not_found,ToastUtils.Duration.SHORT);
    finish();
    return;
  }
  if (mHasSetPostContent=mEditorFragment != null) {
    mEditorFragment.setImageLoader(WordPress.imageLoader);
  }
  if (mPost == null) {
    showErrorAndFinish(R.string.post_not_found);
    return;
  }
  if (mIsNewPost) {
    trackEditorCreatedPost(action,getIntent());
  }
  setTitle(StringUtils.unescapeHTML(SiteUtils.getSiteNameOrHomeURL(mSite)));
  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(SiteUtils.getSiteNameOrHomeURL(mSite)));
      }
 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(new AfterSavePostListener(){
          @Override public void onPostSave(){
            if (mEditPostPreviewFragment != null) {
              runOnUiThread(new Runnable(){
                @Override public void run(){
                  if (mEditPostPreviewFragment != null) {
                    mEditPostPreviewFragment.loadPost();
                  }
                }
              }
);
            }
          }
        }
);
      }
    }
  }
);
  ActivityId.trackLastActivity(ActivityId.POST_EDITOR);
}