[ 
https://issues.apache.org/jira/browse/CB-9314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Karen Tran closed CB-9314.
--------------------------
    Resolution: Not A Problem

Closing because this ended up not being a problem. Someone else had 
cherrypicked something that was causing the error in our cordova branch. 

> Reading input element using filereader.readAsDataURL returns FileNotFound 
> Exception
> -----------------------------------------------------------------------------------
>
>                 Key: CB-9314
>                 URL: https://issues.apache.org/jira/browse/CB-9314
>             Project: Apache Cordova
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>         Environment: Android 5.0
>            Reporter: Karen Tran
>              Labels: FileReader.readAsDataURL
>
> Added a simple FileReader to index.html to select an image and display it, 
> but always errors out. 
> Expected:
> - Click 'Choose File' button
> - Select an image file
> - Get 2 alerts, 1 for entering the Openfile function, and the second for 
> entering Onload
> - Image should display
> Actual:
> - Never gets to the Onload function, so image doesn't display
> - Goes to onError
> I have traced through the native side in CordovaActivity and 
> CordovaChromeClient and it seems to get the result URL fine, but when it 
> returns to the javascript side, the result ends up being null. I'm not too 
> familiar with how the bridging works, so maybe there is some type of 
> disconnect there. 
> In the log, I am using the Cordova File plugin, but the issue still occurs 
> even if I am not using the plugin. Everything is the same with or without the 
> plugin, native side gets the result, but javascript side gets null. 
> {code}
> <input type='file' accept='image/*' onchange='openFile(event)'><br>
> <img id='output'>
> <script>
>     var openFile = function(event) {
>         alert("Inside Openfile Function");
>         var input = event.target;
>         var reader = new FileReader();
>         reader.onload = function(){
>             alert("Inside Onload Function");
>             var dataURL = reader.result;
>             var output = document.getElementById('output');
>             output.src = dataURL;
>         };
>       reader.onerror = function() {
>           console.log('An error occurred while reading a file.');
>           console.log(reader.error);
>       };
>       
>       reader.readAsDataURL(input.files[0]);
>     };
> </script>
> {code}
> Log:
> {noformat}
> 07-02 18:38:35.446: I/chromium(11741): [INFO:CONSOLE(24)] "The key 
> "target-densitydpi" is not supported.", source: 
> file:///android_asset/www/index.html (24)
> 07-02 18:38:35.722: I/chromium(11741): [INFO:CONSOLE(1088)] "adding proxy for 
> Contacts", source: file:///android_asset/www/cordova.js (1088)
> 07-02 18:38:35.777: D/CordovaNetworkManager(11741): Connection Type: none
> 07-02 18:38:35.837: I/chromium(11741): [INFO:CONSOLE(47)] "Received Event: 
> deviceready", source: file:///android_asset/www/js/index.js (47)
> 07-02 18:38:42.042: I/ActivityManager(508): START u0 
> {act=android.intent.action.CHOOSER 
> cmp=android/com.android.internal.app.ChooserActivity (has extras)} from uid 
> 10289 on display 0
> 07-02 18:38:42.081: I/ActivityManager(508): Start proc android:ui for 
> activity android/com.android.internal.app.ChooserActivity: pid=12212 uid=1000 
> gids={41000, 9997, 1028, 1015, 3002, 3001, 3003} abi=arm64-v8a
> 07-02 18:38:42.146: D/ResolverActivity(12212): sinceTime=1434667122141
> 07-02 18:38:42.154: I/ActivityManager(508): START u0 
> {act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] 
> typ=*/* flg=0x3000000 cmp=com.android.documentsui/.DocumentsActivity} from 
> uid 10289 on display 0
> 07-02 18:38:42.197: I/ActivityManager(508): Start proc 
> com.android.documentsui for activity 
> com.android.documentsui/.DocumentsActivity: pid=12239 uid=10039 gids={50039, 
> 9997} abi=arm64-v8a
> 07-02 18:38:42.211: I/art(208): Explicit concurrent mark sweep GC freed 
> 704(30KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 6MB/11MB, paused 
> 102us total 16.967ms
> 07-02 18:38:42.225: I/art(208): Explicit concurrent mark sweep GC freed 
> 7(240B) AllocSpace objects, 0(0B) LOS objects, 40% free, 6MB/11MB, paused 
> 64us total 12.789ms
> 07-02 18:38:42.241: I/art(208): Explicit concurrent mark sweep GC freed 
> 5(160B) AllocSpace objects, 0(0B) LOS objects, 40% free, 6MB/11MB, paused 
> 61us total 11.713ms
> 07-02 18:38:42.334: I/ActivityManager(508): Start proc 
> com.android.externalstorage for content provider 
> com.android.externalstorage/.ExternalStorageProvider: pid=12270 uid=10006 
> gids={50006, 9997, 1028, 1015, 1023} abi=arm64-v8a
> 07-02 18:38:42.365: D/OpenGLRenderer(12239): Render dirty regions requested: 
> true
> 07-02 18:38:42.377: D/Atlas(12239): Validating map...
> 07-02 18:38:42.414: D/ExternalStorage(12270): After updating volumes, found 1 
> active roots
> 07-02 18:38:42.459: W/EventLoggerService(4267): Unable to send logs Error 
> code: 262160 | The connection was not attempted due to lack of network 
> connectivity.
> 07-02 18:38:42.474: I/wpa_supplicant(820): wlan0: CTRL-EVENT-SCAN-STARTED 
> 07-02 18:38:42.477: I/OpenGLRenderer(12239): Initialized EGL, version 1.4
> 07-02 18:38:42.591: I/GLSUser(18183): [GLSUser] getTokenFromCache: [account: 
> <ELLIDED:-25567>, callingPkg: com.google.android.googlequicksearchbox, 
> service: oauth2:https://www.googleapis.com/auth/googlenow]
> 07-02 18:38:42.594: I/Auth.Core(18183): [TokenCache] Missing snowballing 
> token: no granted scopes set.
> 07-02 18:38:42.633: I/ActivityManager(508): Start proc 
> com.google.android.apps.docs for content provider 
> com.google.android.apps.docs/.storagebackend.StorageBackendContentProvider: 
> pid=12307 uid=10040 gids={50040, 9997, 1028, 3003, 1015} abi=armeabi-v7a
> 07-02 18:38:42.804: D/OpenGLRenderer(12239): Enabling debug mode 0
> 07-02 18:38:42.918: I/Choreographer(12239): Skipped 30 frames!  The 
> application may be doing too much work on its main thread.
> 07-02 18:38:42.965: I/art(508): Explicit concurrent mark sweep GC freed 
> 37994(2MB) AllocSpace objects, 94(7MB) LOS objects, 30% free, 37MB/53MB, 
> paused 4.302ms total 249.177ms
> 07-02 18:38:42.984: I/ActivityManager(508): Displayed 
> com.android.documentsui/.DocumentsActivity: +825ms (total +935ms)
> 07-02 18:38:43.003: W/IInputConnectionWrapper(11741): showStatusIcon on 
> inactive InputConnection
> 07-02 18:38:43.009: I/Keyboard.Facilitator(6721): onFinishInput()
> 07-02 18:38:43.023: I/ActivityManager(508): Killing 
> 8196:com.google.android.apps.cloudprint/u0a35 (adj 15): empty #17
> 07-02 18:38:43.082: W/libprocessgroup(508): failed to open 
> /acct/uid_10035/pid_8196/cgroup.procs: No such file or directory
> 07-02 18:38:43.098: E/PhotosPlugin(12307): Loading PhotosPlugin
> 07-02 18:38:43.333: E/WifiConfigStore(508): setLastSelectedConfiguration -1
> 07-02 18:38:43.427: I/GAv4(12307): Google Analytics 7.5.71 is starting up. To 
> enable debug logging on a device run:
> 07-02 18:38:43.427: I/GAv4(12307):   adb shell setprop log.tag.GAv4 DEBUG
> 07-02 18:38:43.427: I/GAv4(12307):   adb logcat -s GAv4
> 07-02 18:38:43.450: W/GAv4(12307): AnalyticsReceiver is not registered or is 
> disabled. Register the receiver for reliable dispatching on non-Google Play 
> devices. See http://goo.gl/8Rd3yj for instructions.
> 07-02 18:38:43.477: W/GAv4(12307): CampaignTrackingReceiver is not 
> registered, not exported or is disabled. Installation campaign tracking is 
> not possible. See http://goo.gl/8Rd3yj for instructions.
> 07-02 18:38:43.498: W/GAv4(12307): AnalyticsService not registered in the app 
> manifest. Hits might not be delivered reliably. See http://goo.gl/8Rd3yj for 
> instructions.
> 07-02 18:38:43.664: D/Documents(12239): Update found 7 roots in 1381ms
> 07-02 18:38:43.683: I/ActivityManager(508): Killing 
> 8238:com.google.android.apps.walletnfcrel/u0a24 (adj 15): empty #17
> 07-02 18:38:43.704: W/Documents(12239): Failed to restore stack: 
> java.io.FileNotFoundException: Failed to find matching root for null
> 07-02 18:38:43.802: V/GLSActivity(18183): AuthDelegateWrapperCreated with 
> selected intent: Intent { 
> cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
> 07-02 18:38:43.803: D/Documents(12239): Current stack: 
> 07-02 18:38:43.804: D/Documents(12239):  * null
> 07-02 18:38:43.814: W/libprocessgroup(508): failed to open 
> /acct/uid_10024/pid_8238/cgroup.procs: No such file or directory
> 07-02 18:38:43.853: D/Documents(12239): Update found 7 roots in 153ms
> 07-02 18:38:43.922: W/ResourceType(12239): No package identifier when getting 
> value for resource number 0x00000000
> 07-02 18:38:43.922: W/PackageManager(12239): Failure retrieving resources for 
> com.google.android.apps.photos: Resource ID #0x0
> 07-02 18:38:44.011: I/Keyboard.Facilitator(6721): onFinishInput()
> 07-02 18:38:44.039: W/ResourceType(12239): No package identifier when getting 
> value for resource number 0x00000000
> 07-02 18:38:44.039: W/PackageManager(12239): Failure retrieving resources for 
> com.google.android.apps.photos: Resource ID #0x0
> 07-02 18:38:44.086: D/Documents(12239): Before filtering 0, after 0
> 07-02 18:38:44.087: D/Documents(12239): Before filtering 3, after 3
> 07-02 18:38:44.088: D/Documents(12239): Before filtering 4, after 1
> 07-02 18:38:44.088: D/Documents(12239): Before filtering 6, after 0
> 07-02 18:38:44.088: D/Documents(12239): Found 4 of 4 recent queries done
> 07-02 18:38:48.391: D/Documents(12239): onFinished() 
> [content://com.android.providers.media.documents/document/image%3A176]
> 07-02 18:38:48.406: D/CordovaActivity(11741): Request code = 5173
> 07-02 18:38:48.406: D/CordovaActivity(11741): did we get here?
> 07-02 18:38:48.406: D/CordovaActivity(11741): result = 
> content://com.android.providers.media.documents/document/image%3A176
> 07-02 18:38:48.439: I/ActivityManager(508): Killing 
> 8265:com.google.android.apps.magazines/u0a62 (adj 15): empty #17
> 07-02 18:38:48.447: I/Keyboard.Facilitator(6721): onFinishInput()
> 07-02 18:38:48.458: D/OpenGLRenderer(12239): endAllStagingAnimators on 
> 0x55a29f2a60 (ListView) with handle 0x55a2b9c530
> 07-02 18:38:48.512: W/libprocessgroup(508): failed to open 
> /acct/uid_10062/pid_8265/cgroup.procs: No such file or directory
> 07-02 18:38:49.513: I/chromium(11741): [INFO:CONSOLE(64)] "An error occurred 
> while reading a file.", source: file:///android_asset/www/index.html (64)
> 07-02 18:38:49.513: I/chromium(11741): [INFO:CONSOLE(65)] "[object 
> FileError]", source: file:///android_asset/www/index.html (65)
> 07-02 18:38:49.514: W/InputMethodManagerService(508): Window already focused, 
> ignoring focus gain of: 
> com.android.internal.view.IInputMethodClient$Stub$Proxy@133d8b99 
> attribute=null, token = android.os.BinderProxy@9d0b452
> {noformat}



--
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

Reply via email to