Buggy code:
public void addDatatransferProgressListener ( OnDatatransferProgressListener listener ) { } public void removeDatatransferProgressListener ( OnDatatransferProgressListener listener ) { } @ Override protected RemoteOperationResult run ( OwnCloudClient client ) { RemoteOperationResult result = null ; boolean localCopyPassed = false ; boolean nameCheckPassed = false ; File temporalFile = null ; File originalFile = new File ( mOriginalStoragePath ) ; File expectedFile = null ; try { if ( ! ( mForceOverwrite ) ) { String remotePath = getAvailableRemotePath ( client , mRemotePath ) ; mWasRenamed = ! ( remotePath . equals ( mRemotePath ) ) ; if ( mWasRenamed ) { createNewOCFile ( remotePath ) ; } } nameCheckPassed = true ; String expectedPath = FileStorageUtils . getDefaultSavePathFor ( mAccount . name , mFile ) ; expectedFile = new File ( expectedPath ) ; if ( ( ! ( mOriginalStoragePath . equals ( expectedPath ) ) ) && ( ( mLocalBehaviour ) == ( FileUploader . LOCAL_BEHAVIOUR_COPY ) ) ) { if ( ( FileStorageUtils . getUsableSpace ( mAccount . name ) ) < ( originalFile . length ( ) ) ) { result = new RemoteOperationResult ( ResultCode . LOCAL_STORAGE_FULL ) ; return result ; } else { String temporalPath = ( FileStorageUtils . getTemporalPath ( mAccount . name ) ) + ( mFile . getRemotePath ( ) ) ; mFile . setStoragePath ( temporalPath ) ; temporalFile = new File ( temporalPath ) ; File temporalParent = temporalFile . getParentFile ( ) ; temporalParent . mkdirs ( ) ; if ( ! ( temporalParent . isDirectory ( ) ) ) { throw new IOException ( "Unexpected<seq2seq4repair_space>error:<seq2seq4repair_space>parent<seq2seq4repair_space>directory<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>created" ) ; } temporalFile . createNewFile ( ) ; if ( ! ( temporalFile . isFile ( ) ) ) { throw new IOException ( "Unexpected<seq2seq4repair_space>error:<seq2seq4repair_space>target<seq2seq4repair_space>file<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>created" ) ; } InputStream in = null ; OutputStream out = null ; try { if ( mOriginalStoragePath . startsWith ( URI_CONTENT_SCHEME ) ) { Uri uri = Uri . parse ( mOriginalStoragePath ) ; in = MainApp . getAppContext ( ) . getContentResolver ( ) . openInputStream ( uri ) ; out = new FileOutputStream ( temporalFile ) ; int nRead ; byte [ ] data = new byte [ 16384 ] ; while ( ( ! ( mCancellationRequested . get ( ) ) ) && ( ( nRead = in . read ( data , 0 , data . length ) ) != ( - 1 ) ) ) { out . write ( data , 0 , nRead ) ; } out . flush ( ) ; } else { if ( ! ( mOriginalStoragePath . equals ( temporalPath ) ) ) { in = new FileInputStream ( originalFile ) ; out = new FileOutputStream ( temporalFile ) ; byte [ ] buf = new byte [ 1024 ] ; int len ; while ( ( ! ( mCancellationRequested . get ( ) ) ) && ( ( len = in . read ( buf ) ) > 0 ) ) { out . write ( buf , 0 , len ) ; } } } if ( mCancellationRequested . get ( ) ) { result = new RemoteOperationResult ( new OperationCancelledException ( ) ) ; } } catch ( Exception e ) { result = new RemoteOperationResult ( ResultCode . LOCAL_STORAGE_NOT_COPIED ) ; return result ; } finally { try { if ( in != null ) in . close ( ) ; } catch ( Exception e ) { Log_OC . d ( UploadFileOperation . TAG , ( ( "Weird<seq2seq4repair_space>exception<seq2seq4repair_space>while<seq2seq4repair_space>closing<seq2seq4repair_space>input<seq2seq4repair_space>stream<seq2seq4repair_space>for<seq2seq4repair_space>" + ( mOriginalStoragePath ) ) + "<seq2seq4repair_space>(ignoring)" ) , e ) ; } try { if ( out != null ) out . close ( ) ; } catch ( Exception e ) { Log_OC . d ( UploadFileOperation . TAG , ( ( "Weird<seq2seq4repair_space>exception<seq2seq4repair_space>while<seq2seq4repair_space>closing<seq2seq4repair_space>output<seq2seq4repair_space>stream<seq2seq4repair_space>for<seq2seq4repair_space>" + expectedPath ) + "<seq2seq4repair_space>(ignoring)" ) , e ) ; } } } } <START_BUG> localCopyPassed = result . isSuccess ( ) ; <END_BUG> if ( ( mChunked ) && ( ( new File ( mFile . getStoragePath ( ) ) . length ( ) ) > ( ChunkedUploadRemoteFileOperation . CHUNK_SIZE ) ) ) { mUploadOperation = new ChunkedUploadRemoteFileOperation ( mFile . getStoragePath ( ) , mFile . getRemotePath ( ) , mFile . getMimetype ( ) ) ; } else { mUploadOperation = new UploadRemoteFileOperation ( mFile . getStoragePath ( ) , mFile . getRemotePath ( ) , mFile . getMimetype ( ) ) ; } Iterator < OnDatatransferProgressListener > listener = mDataTransferListeners . iterator ( ) ; while ( listener . hasNext ( ) ) { mUploadOperation . addDatatransferProgressListener ( listener . next ( ) ) ; } if ( ! ( mCancellationRequested . get ( ) ) ) { result = mUploadOperation . execute ( client ) ; if ( result . isSuccess ( ) ) { if ( ( mLocalBehaviour ) == ( FileUploader . LOCAL_BEHAVIOUR_FORGET ) ) { mFile . setStoragePath ( null ) ; } else { mFile . setStoragePath ( expectedPath ) ; File fileToMove = null ; if ( temporalFile != null ) { fileToMove = temporalFile ; } else { fileToMove = originalFile ; } if ( ! ( expectedFile . equals ( fileToMove ) ) ) { File expectedFolder = expectedFile . getParentFile ( ) ; expectedFolder . mkdirs ( ) ; if ( ( ! ( expectedFolder . isDirectory ( ) ) ) || ( ! ( fileToMove . renameTo ( expectedFile ) ) ) ) { mFile . setStoragePath ( null ) ; } } } } } } catch ( Exception e ) { if ( mCancellationRequested . get ( ) ) { result = new RemoteOperationResult ( new OperationCancelledException ( ) ) ; } else { result = new RemoteOperationResult ( e ) ; } } finally { if ( ( temporalFile != null ) && ( ! ( originalFile . equals ( temporalFile ) ) ) ) { temporalFile . delete ( ) ; }

Fix:
localCopyPassed = result == null ;