[
https://issues.apache.org/jira/browse/CB-8861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14512702#comment-14512702
]
Iuri de Silvio commented on CB-8861:
------------------------------------
Sure! I'm using Android 4.4. I did some research to help with this issue.
When the server return anything different than a good request, Java answer for
`connection.getOutputStream()` with an `FileNotFoundException`. Check [1] for a
good SO answer.
You must `getResponseCode()` before calling `getOutputStream` [2].
The problem is not with 403 errors. Most server errors can raise a
`FileNotFoundException` and you just catch this exception and answer with
`FileTransferError.FILE_NOT_FOUND_ERR`.
I think the `FileNotFoundException` should return `FILE_NOT_FOUND_ERR` only if
it happens reading the file [3]. If you are able to do the request, the error
code must be something else or documentation must be changed.
Thanks!
[1] http://stackoverflow.com/a/5180148/617395
[2]
https://github.com/apache/cordova-plugin-file-transfer/blob/0aae94495f68ef110cfcc4b3e0900d4b3a30ce46/src/android/FileTransfer.java#L416
[3]
https://github.com/apache/cordova-plugin-file-transfer/blob/0aae94495f68ef110cfcc4b3e0900d4b3a30ce46/src/android/FileTransfer.java#L388
> Server errors raise FILE_NOT_FOUND_ERR
> --------------------------------------
>
> Key: CB-8861
> URL: https://issues.apache.org/jira/browse/CB-8861
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File Transfer
> Reporter: Iuri de Silvio
>
> 403 server errors cause FileTransferError.FILE_NOT_FOUND_ERR. I'm using
> Android 4.4.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]