Buggy code:
PortalEvent . OperationResult operationResult = OperationResult . values ( ) [ cursor . getInt ( operationResultIndex ) ] ; Date date = new Date ( cursor . getLong ( dateIndex ) ) ; String messageId = cursor . getString ( messageIdIndex ) ; if ( operationType == ( OperationType . SUBMISSION ) ) { String imageUrl = cursor . getString ( imageUrlIndex ) ; if ( operationResult == ( OperationResult . ACCEPTED ) ) { String address = cursor . getString ( addressIndex ) ; String addressUrl = cursor . getString ( addressUrlIndex ) ; event = new SubmissionEvent ( name , operationResult , date , messageId , imageUrl , address , addressUrl ) ; } else { event = new SubmissionEvent ( name , operationResult , date , messageId , imageUrl ) ; } } else { if ( operationResult != ( OperationResult . PROPOSED ) ) { String address = cursor . getString ( addressIndex ) ; String addressUrl = cursor . getString ( addressUrlIndex ) ; event = new com . ghostflying . portalwaitinglist . data . EditEvent ( name , operationResult , date , messageId , address , addressUrl ) ; } else { event = new com . ghostflying . portalwaitinglist . data . EditEvent ( name , operationResult , date , messageId ) ; } } portalEvents . add ( event ) ; } cursor . close ( ) ; database . close ( ) ; MailProcessUtil processUtil = MailProcessUtil . getInstance ( ) ; processUtil . mergeEvents ( totalPortalDetails , portalEvents ) ; counts = processUtil . getCounts ( totalPortalDetails ) ; processUtil . filterAndSort ( SettingUtil . getTypeFilterMethod ( ) , SettingUtil . getResultFilterMethod ( ) , SettingUtil . getSortOrder ( ) , totalPortalDetails , ( ( PortalListAdapter ) ( recyclerView . getAdapter ( ) ) ) . dataSet ) ; return null ; } @ Override protected void onPostExecute ( Void param ) { } } private void showToast ( final int resId ) { } private class RefreshTask extends AsyncTask < Void , Void , Void > { int [ ] portalCounts ; String refreshResult ; @ Override protected Void doInBackground ( Void ... params ) { while ( ! ( isInitialed ) ) ; if ( getToken ( ) ) return null ; GMailServiceUtil fetchUtil = GMailServiceUtil . getInstance ( token , false ) ; MailProcessUtil processUtil = MailProcessUtil . getInstance ( ) ; ArrayList < Message > newMessages ; try { newMessages = fetchUtil . getPortalMessages ( dbHelper ) ; } catch ( Exception e ) { if ( handleException ( e ) ) return null ; else { if ( getToken ( ) ) return null ; fetchUtil = GMailServiceUtil . getInstance ( token , true ) ; try { newMessages = fetchUtil . getPortalMessages ( dbHelper ) ; } catch ( Exception e1 ) { handleException ( e1 , true ) ; return null ; } } } ArrayList < PortalEvent > newEvents = MailProcessUtil . getInstance ( ) . analysisMessages ( newMessages ) ; SQLiteDatabase db = dbHelper . getWritableDatabase ( ) ; ContentValues values ; for ( PortalEvent event : newEvents ) { values = new ContentValues ( ) ; values . put ( COLUMN_NAME_PORTAL_NAME , event . getPortalName ( ) ) ; values . put ( COLUMN_NAME_OPERATION_TYPE , event . getOperationType ( ) . ordinal ( ) ) ; values . put ( COLUMN_NAME_OPERATION_RESULT , event . getOperationResult ( ) . ordinal ( ) ) ; values . put ( COLUMN_NAME_DATE , event . getDate ( ) . getTime ( ) ) ; values . put ( COLUMN_NAME_MESSAGE_ID , event . getMessageId ( ) ) ; <START_BUG> if ( ( event instanceof SubmissionEvent ) && ( ( event . getOperationResult ( ) ) != ( OperationResult . ACCEPTED ) ) ) { <END_BUG> values . put ( COLUMN_NAME_IMAGE_URL , ( ( SubmissionEvent ) ( event ) ) . getPortalImageUrl ( ) ) ; } else { if ( ( event . getOperationResult ( ) ) != ( OperationResult . PROPOSED ) ) { values . put ( COLUMN_NAME_ADDRESS , event . getPortalAddress ( ) ) ; values . put ( COLUMN_NAME_ADDRESS_URL , event . getPortalAddressUrl ( ) ) ; } } db . insert ( TABLE_NAME , null , values ) ; } db . close ( ) ; processUtil . mergeEvents ( totalPortalDetails , newEvents ) ; portalCounts = processUtil . getCounts ( totalPortalDetails ) ; int [ ] eventCounts = processUtil . getEventCountsInLastProcess ( ) ; generateRefreshResultSummary ( eventCounts ) ; processUtil . filterAndSort ( SettingUtil . getTypeFilterMethod ( ) , SettingUtil . getResultFilterMethod ( ) , SettingUtil . getSortOrder ( ) , totalPortalDetails , ( ( PortalListAdapter ) ( recyclerView . getAdapter ( ) ) ) . dataSet ) ; return null ; } private void generateRefreshResultSummary ( int [ ] eventCounts ) { } private boolean getToken ( ) { } private boolean handleException ( final Exception e , boolean retry ) { } private boolean handleException ( final Exception e ) { } private void showRefreshResult ( String result ) { } @ Override protected void onPostExecute ( Void param ) { } } private abstract class SortAndFilterBaseTask extends AsyncTask < Void , Void , Void > { @ Override protected abstract Void doInBackground ( Void ... params ) ; @ Override protected void onPostExecute ( Void param ) { } } private class FilterTask extends PortalListFragment . SortAndFilterBaseTask { @ Override protected Void doInBackground ( Void ... params ) { MailProcessUtil . getInstance ( ) . filterAndSort ( SettingUtil . getTypeFilterMethod ( ) , SettingUtil . getResultFilterMethod ( ) , SettingUtil . getSortOrder ( ) , totalPortalDetails , ( ( PortalListAdapter ) ( recyclerView . getAdapter ( ) ) ) . dataSet ) ; return null ; } @ Override protected void onPostExecute ( Void param ) { }

Fix:
if ( event instanceof SubmissionEvent ) {