Apache Cordova
  1. Apache Cordova
  2. CB-2171

FileTransfer.download leaves 0 byte file in filesystem on 404 from server

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.4.0
    • Component/s: Android
    • Labels:
      None
    • Environment:

      Android 2.3.

      Description

      To reproduce:

      Call fileTransfer.download, passing a URL which returns 404.

      Error callback will be correctly fired. But 0-byte file will be left on filesystem. This is because:

      FileOutputStream outputStream = new FileOutputStream(file);

      is called before the getInputStream is called.

        Activity

        Clayton Grassick created issue -
        Show
        Joe Bowser added a comment - https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=commit;h=7ace1d652d665c850941531c18cdc55b9c7981b3
        Joe Bowser made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.4.0 [ 12323473 ]
        Resolution Fixed [ 1 ]
        Hide
        Clayton Grassick added a comment -

        outputStream = new FileOutputStream(file);

        should happen after

        inputStream = getInputStream(connection);

        to prevent the issue, not before.

        Show
        Clayton Grassick added a comment - outputStream = new FileOutputStream(file); should happen after inputStream = getInputStream(connection); to prevent the issue, not before.
        Clayton Grassick made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Joe Bowser added a comment -

        Pull requests are welcome!

        Show
        Joe Bowser added a comment - Pull requests are welcome!
        Joe Bowser made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        2h 9m 1 Joe Bowser 08/Jan/13 21:55
        Resolved Resolved Reopened Reopened
        2h 13m 1 Clayton Grassick 09/Jan/13 00:08
        Reopened Reopened Resolved Resolved
        2d 19h 18m 1 Joe Bowser 11/Jan/13 19:27

          People

          • Assignee:
            Joe Bowser
            Reporter:
            Clayton Grassick
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development