[jira] [Commented] (CB-13923) CordovaResourceApi.java method OpenForReadResult returns a -1 length

2018-07-11 Thread ASF subversion and git services (JIRA)


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

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

Commit 1702b6470fdcb7b74e2e0981b0787bf2e565b920 in cordova-android's branch 
refs/heads/7.1.x from [~anthony.ward]
[ https://gitbox.apache.org/repos/asf?p=cordova-android.git;h=1702b64 ]

CB-13923 (android) fix -1 length for compressed files


> CordovaResourceApi.java method OpenForReadResult returns a -1 length
> 
>
> Key: CB-13923
> URL: https://issues.apache.org/jira/browse/CB-13923
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-android
>Affects Versions: cordova-android-7.0.0
> Environment: cordova 8.0.0
> cordova-android 7.0.0
> cordova-plugin-file 6.0.1
>Reporter: Anthony Ward
>Assignee: Joe Bowser
>Priority: Major
>
> Here are details to recreate:
> [https://github.com/AnthonyWard/cordova-file-plugin-bug]
> In *cordova-android* the CordovaResourceApi.java -> OpenForReadResult method 
> returns a -1 length in certain circumstances.
> This has a knock on effect to the *cordova-plugin-file* > Filesystem.java > 
> readFileAtURL method, causing file corruption as each chunk effectively has 
> no end.
> There is a possible fix in the plugin cordova-plugin-file already proposed
> [https://github.com/apache/cordova-plugin-file/pull/217]
> https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
> Or I propose it could be fixed upstream in cordova-android here:
> [https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaResourceApi.java]
> In the method OpenForReadResult there is one path (in the catch) that leaves 
> the length as -1 causing the defect
> try
> {
> assetFd = assetManager.openFd(assetPath);
> inputStream = assetFd.createInputStream(); length = assetFd.getLength();
> }
> catch (FileNotFoundException e)
> {
> // Will occur if the file is compressed.
> inputStream = assetManager.open(assetPath);
> }
> Adding length = inputStream.available(); in the catch fixes the issue for me, 
> but I'm not a java developer so can't evaluate if that's a bad idea for 
> another reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CB-13923) CordovaResourceApi.java method OpenForReadResult returns a -1 length

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CB-13923:
-

infil00p closed pull request #433: CB-13923 (android) fix -1 length for 
compressed files
URL: https://github.com/apache/cordova-android/pull/433
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java 
b/framework/src/org/apache/cordova/CordovaResourceApi.java
index e725e2555..3c438e21b 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -263,6 +263,7 @@ public OpenForReadResult openForRead(Uri uri, boolean 
skipThreadCheck) throws IO
 } catch (FileNotFoundException e) {
 // Will occur if the file is compressed.
 inputStream = assetManager.open(assetPath);
+length = inputStream.available();
 }
 String mimeType = getMimeTypeFromPath(assetPath);
 return new OpenForReadResult(uri, inputStream, mimeType, 
length, assetFd);


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> CordovaResourceApi.java method OpenForReadResult returns a -1 length
> 
>
> Key: CB-13923
> URL: https://issues.apache.org/jira/browse/CB-13923
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-android
>Affects Versions: cordova-android-7.0.0
> Environment: cordova 8.0.0
> cordova-android 7.0.0
> cordova-plugin-file 6.0.1
>Reporter: Anthony Ward
>Assignee: Joe Bowser
>Priority: Major
>
> Here are details to recreate:
> [https://github.com/AnthonyWard/cordova-file-plugin-bug]
> In *cordova-android* the CordovaResourceApi.java -> OpenForReadResult method 
> returns a -1 length in certain circumstances.
> This has a knock on effect to the *cordova-plugin-file* > Filesystem.java > 
> readFileAtURL method, causing file corruption as each chunk effectively has 
> no end.
> There is a possible fix in the plugin cordova-plugin-file already proposed
> [https://github.com/apache/cordova-plugin-file/pull/217]
> https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
> Or I propose it could be fixed upstream in cordova-android here:
> [https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaResourceApi.java]
> In the method OpenForReadResult there is one path (in the catch) that leaves 
> the length as -1 causing the defect
> try
> {
> assetFd = assetManager.openFd(assetPath);
> inputStream = assetFd.createInputStream(); length = assetFd.getLength();
> }
> catch (FileNotFoundException e)
> {
> // Will occur if the file is compressed.
> inputStream = assetManager.open(assetPath);
> }
> Adding length = inputStream.available(); in the catch fixes the issue for me, 
> but I'm not a java developer so can't evaluate if that's a bad idea for 
> another reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CB-13923) CordovaResourceApi.java method OpenForReadResult returns a -1 length

2018-03-07 Thread ASF subversion and git services (JIRA)

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

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

Commit 6abd6d6b477966d6a40420800376d28bacd1d940 in cordova-android's branch 
refs/heads/master from [~bowserj]
[ https://gitbox.apache.org/repos/asf?p=cordova-android.git;h=6abd6d6 ]

Merge pull request #433 from AnthonyWard/master

CB-13923 (android) fix -1 length for compressed files

> CordovaResourceApi.java method OpenForReadResult returns a -1 length
> 
>
> Key: CB-13923
> URL: https://issues.apache.org/jira/browse/CB-13923
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-android
>Affects Versions: cordova-android-7.0.0
> Environment: cordova 8.0.0
> cordova-android 7.0.0
> cordova-plugin-file 6.0.1
>Reporter: Anthony Ward
>Assignee: Joe Bowser
>Priority: Major
>
> Here are details to recreate:
> [https://github.com/AnthonyWard/cordova-file-plugin-bug]
> In *cordova-android* the CordovaResourceApi.java -> OpenForReadResult method 
> returns a -1 length in certain circumstances.
> This has a knock on effect to the *cordova-plugin-file* > Filesystem.java > 
> readFileAtURL method, causing file corruption as each chunk effectively has 
> no end.
> There is a possible fix in the plugin cordova-plugin-file already proposed
> [https://github.com/apache/cordova-plugin-file/pull/217]
> https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
> Or I propose it could be fixed upstream in cordova-android here:
> [https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaResourceApi.java]
> In the method OpenForReadResult there is one path (in the catch) that leaves 
> the length as -1 causing the defect
> try
> {
> assetFd = assetManager.openFd(assetPath);
> inputStream = assetFd.createInputStream(); length = assetFd.getLength();
> }
> catch (FileNotFoundException e)
> {
> // Will occur if the file is compressed.
> inputStream = assetManager.open(assetPath);
> }
> Adding length = inputStream.available(); in the catch fixes the issue for me, 
> but I'm not a java developer so can't evaluate if that's a bad idea for 
> another reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CB-13923) CordovaResourceApi.java method OpenForReadResult returns a -1 length

2018-03-07 Thread ASF subversion and git services (JIRA)

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

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

Commit e456a325f9dddcd938190daebd0568ed96753ea7 in cordova-android's branch 
refs/heads/master from [~anthony.ward]
[ https://gitbox.apache.org/repos/asf?p=cordova-android.git;h=e456a32 ]

CB-13923 (android) fix -1 length for compressed files


> CordovaResourceApi.java method OpenForReadResult returns a -1 length
> 
>
> Key: CB-13923
> URL: https://issues.apache.org/jira/browse/CB-13923
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-android
>Affects Versions: cordova-android-7.0.0
> Environment: cordova 8.0.0
> cordova-android 7.0.0
> cordova-plugin-file 6.0.1
>Reporter: Anthony Ward
>Assignee: Joe Bowser
>Priority: Major
>
> Here are details to recreate:
> [https://github.com/AnthonyWard/cordova-file-plugin-bug]
> In *cordova-android* the CordovaResourceApi.java -> OpenForReadResult method 
> returns a -1 length in certain circumstances.
> This has a knock on effect to the *cordova-plugin-file* > Filesystem.java > 
> readFileAtURL method, causing file corruption as each chunk effectively has 
> no end.
> There is a possible fix in the plugin cordova-plugin-file already proposed
> [https://github.com/apache/cordova-plugin-file/pull/217]
> https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
> Or I propose it could be fixed upstream in cordova-android here:
> [https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaResourceApi.java]
> In the method OpenForReadResult there is one path (in the catch) that leaves 
> the length as -1 causing the defect
> try
> {
> assetFd = assetManager.openFd(assetPath);
> inputStream = assetFd.createInputStream(); length = assetFd.getLength();
> }
> catch (FileNotFoundException e)
> {
> // Will occur if the file is compressed.
> inputStream = assetManager.open(assetPath);
> }
> Adding length = inputStream.available(); in the catch fixes the issue for me, 
> but I'm not a java developer so can't evaluate if that's a bad idea for 
> another reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CB-13923) CordovaResourceApi.java method OpenForReadResult returns a -1 length

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CB-13923:
-

infil00p commented on issue #433: CB-13923 (android) fix -1 length for 
compressed files
URL: https://github.com/apache/cordova-android/pull/433#issuecomment-370883533
 
 
   LGTM


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> CordovaResourceApi.java method OpenForReadResult returns a -1 length
> 
>
> Key: CB-13923
> URL: https://issues.apache.org/jira/browse/CB-13923
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-android
>Affects Versions: cordova-android-7.0.0
> Environment: cordova 8.0.0
> cordova-android 7.0.0
> cordova-plugin-file 6.0.1
>Reporter: Anthony Ward
>Assignee: Joe Bowser
>Priority: Major
>
> Here are details to recreate:
> [https://github.com/AnthonyWard/cordova-file-plugin-bug]
> In *cordova-android* the CordovaResourceApi.java -> OpenForReadResult method 
> returns a -1 length in certain circumstances.
> This has a knock on effect to the *cordova-plugin-file* > Filesystem.java > 
> readFileAtURL method, causing file corruption as each chunk effectively has 
> no end.
> There is a possible fix in the plugin cordova-plugin-file already proposed
> [https://github.com/apache/cordova-plugin-file/pull/217]
> https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
> Or I propose it could be fixed upstream in cordova-android here:
> [https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaResourceApi.java]
> In the method OpenForReadResult there is one path (in the catch) that leaves 
> the length as -1 causing the defect
> try
> {
> assetFd = assetManager.openFd(assetPath);
> inputStream = assetFd.createInputStream(); length = assetFd.getLength();
> }
> catch (FileNotFoundException e)
> {
> // Will occur if the file is compressed.
> inputStream = assetManager.open(assetPath);
> }
> Adding length = inputStream.available(); in the catch fixes the issue for me, 
> but I'm not a java developer so can't evaluate if that's a bad idea for 
> another reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CB-13923) CordovaResourceApi.java method OpenForReadResult returns a -1 length

2018-02-27 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CB-13923:
-

AnthonyWard opened a new pull request #433: CB-13923 (android) fix -1 length 
for compressed files
URL: https://github.com/apache/cordova-android/pull/433
 
 
   *Disclaimer: Please review carefully as i'm not a java developer, I just 
squint a bit and pretend it's C#*
   
   ### Platforms affected
   
   cordova 8.0.0
   cordova-android 7.1.0
   cordova-plugin-file 6.0.3
   
   ### What does this PR do?
   
   Here are details to recreate the issue:
   
   https://github.com/AnthonyWard/cordova-file-plugin-bug
   
   In `cordova-android` the `CordovaResourceApi.java` > `OpenForReadResult` 
method returns a -1 length in for compressed files.
   
   This has a knock on effect to the `cordova-plugin-file` > `Filesystem.java` 
> `readFileAtURL` method, causing file corruption as each chunk effectively has 
no end.
   
   There is a possible fix in the plugin `cordova-plugin-file` already proposed
   
   https://github.com/apache/cordova-plugin-file/pull/217
   
   
https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
   
   Or I propose it could be fixed upstream in `cordova-android`
   
   In the method `OpenForReadResult` there is one path (in the catch) that 
leaves the `length` as `-1` causing the defect.
   
   Adding `length = inputStream.available();` in the catch fixes the issue for 
me.
   
   ### What testing has been done on this change?
   
   Ran unit tests and integration tests locally, which passed.
   
   ### Checklist
   - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
   - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
   - [ ] Added automated test coverage as appropriate for this change.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> CordovaResourceApi.java method OpenForReadResult returns a -1 length
> 
>
> Key: CB-13923
> URL: https://issues.apache.org/jira/browse/CB-13923
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-android
>Affects Versions: cordova-android-7.0.0
> Environment: cordova 8.0.0
> cordova-android 7.0.0
> cordova-plugin-file 6.0.1
>Reporter: Anthony Ward
>Assignee: Joe Bowser
>Priority: Major
>
> Here are details to recreate:
> [https://github.com/AnthonyWard/cordova-file-plugin-bug]
> In *cordova-android* the CordovaResourceApi.java -> OpenForReadResult method 
> returns a -1 length in certain circumstances.
> This has a knock on effect to the *cordova-plugin-file* > Filesystem.java > 
> readFileAtURL method, causing file corruption as each chunk effectively has 
> no end.
> There is a possible fix in the plugin cordova-plugin-file already proposed
> [https://github.com/apache/cordova-plugin-file/pull/217]
> https://issues.apache.org/jira/browse/CB-13245?jql=text%20~%20%22CordovaResourceApi%22
> Or I propose it could be fixed upstream in cordova-android here:
> [https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaResourceApi.java]
> In the method OpenForReadResult there is one path (in the catch) that leaves 
> the length as -1 causing the defect
> try
> {
> assetFd = assetManager.openFd(assetPath);
> inputStream = assetFd.createInputStream(); length = assetFd.getLength();
> }
> catch (FileNotFoundException e)
> {
> // Will occur if the file is compressed.
> inputStream = assetManager.open(assetPath);
> }
> Adding length = inputStream.available(); in the catch fixes the issue for me, 
> but I'm not a java developer so can't evaluate if that's a bad idea for 
> another reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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