Program: 13926
Project: 13926
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.edit_post_settings_fragment,container,false);
  if (rootView == null || mPost == null) {
    return null;
  }
  Calendar c=Calendar.getInstance();
  mYear=c.get(Calendar.YEAR);
  mMonth=c.get(Calendar.MONTH);
  mDay=c.get(Calendar.DAY_OF_MONTH);
  mHour=c.get(Calendar.HOUR_OF_DAY);
  mMinute=c.get(Calendar.MINUTE);
  mExcerptEditText=(EditText)rootView.findViewById(R.id.postExcerpt);
  mPasswordEditText=(EditText)rootView.findViewById(R.id.post_password);
  mPubDateText=(TextView)rootView.findViewById(R.id.pubDate);
  mPubDateText.setOnClickListener(this);
  mStatusSpinner=(Spinner)rootView.findViewById(R.id.status);
  mStatusSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      updatePostSettingsAndSaveButton();
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mSectionCategories=((ViewGroup)rootView.findViewById(R.id.sectionCategories));
  TextView featuredImageLabel=(TextView)rootView.findViewById(R.id.featuredImageLabel);
  mFeaturedImageView=(NetworkImageView)rootView.findViewById(R.id.featuredImage);
  mFeaturedImageButton=(Button)rootView.findViewById(R.id.addFeaturedImage);
  if (AppPrefs.isVisualEditorEnabled() || AppPrefs.isAztecEditorEnabled()) {
    registerForContextMenu(mFeaturedImageView);
    mFeaturedImageView.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        view.showContextMenu();
      }
    }
);
    mFeaturedImageButton.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        launchMediaGalleryActivity();
      }
    }
);
  }
 else {
    featuredImageLabel.setVisibility(View.GONE);
    mFeaturedImageView.setVisibility(View.GONE);
    mFeaturedImageButton.setVisibility(View.GONE);
  }
  if (mPost.isPage()) {
    mExcerptEditText.setVisibility(View.GONE);
    rootView.findViewById(R.id.sectionTags).setVisibility(View.GONE);
    rootView.findViewById(R.id.sectionCategories).setVisibility(View.GONE);
    rootView.findViewById(R.id.postFormatLabel).setVisibility(View.GONE);
    rootView.findViewById(R.id.postFormat).setVisibility(View.GONE);
  }
 else {
    mPostFormatKeys=new ArrayList<>(Arrays.asList(getResources().getStringArray(R.array.post_format_keys)));
    mPostFormatNames=new ArrayList<>(Arrays.asList(getResources().getStringArray(R.array.post_format_display_names)));
    List<PostFormatModel> postFormatModels=mSiteStore.getPostFormats(mSite);
    for (    PostFormatModel postFormatModel : postFormatModels) {
      mPostFormatKeys.add(postFormatModel.getSlug());
      mPostFormatNames.add(postFormatModel.getDisplayName());
    }
    if (mPostFormatKeys.contains(POST_FORMAT_STANDARD_KEY)) {
      mPostFormatKeys.add(0,POST_FORMAT_STANDARD_KEY);
      mPostFormatNames.add(0,getResources().getString(R.string.post_format_standard));
    }
    mPostFormatSpinner=(Spinner)rootView.findViewById(R.id.postFormat);
    ArrayAdapter<String> pfAdapter=new ArrayAdapter<>(getActivity(),R.layout.simple_spinner_item,mPostFormatNames);
    pfAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mPostFormatSpinner.setAdapter(pfAdapter);
    String activePostFormat=POST_FORMAT_STANDARD_KEY;
    if (!TextUtils.isEmpty(mPost.getPostFormat())) {
      activePostFormat=mPost.getPostFormat();
    }
    for (int i=0; i < mPostFormatKeys.size(); i++) {
      if (mPostFormatKeys.get(i).equals(activePostFormat))       mPostFormatSpinner.setSelection(i);
    }
    mPostFormatSpinner.setOnTouchListener(new View.OnTouchListener(){
      @Override public boolean onTouch(      View view,      MotionEvent motionEvent){
        return false;
      }
    }
);
    mTagsEditText=(SuggestionAutoCompleteText)rootView.findViewById(R.id.tags);
    if (mTagsEditText != null) {
      mTagsEditText.setTokenizer(new SuggestionAutoCompleteText.CommaTokenizer());
      setupSuggestionServiceAndAdapter();
    }
  }
  initSettingsFields();
  populateSelectedCategories();
  initLocation(rootView);
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.edit_post_settings_fragment,container,false);
  if (rootView == null || mPost == null) {
    return null;
  }
  Calendar c=Calendar.getInstance();
  mYear=c.get(Calendar.YEAR);
  mMonth=c.get(Calendar.MONTH);
  mDay=c.get(Calendar.DAY_OF_MONTH);
  mHour=c.get(Calendar.HOUR_OF_DAY);
  mMinute=c.get(Calendar.MINUTE);
  mExcerptEditText=(EditText)rootView.findViewById(R.id.postExcerpt);
  mPasswordEditText=(EditText)rootView.findViewById(R.id.post_password);
  mPubDateText=(TextView)rootView.findViewById(R.id.pubDate);
  mPubDateText.setOnClickListener(this);
  mStatusSpinner=(Spinner)rootView.findViewById(R.id.status);
  mStatusSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      updatePostSettingsAndSaveButton();
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mSectionCategories=((ViewGroup)rootView.findViewById(R.id.sectionCategories));
  TextView featuredImageLabel=(TextView)rootView.findViewById(R.id.featuredImageLabel);
  mFeaturedImageView=(NetworkImageView)rootView.findViewById(R.id.featuredImage);
  mFeaturedImageButton=(Button)rootView.findViewById(R.id.addFeaturedImage);
  if (AppPrefs.isVisualEditorEnabled() || AppPrefs.isAztecEditorEnabled()) {
    registerForContextMenu(mFeaturedImageView);
    mFeaturedImageView.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        view.showContextMenu();
      }
    }
);
    mFeaturedImageButton.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        launchMediaGalleryActivity();
      }
    }
);
  }
 else {
    featuredImageLabel.setVisibility(View.GONE);
    mFeaturedImageView.setVisibility(View.GONE);
    mFeaturedImageButton.setVisibility(View.GONE);
  }
  if (mPost.isPage()) {
    mExcerptEditText.setVisibility(View.GONE);
    rootView.findViewById(R.id.sectionTags).setVisibility(View.GONE);
    rootView.findViewById(R.id.sectionCategories).setVisibility(View.GONE);
    rootView.findViewById(R.id.postFormatLabel).setVisibility(View.GONE);
    rootView.findViewById(R.id.postFormat).setVisibility(View.GONE);
  }
 else {
    mPostFormatKeys=new ArrayList<>(Arrays.asList(getResources().getStringArray(R.array.post_format_keys)));
    mPostFormatNames=new ArrayList<>(Arrays.asList(getResources().getStringArray(R.array.post_format_display_names)));
    List<PostFormatModel> postFormatModels=mSiteStore.getPostFormats(mSite);
    for (    PostFormatModel postFormatModel : postFormatModels) {
      if (!mPostFormatKeys.contains(postFormatModel.getSlug())) {
        mPostFormatKeys.add(postFormatModel.getSlug());
        mPostFormatNames.add(postFormatModel.getDisplayName());
      }
    }
    mPostFormatSpinner=(Spinner)rootView.findViewById(R.id.postFormat);
    ArrayAdapter<String> pfAdapter=new ArrayAdapter<>(getActivity(),R.layout.simple_spinner_item,mPostFormatNames);
    pfAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mPostFormatSpinner.setAdapter(pfAdapter);
    String activePostFormat=POST_FORMAT_STANDARD_KEY;
    if (!TextUtils.isEmpty(mPost.getPostFormat())) {
      activePostFormat=mPost.getPostFormat();
    }
    for (int i=0; i < mPostFormatKeys.size(); i++) {
      if (mPostFormatKeys.get(i).equals(activePostFormat))       mPostFormatSpinner.setSelection(i);
    }
    mPostFormatSpinner.setOnTouchListener(new View.OnTouchListener(){
      @Override public boolean onTouch(      View view,      MotionEvent motionEvent){
        return false;
      }
    }
);
    mTagsEditText=(SuggestionAutoCompleteText)rootView.findViewById(R.id.tags);
    if (mTagsEditText != null) {
      mTagsEditText.setTokenizer(new SuggestionAutoCompleteText.CommaTokenizer());
      setupSuggestionServiceAndAdapter();
    }
  }
  initSettingsFields();
  populateSelectedCategories();
  initLocation(rootView);
  return rootView;
}