[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-11-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14990121#comment-14990121
 ] 

ASF subversion and git services commented on CB-9752:
-

Commit a26070f435b810ceabc3c82efcc8294820be737b in cordova-plugin-file's branch 
refs/heads/master from riknoll
[ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file.git;h=a26070f ]

Merge remote-tracking branch 'jasongin/CB-9752'


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-11-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14990122#comment-14990122
 ] 

ASF GitHub Bot commented on CB-9752:


Github user asfgit closed the pull request at:

https://github.com/apache/cordova-plugin-file/pull/144


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-11-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14990117#comment-14990117
 ] 

ASF subversion and git services commented on CB-9752:
-

Commit 76c8fd5e43598ea660c2db64eb08e2659b45a575 in cordova-plugin-file's branch 
refs/heads/master from [~jasongin]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file.git;h=76c8fd5 ]

Fix CB-9752: getDirectory fails on valid directory with assets filesystem

Calls to FileEntry.getDirectory() on an asset entry would internally call
the AssetFileSystem.listAssets() method using an asset path with a
trailing slash, regardless of whether a trailing slash was included by
the user. But neither the asset list cache (from cdvasset.manifest) nor
Android's AssetManager.list() API support matching a path with a trailing
slash. That resulted in a TypeMismatchException thrown from
AssetFileSystem.getFileForLocalURL(), because the asset path was found
but not matched as a directory as expected by the caller.

This fix removes the trailing slash from the asset path before matching
against the asset list cache or calling Android's AssetManager.list() API.
A new unit test for getting asset directories fails without and passes
with the fix.

While I'm here, I'm also adding a unit test for reading asset file
contents. There are a couple old bug reports about that (CB-7273,
CB-8350). The bugs don't repro anymore, but I'm adding the test anyway
since there wasn't good test coverage before.


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-11-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14988390#comment-14988390
 ] 

ASF GitHub Bot commented on CB-9752:


Github user riknoll commented on the pull request:


https://github.com/apache/cordova-plugin-file/pull/144#issuecomment-153517264
  
LGTM. Tested on an Android 6.0 device and on an Android 5.1.1 emulator and 
ran mobilespec. I'll merge this in at the end of the day.


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-10-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14983388#comment-14983388
 ] 

ASF GitHub Bot commented on CB-9752:


Github user jasongin commented on the pull request:


https://github.com/apache/cordova-plugin-file/pull/144#issuecomment-152657405
  
@infil00p or @riknoll can you review?


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-10-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14983433#comment-14983433
 ] 

ASF GitHub Bot commented on CB-9752:


Github user jasongin commented on the pull request:


https://github.com/apache/cordova-plugin-file/pull/144#issuecomment-152661034
  
Oh, yeah "unit test" was probably not the right term.


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-10-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14982864#comment-14982864
 ] 

ASF GitHub Bot commented on CB-9752:


GitHub user jasongin opened a pull request:

https://github.com/apache/cordova-plugin-file/pull/144

Fix CB-9752: FileEntry.getDirectory fails with assets filesystem

Calls to FileEntry.getDirectory() on an asset entry would internally call
the AssetFileSystem.listAssets() method using an asset path with a
trailing slash, regardless of whether a trailing slash was included by
the user. But neither the asset list cache (from cdvasset.manifest) nor
Android's AssetManager.list() API support matching a path with a trailing
slash. That resulted in a TypeMismatchException thrown from
AssetFileSystem.getFileForLocalURL(), because the asset path was found
but not matched as a directory as expected by the caller.

This fix removes the trailing slash from the asset path before matching
against the asset list cache or calling Android's AssetManager.list() API.
A new unit test for getting asset directories fails without and passes
with the fix.

While I'm here, I'm also adding a unit test for reading asset file
contents. There are a couple old bug reports about that (CB-7273,
CB-8350). The bugs don't repro anymore, but I'm adding the test anyway
since there wasn't good test coverage before.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jasongin/cordova-plugin-file CB-9752

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-plugin-file/pull/144.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #144


commit 76c8fd5e43598ea660c2db64eb08e2659b45a575
Author: Jason Ginchereau 
Date:   2015-10-28T21:30:24Z

Fix CB-9752: getDirectory fails on valid directory with assets filesystem

Calls to FileEntry.getDirectory() on an asset entry would internally call
the AssetFileSystem.listAssets() method using an asset path with a
trailing slash, regardless of whether a trailing slash was included by
the user. But neither the asset list cache (from cdvasset.manifest) nor
Android's AssetManager.list() API support matching a path with a trailing
slash. That resulted in a TypeMismatchException thrown from
AssetFileSystem.getFileForLocalURL(), because the asset path was found
but not matched as a directory as expected by the caller.

This fix removes the trailing slash from the asset path before matching
against the asset list cache or calling Android's AssetManager.list() API.
A new unit test for getting asset directories fails without and passes
with the fix.

While I'm here, I'm also adding a unit test for reading asset file
contents. There are a couple old bug reports about that (CB-7273,
CB-8350). The bugs don't repro anymore, but I'm adding the test anyway
since there wasn't good test coverage before.




> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-10-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14983422#comment-14983422
 ] 

ASF GitHub Bot commented on CB-9752:


Github user infil00p commented on the pull request:


https://github.com/apache/cordova-plugin-file/pull/144#issuecomment-152660125
  
Where are you adding the unit test? We currently don't have a way to unit 
test plugins.


> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-9752) getDirectory fails on valid directory with assets filesystem

2015-10-28 Thread Jason Ginchereau (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-9752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14979202#comment-14979202
 ] 

Jason Ginchereau commented on CB-9752:
--

I've reproduced this bug, both with and without the cdvasset.manifest file 
added via the file plugin's build-extras.gradle. The fix looks simple; I'll 
submit a PR soon.

> getDirectory fails on valid directory with assets filesystem
> 
>
> Key: CB-9752
> URL: https://issues.apache.org/jira/browse/CB-9752
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, Plugin File
> Environment: cordova 5.3.3
> cordova android 4.0.0
> cordova-plugin-file 2.0.0
> *** using build-extras.gradle to speed up lookups (as per README.md for 
> plugin) ***
>Reporter: Denis Babineau
>Assignee: Jason Ginchereau
>
> The following JS snippet fails with "failed to get www directory":
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(appDir) {
> appDir.getDirectory('www', {create:false}, function(wwwDir) {
> console.log("success!");
> }, function() {
> console.log("failed to get www directory");
> });
> }, function() {
> console.log("Failed to get application directory");
> });
> I narrowed it down to AssetFilesystem.java's listAssets() method called from 
> isDirectory() which returns the "new String[0];" (assetPath = 'www/' in this 
> method) which in turn causes isDirectory() to return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org