cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Naito (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-14110) Cordova Plugin File not reading large json files correctly - android
Date Fri, 01 Jun 2018 06:02:00 GMT

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

Ken Naito commented on CB-14110:
--------------------------------

I checked this issue using cordova 7.1.0, cordova-android 6.3.0 and  cordova-plugin-file 6.0.1
As Joel Henry pointed out, the readAsText does not work for 500000bytes text file.  (Wrong
text length is shown)
On the other hands the readAsText works for 1000bytes text file and 200000bytes text file.

Next, I updated the cordova-android to github master. (commit 02ee92510376b23476039e29e1ec5ffaf2102b83)
I checked readAstext again using this latest cordova-android.
As a result, the readAsText works for 1000bytes, 200000bytes and 500000bytes text files.

I think https://github.com/apache/cordova-android/pull/433  fixes this issue at least for
android.


> Cordova Plugin File not reading large json files correctly - android
> --------------------------------------------------------------------
>
>                 Key: CB-14110
>                 URL: https://issues.apache.org/jira/browse/CB-14110
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-file
>    Affects Versions: 6.0.1
>         Environment: cordova version: 7.1.0
> cordova-android: 7.1.0
> cordova-ios: 7.1.0
>            Reporter: Joel Henry
>            Priority: Critical
>              Labels: android
>
> When reading a large json file (293kb), readAsText renders string incorrectly, adding
duplicate text after the file's text ends and breaking json structure. JSON.parse the text
fails due to this. It hangs and fails.
> {code:java}
> const root = `${this.window.cordova.file.applicationDirectory}www/assets/`;
> this.window.resolveLocalFileSystemURL(this.root + fileName,
> (fileEntry: FileEntry) => {
> fileEntry.file(file => {
> const reader = new (<any>this.window.cordova).FileReader();
> reader.onloadend = function () {
> console.log(JSON.parse(this.result));
> };
> reader.readAsText(file);
> });
> });
> {code}



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

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


Mime
View raw message