public R finish ( ) throws X , DbxException { assertOpenAndUnfinished ( ) ; HttpRequestor . Response response = null ; try { response = httpUploader . finish ( ) ; try { if ( response . getStatusCode ( ) == 200 ) { return responseSerializer . deserialize ( response . getBody ( ) ) ; } else if ( response . getStatusCode ( ) == 409 ) { DbxWrappedException wrapped = DbxWrappedException . fromResponse ( errorSerializer , response , this . userId ) ; throw newException ( wrapped ) ; } else { throw DbxRequestUtil . unexpectedStatus ( response ) ; } } catch ( JsonProcessingException ex ) { String requestId = DbxRequestUtil . getRequestId ( response ) ; throw new BadResponseException ( requestId , "Bad JSON in response: " + ex , ex ) ; } } catch ( IOException ex ) { throw new NetworkIOException ( ex ) ; } finally { // Make sure input stream is closed if ( response != null ) { IOUtil . closeQuietly ( response . getBody ( ) ) ; } finished = true ; } }
Completes the request and returns response from the server .