Buggy code:
public class EditPeopleControlSet extends PopupControlSet { public static final String EXTRA_TASK_ID = "task" ; private Task task ; private final ArrayList < Metadata > nonSharedTags = new ArrayList < Metadata > ( ) ; @ Autowired ActFmPreferenceService actFmPreferenceService ; @ Autowired ActFmSyncService actFmSyncService ; @ Autowired TaskService taskService ; @ Autowired MetadataService metadataService ; @ Autowired ExceptionService exceptionService ; @ Autowired TagDataService tagDataService ; private final PeopleContainer sharedWithContainer ; private final CheckBox cbFacebook ; private final CheckBox cbTwitter ; private final View sharedWithRow ; private final View sharedWithView ; private final Dialog sharedWithDialog ; private final ListView assignedList ; private final TextView assignedDisplay ; private final EditText assignedCustom ; private final ArrayList < EditPeopleControlSet . AssignedToUser > listValues = new ArrayList < EditPeopleControlSet . AssignedToUser > ( ) ; private String saveToast = null ; private final int loginRequestCode ; public EditPeopleControlSet ( Activity activity , int viewLayout , int displayViewLayout , int title , int loginRequestCode ) { } @ Override public void readFromTask ( Task sourceTask ) { } public View getSharedWithRow ( ) { } private View getSharedWithView ( ) { } @ SuppressWarnings ( "nls" ) private void setUpData ( ) { } @ SuppressWarnings ( "nls" ) private void buildCollaborators ( final ArrayList < JSONObject > sharedPeople ) throws JSONException { } public static class AssignedToUser { public String label ; public JSONObject user ; public AssignedToUser ( String label , JSONObject user ) { } @ Override public String toString ( ) { } } @ SuppressWarnings ( "nls" ) private void buildAssignedToSpinner ( ArrayList < JSONObject > sharedPeople ) throws JSONException { HashSet < Long > userIds = new HashSet < Long > ( ) ; HashSet < String > emails = new HashSet < String > ( ) ; HashMap < String , EditPeopleControlSet . AssignedToUser > names = new HashMap < String , EditPeopleControlSet . AssignedToUser > ( ) ; <START_BUG> if ( ( task . getValue ( USER_ID ) ) != 0 ) { <END_BUG> JSONObject user = new JSONObject ( task . getValue ( USER ) ) ; sharedPeople . add ( 0 , user ) ; } JSONObject myself = new JSONObject ( ) ; myself . put ( "id" , 0L ) ; sharedPeople . add ( 0 , myself ) ; JSONObject unassigned = new JSONObject ( ) ; unassigned . put ( "id" , ( - 1L ) ) ; sharedPeople . add ( 1 , unassigned ) ; listValues . clear ( ) ; for ( int i = 0 ; i < ( sharedPeople . size ( ) ) ; i ++ ) { JSONObject person = sharedPeople . get ( i ) ; if ( person == null ) continue ; long id = person . optLong ( "id" , ( - 2 ) ) ; if ( ( id == ( ActFmPreferenceService . userId ( ) ) ) || ( ( id >= ( - 1 ) ) && ( userIds . contains ( id ) ) ) ) continue ; userIds . add ( id ) ; String email = person . optString ( "email" ) ; if ( ( ! ( TextUtils . isEmpty ( email ) ) ) && ( emails . contains ( email ) ) ) continue ; emails . add ( email ) ; String name = person . optString ( "name" ) ; if ( id == 0 ) name = activity . getString ( actfm_EPA_assign_me ) ; if ( id == ( - 1 ) ) name = activity . getString ( actfm_EPA_unassigned ) ; EditPeopleControlSet . AssignedToUser atu = new EditPeopleControlSet . AssignedToUser ( name , person ) ; listValues . add ( atu ) ; if ( names . containsKey ( name ) ) { EditPeopleControlSet . AssignedToUser user = names . get ( name ) ; if ( ( user != null ) && ( user . user . has ( "email" ) ) ) { user . label += ( "<seq2seq4repair_space>(" + ( user . user . optString ( "email" ) ) ) + ")" ; names . put ( name , null ) ; } if ( ! ( TextUtils . isEmpty ( "email" ) ) ) atu . label += ( "<seq2seq4repair_space>(" + email ) + ")" ; } else if ( TextUtils . isEmpty ( name ) ) { if ( ! ( TextUtils . isEmpty ( "email" ) ) ) atu . label = email ; else listValues . remove ( atu ) ; } else names . put ( name , atu ) ; } String assignedStr = task . getValue ( USER ) ; int assignedIndex = 0 ; if ( ! ( TextUtils . isEmpty ( assignedStr ) ) ) { JSONObject assigned = new JSONObject ( assignedStr ) ; long assignedId = assigned . optLong ( "id" , ( - 2 ) ) ; String assignedEmail = assigned . optString ( "email" ) ; for ( int i = 0 ; i < ( listValues . size ( ) ) ; i ++ ) { JSONObject user = listValues . get ( i ) . user ; if ( user != null ) { if ( ( ( user . optLong ( "id" ) ) == assignedId ) || ( ( user . optString ( "email" ) . equals ( assignedEmail ) ) && ( ! ( TextUtils . isEmpty ( assignedEmail ) ) ) ) ) assignedIndex = i ; } } } final int selected = assignedIndex ; final EditPeopleControlSet . AssignedUserAdapter usersAdapter = new EditPeopleControlSet . AssignedUserAdapter ( activity , listValues ) ; activity . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { assignedList . setAdapter ( usersAdapter ) ; assignedList . setItemChecked ( selected , true ) ; refreshDisplayView ( ) ; } } ) ; }

Fix:
if ( ( task . getValue ( USER_ID ) ) > 0 ) {