Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-930

DirectoryReader creates null error code for inaccessible directory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.1
    • 2.1.0
    • cordova-android
    • None

    Description

      The error callback should follow the FileError specification which defines e.g. SECURITY_ERR=2 as error code. When I try to access file:///mnt/sdcard/.android_secure which is protected by the OS, I get the error code null.

      Example to reproduce (using Android 4.0 emulator):

      document.addEventListener("deviceready", function() {
      window.requestFileSystem(
      LocalFileSystem.PERSISTENT,
      0,
      function(fileSystem) {
      var reader = fileSystem.root.createReader().readEntries(function(entries) {
      for(var i = 0; i < entries.length; ++i)
      if(/\.android_secure$/.test(entries[i].fullPath))
      entries[i].createReader().readEntries(function(entries) {
      for(var i = 0; i < entries.length; ++i)

      { if(entries[i].isDirectory) console.log("dir " + entries[i].fullPath) else console.log("file " + entries[i].fullPath) }

      }, function(err) {
      //////////////////////////////////////
      // The following error occurs and the JSON representation is

      {"code":null}

      //////////////////////////////////////
      console.log("Failed to read .android_secure directory (error code " + err.code +")")
      console.log("JSON error: " + Ext.JSON.encode(err))
      //////////////////////////////////////
      })
      }, function(err)

      { console.log("Failed to read directory entries of " + entry.fullPath + " (error code " + err.code +")") }

      )
      },
      function(err)

      { alert("Failed to read file system (error code " + err.code +")") }

      )
      }, false)

      Attachments

        1. cordova-2.0.0.jar
          177 kB
          Simon MacDonald
        2. index.js
          2 kB
          Braden Shepherdson
        3. logcat.txt
          0.1 kB
          Braden Shepherdson

        Activity

          People

            macdonst Simon MacDonald
            andidog Andreas Sommer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: