You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Andreas Sommer (JIRA)" <ji...@apache.org> on 2012/06/17 17:13:42 UTC
[jira] [Created] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Andreas Sommer created CB-930:
---------------------------------
Summary: DirectoryReader creates null error code for inaccessible directory
Key: CB-930
URL: https://issues.apache.org/jira/browse/CB-930
Project: Apache Cordova
Issue Type: Bug
Components: Android
Affects Versions: 1.8.1
Reporter: Andreas Sommer
Assignee: Joe Bowser
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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Andreas Sommer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13395965#comment-13395965 ]
Andreas Sommer commented on CB-930:
-----------------------------------
This directory is automatically created by Android (2.3.3) on the SD card and contains .asec files. I think they are apps that were moved to the SD card, so maybe you want to move at least one app in order to create the directory. You're right, there are no permissions since it's a FAT filesystem, but I assume the Android operating system automatically applies restrictions on that directory.
It's fine to not have access, but the error code should be a number as defined in the W3C file API (https://developer.mozilla.org/en/DOM/File_API/File_System_API/FileError).
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397490#comment-13397490 ]
Simon MacDonald commented on CB-930:
------------------------------------
The FileUtils.java file is where the error PluginResult is returned. As you can see in all error cases it returns a code for each error it runs into. You'll need to look at the https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=blob;f=lib/common/plugin/FileError.js;h=7f538fe182b1c1867803cfb990026d04afd00867;hb=HEAD file. As you can see the FileError constructor sets code equal to the returned error or null. This is where I think we are getting the null value but it should only be null if the error value is not set or is set to 0 but none of our errors in FileUtils return a 0.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Andreas Sommer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397488#comment-13397488 ]
Andreas Sommer commented on CB-930:
-----------------------------------
Maybe you can create the folder manually using DDMS, not sure.
Can you tell me where to find the code that actually sets that "code" in the error object? Did not find it anywhere (in the repo git://git.apache.org/incubator-cordova-android.git). I merely found createFileTransferError which also uses a "code" property in the result, but I think that's unrelated. I looked in FileUtils.java and noticed that SECURITY_ERR etc. are unused.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald resolved CB-930.
--------------------------------
Resolution: Fixed
Fix Version/s: 2.1.0
Great, thanks for testing. I've added the fix to the main Android repo.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
> Fix For: 2.1.0
>
> Attachments: cordova-2.0.0.jar, index.js, logcat.txt
>
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald updated CB-930:
-------------------------------
Attachment: cordova-2.0.0.jar
Possible fix for the issue. Need someone who can reproduce it to test.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
> Attachments: cordova-2.0.0.jar, index.js, logcat.txt
>
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13395908#comment-13395908 ]
Simon MacDonald commented on CB-930:
------------------------------------
I'm not quite sure how to get this directory on my sd card any ideas? Also, it seems weird that there would be an error reading the directory on sd card as there are no permissions on the sd card. Can you give us some more info in order to figure out how to fix it?
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396825#comment-13396825 ]
Simon MacDonald commented on CB-930:
------------------------------------
Yeah, for some reason my three Samsung devices will not let me move an app to the SD Card in order to create this directory. I've done a code review and I can't see why the error code would be set to null. All of the error codes look like they are getting set correctly. I need to get ahold of a device where I can debug this.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (CB-930) DirectoryReader creates null error
code for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433649#comment-13433649 ]
Simon MacDonald edited comment on CB-930 at 8/14/12 9:17 AM:
-------------------------------------------------------------
Possible fix for the issue. Need someone who can reproduce it to test. Before I add a file to the list returned by readEntries I make sure it is in fact readable.
was (Author: macdonst):
Possible fix for the issue. Need someone who can reproduce it to test.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
> Attachments: cordova-2.0.0.jar, index.js, logcat.txt
>
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Andreas Sommer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13398635#comment-13398635 ]
Andreas Sommer commented on CB-930:
-----------------------------------
I found out that "function FileError(error)" actually gets an empty string as "error" parameter and there are some places in the Java code where an empty string is returned. Unfortunately I don't have the time right now to dig deeper.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Braden Shepherdson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434291#comment-13434291 ]
Braden Shepherdson commented on CB-930:
---------------------------------------
I tried with your cordova.jar and cannot reproduce this issue. The directory scan does not find the .android_secure directory at all, and no errors are returned. That seems like correct behavior to me.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
> Attachments: cordova-2.0.0.jar, index.js, logcat.txt
>
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald reassigned CB-930:
----------------------------------
Assignee: Simon MacDonald (was: Joe Bowser)
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (CB-930) DirectoryReader creates null error
code for inaccessible directory
Posted by "Braden Shepherdson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434291#comment-13434291 ]
Braden Shepherdson edited comment on CB-930 at 8/15/12 4:38 AM:
----------------------------------------------------------------
I can normally reproduce this issue. I tried with your cordova.jar and cannot reproduce.
The directory scan does not find the .android_secure directory at all, and no errors are returned. That seems like correct behavior to me.
was (Author: shepheb):
I tried with your cordova.jar and cannot reproduce this issue. The directory scan does not find the .android_secure directory at all, and no errors are returned. That seems like correct behavior to me.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
> Attachments: cordova-2.0.0.jar, index.js, logcat.txt
>
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-930) DirectoryReader creates null error code
for inaccessible directory
Posted by "Braden Shepherdson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Braden Shepherdson updated CB-930:
----------------------------------
Attachment: logcat.txt
index.js
Attached are my logcat and code from an attempt to reproduce this on the 4.0 simulator. It seems to match the given behavior fairly well. I'm debugging to see what the response was from the native filesystem code.
> DirectoryReader creates null error code for inaccessible directory
> ------------------------------------------------------------------
>
> Key: CB-930
> URL: https://issues.apache.org/jira/browse/CB-930
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.8.1
> Reporter: Andreas Sommer
> Assignee: Simon MacDonald
> Attachments: index.js, logcat.txt
>
>
> 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)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira