Program: 161552
Project: 161552
Buggy source:
public void setUpSpinner(){
  new AsyncTask<Void,Void,String[]>(){
    @Override protected String[] doInBackground(    Void... voids){
      ArrayList<String> fetchedFaculties=new ArrayList<>();
      SurveyManager sm=new SurveyManager(getApplicationContext());
      try {
        sm.downloadFacultiesFromExternal();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      Cursor cursor=sm.getAllFaculties();
      if (cursor.moveToFirst()) {
        do {
          fetchedFaculties.add(cursor.getString(cursor.getColumnIndex("String_Node_Str")));
        }
 while (cursor.moveToNext());
      }
      fetchedFaculties.add(0,getResources().getString(R.string.choose_own_faculty));
      final String[] majors=fetchedFaculties.toArray(new String[fetchedFaculties.size()]);
      return majors;
    }
    @Override protected void onPostExecute(    String[] majors){
      ArrayAdapter<String> adapter=new ArrayAdapter<String>(getBaseContext(),android.R.layout.simple_list_item_1,majors);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      userMajorSpinner.setAdapter(adapter);
      userMajorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
        @Override public void onItemSelected(        AdapterView<?> adapterView,        View view,        int i,        long l){
          SurveyManager sm=new SurveyManager(getApplicationContext());
          Cursor c=sm.getFacultyID((String)adapterView.getItemAtPosition(i));
          if (c.moveToFirst()) {
            Utils.setInternalSetting(getApplicationContext(),"String_Node_Str",c.getString(c.getColumnIndex("String_Node_Str")));
          }
          TextView selectedItem=(TextView)adapterView.getChildAt(0);
          if (selectedItem != null) {
            selectedItem.setTextColor(ContextCompat.getColor(getApplicationContext(),R.color.color_primary));
          }
          userMajor=(String)adapterView.getItemAtPosition(i);
        }
        @Override public void onNothingSelected(        AdapterView<?> adapterView){
        }
      }
);
      return;
    }
  }
.execute();
}

Fixed version (ground truth):
public void setUpSpinner(){
  new AsyncTask<Void,Void,String[]>(){
    @Override protected String[] doInBackground(    Void... voids){
      ArrayList<String> fetchedFaculties=new ArrayList<>();
      SurveyManager sm=new SurveyManager(getApplicationContext());
      try {
        sm.downloadFacultiesFromExternal();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      Cursor cursor=sm.getAllFaculties();
      if (cursor.moveToFirst()) {
        do {
          fetchedFaculties.add(cursor.getString(cursor.getColumnIndex("String_Node_Str")));
        }
 while (cursor.moveToNext());
      }
      fetchedFaculties.add(0,getResources().getString(R.string.choose_own_faculty));
      final String[] majors=fetchedFaculties.toArray(new String[fetchedFaculties.size()]);
      return majors;
    }
    @Override protected void onPostExecute(    String[] majors){
      ArrayAdapter<String> adapter=new ArrayAdapter<String>(getBaseContext(),android.R.layout.simple_list_item_1,majors);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      userMajorSpinner.setAdapter(adapter);
      userMajorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
        @Override public void onItemSelected(        AdapterView<?> adapterView,        View view,        int i,        long l){
          SurveyManager sm=new SurveyManager(getApplicationContext());
          Cursor c=sm.getFacultyID((String)adapterView.getItemAtPosition(i));
          if (c.moveToFirst()) {
            Utils.setInternalSetting(getApplicationContext(),"String_Node_Str",c.getString(c.getColumnIndex("String_Node_Str")));
          }
          TextView selectedItem=(TextView)adapterView.getChildAt(0);
          if (selectedItem != null) {
            selectedItem.setTextColor(ContextCompat.getColor(getApplicationContext(),R.color.color_primary));
          }
        }
        @Override public void onNothingSelected(        AdapterView<?> adapterView){
        }
      }
);
      return;
    }
  }
.execute();
}