[jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread
[ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14059701#comment-14059701 ] Rajesh Kumar commented on CB-7109: -- got it. Will try this solution and see if the warning goes away. Thanks. exec() call to plugin blocked the main thread - Key: CB-7109 URL: https://issues.apache.org/jira/browse/CB-7109 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 3.5.0 Reporter: Rajesh Kumar Priority: Minor In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is: THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool(). Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code: final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); And, threadhelper uses: cordova.getThreadPool().execute(new Runnable() { public void run() {} }); This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread
[ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14059230#comment-14059230 ] Rajesh Kumar commented on CB-7109: -- oh.. all the plugins currently use the json array args. So, I would rather wait for an update to cordova. You have any other suggestions? exec() call to plugin blocked the main thread - Key: CB-7109 URL: https://issues.apache.org/jira/browse/CB-7109 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 3.5.0 Reporter: Rajesh Kumar Priority: Minor In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is: THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool(). Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code: final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); And, threadhelper uses: cordova.getThreadPool().execute(new Runnable() { public void run() {} }); This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread
[ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14057671#comment-14057671 ] Rajesh Kumar commented on CB-7109: -- I tried putting the deserialization code (fetching from json array parameter) into the run() of the thread. Still, I see the warning in logcat. exec() call to plugin blocked the main thread - Key: CB-7109 URL: https://issues.apache.org/jira/browse/CB-7109 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 3.5.0 Reporter: Rajesh Kumar Priority: Minor In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is: THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool(). Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code: final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); And, threadhelper uses: cordova.getThreadPool().execute(new Runnable() { public void run() {} }); This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread
[ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14057808#comment-14057808 ] Rajesh Kumar commented on CB-7109: -- No. but this is what I did: FileUtils.java if (action.equals(write)) { final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); } I changed the above code as: if (action.equals(write)) { threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { String fname = null; String data = null; int offset = 0; Boolean isBinary = false; try { fname = args.getString(0); data=args.getString(1); offset = args.getInt(2); isBinary=args.getBoolean(3); } catch (JSONException e) { e.printStackTrace(); } long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); } exec() call to plugin blocked the main thread - Key: CB-7109 URL: https://issues.apache.org/jira/browse/CB-7109 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 3.5.0 Reporter: Rajesh Kumar Priority: Minor In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is: THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool(). Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code: final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); And, threadhelper uses: cordova.getThreadPool().execute(new Runnable() { public void run() {} }); This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7081) Issue when Cordova upgrade from 2.9 to 3.5
[ https://issues.apache.org/jira/browse/CB-7081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14056431#comment-14056431 ] Rajesh Kumar commented on CB-7081: -- I used command line to add File plugin, so I guess it added the latest from cordova plugin repository. I even tried the v1.0 as suggested by few users on other websites. Even that did not work. Finally, I managed to figure out the issue. Earlier in cordova 2.9, i used to access file api of cordova from javascript by using url of form: /data/data/com.myapp.android/abc.txt. This url in file plugin latest version added through command line throws Nullpointer Exception. I now changed my url format to: Android/data/com.myapp.android and using it with PERSISTENT file system. So, the full url which plugin on the Java side uses to access files is: /mnt/sdcard/Android/data/com.myapp.android (if mounted), else it'll use /data/data/com.myapp.android/Android/data/com.myapp.android. Issue when Cordova upgrade from 2.9 to 3.5 -- Key: CB-7081 URL: https://issues.apache.org/jira/browse/CB-7081 Project: Apache Cordova Issue Type: Bug Components: Android, CordovaJS Affects Versions: 3.5.0 Reporter: Rajesh Kumar I recently upgraded my cordova app from v2.9 to v3.5. When I start my app, I see a JSONException in the logcat console as below: 07-05 16:04:48.457: W/System.err(1917): org.json.JSONException: Value App at 0 of type java.lang.String cannot be converted to int 07-05 16:04:48.457: W/System.err(1917): at org.json.JSON.typeMismatch(JSON.java:100) 07-05 16:04:48.457: W/System.err(1917): at org.json.JSONArray.getInt(JSONArray.java:357) 07-05 16:04:48.457: W/System.err(1917): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:214) This exception occurs inside the `onJsPrompt()` method of `CordovaChromeClient.java`, when the code tries to read the first element of array. The json array comes from javascript and should be having 4 parameters (bridge secret, service, action, callbackId), but it has only 3. The bridge secret is not present. This call is made from the core plugin `cordova/android/promptbasednativeapi` inside cordova.js. I guess the cordova.js which comes with the cordova download from official cordova site is not correct? I need to know how to pass the bridge secret from js to java. Can someone help me? -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Closed] (CB-7081) Issue when Cordova upgrade from 2.9 to 3.5
[ https://issues.apache.org/jira/browse/CB-7081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rajesh Kumar closed CB-7081. Issue when Cordova upgrade from 2.9 to 3.5 -- Key: CB-7081 URL: https://issues.apache.org/jira/browse/CB-7081 Project: Apache Cordova Issue Type: Bug Components: Android, CordovaJS Affects Versions: 3.5.0 Reporter: Rajesh Kumar I recently upgraded my cordova app from v2.9 to v3.5. When I start my app, I see a JSONException in the logcat console as below: 07-05 16:04:48.457: W/System.err(1917): org.json.JSONException: Value App at 0 of type java.lang.String cannot be converted to int 07-05 16:04:48.457: W/System.err(1917): at org.json.JSON.typeMismatch(JSON.java:100) 07-05 16:04:48.457: W/System.err(1917): at org.json.JSONArray.getInt(JSONArray.java:357) 07-05 16:04:48.457: W/System.err(1917): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:214) This exception occurs inside the `onJsPrompt()` method of `CordovaChromeClient.java`, when the code tries to read the first element of array. The json array comes from javascript and should be having 4 parameters (bridge secret, service, action, callbackId), but it has only 3. The bridge secret is not present. This call is made from the core plugin `cordova/android/promptbasednativeapi` inside cordova.js. I guess the cordova.js which comes with the cordova download from official cordova site is not correct? I need to know how to pass the bridge secret from js to java. Can someone help me? -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Created] (CB-7109) exec() call to plugin blocked the main thread
Rajesh Kumar created CB-7109: Summary: exec() call to plugin blocked the main thread Key: CB-7109 URL: https://issues.apache.org/jira/browse/CB-7109 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 3.5.0 Reporter: Rajesh Kumar Priority: Minor In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is: THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool(). Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code: final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); And, threadhelper uses: cordova.getThreadPool().execute(new Runnable() { public void run() {} }); This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread
[ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14056619#comment-14056619 ] Rajesh Kumar commented on CB-7109: -- I have not looked at the plugin in entirety. Will do it and let you know during my time morning. exec() call to plugin blocked the main thread - Key: CB-7109 URL: https://issues.apache.org/jira/browse/CB-7109 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 3.5.0 Reporter: Rajesh Kumar Priority: Minor In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is: THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool(). Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code: final String fname=args.getString(0); final String data=args.getString(1); final int offset=args.getInt(2); final Boolean isBinary=args.getBoolean(3); threadhelper( new FileOp( ){ public void run() throws FileNotFoundException, IOException, NoModificationAllowedException { long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, callbackContext); And, threadhelper uses: cordova.getThreadPool().execute(new Runnable() { public void run() {} }); This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7081) Issue when Cordova upgrade from 2.9 to 3.5
[ https://issues.apache.org/jira/browse/CB-7081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14055118#comment-14055118 ] Rajesh Kumar commented on CB-7081: -- Ok. I managed to fix this issue. But, now I get a Nullpointer Exception when I try to read/write from file at app startup. Below is the stack trace: 07-08 22:07:42.228: W/System.err(1796): java.lang.NullPointerException 07-08 22:07:42.228: W/System.err(1796): at org.apache.cordova.file.LocalFilesystem.filesystemPathForURL(LocalFilesystem.java:67) 07-08 22:07:42.228: W/System.err(1796): at org.apache.cordova.file.LocalFilesystem.getFileForLocalURL(LocalFilesystem.java:189) 07-08 22:07:42.228: W/System.err(1796): at org.apache.cordova.file.FileUtils.getFile(FileUtils.java:749) 07-08 22:07:42.228: W/System.err(1796): at org.apache.cordova.file.FileUtils.access$5(FileUtils.java:742) 07-08 22:07:42.228: W/System.err(1796): at org.apache.cordova.file.FileUtils$16.run(FileUtils.java:397) 07-08 22:07:42.228: W/System.err(1796): at org.apache.cordova.file.FileUtils$23.run(FileUtils.java:525) 07-08 22:07:42.228: W/System.err(1796): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 07-08 22:07:42.228: W/System.err(1796): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 07-08 22:07:42.228: W/System.err(1796): at java.lang.Thread.run(Thread.java:856) Issue when Cordova upgrade from 2.9 to 3.5 -- Key: CB-7081 URL: https://issues.apache.org/jira/browse/CB-7081 Project: Apache Cordova Issue Type: Bug Components: Android, CordovaJS Affects Versions: 3.5.0 Reporter: Rajesh Kumar I recently upgraded my cordova app from v2.9 to v3.5. When I start my app, I see a JSONException in the logcat console as below: 07-05 16:04:48.457: W/System.err(1917): org.json.JSONException: Value App at 0 of type java.lang.String cannot be converted to int 07-05 16:04:48.457: W/System.err(1917): at org.json.JSON.typeMismatch(JSON.java:100) 07-05 16:04:48.457: W/System.err(1917): at org.json.JSONArray.getInt(JSONArray.java:357) 07-05 16:04:48.457: W/System.err(1917): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:214) This exception occurs inside the `onJsPrompt()` method of `CordovaChromeClient.java`, when the code tries to read the first element of array. The json array comes from javascript and should be having 4 parameters (bridge secret, service, action, callbackId), but it has only 3. The bridge secret is not present. This call is made from the core plugin `cordova/android/promptbasednativeapi` inside cordova.js. I guess the cordova.js which comes with the cordova download from official cordova site is not correct? I need to know how to pass the bridge secret from js to java. Can someone help me? -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Created] (CB-7081) Issue when Cordova upgrade from 2.9 to 3.5
Rajesh Kumar created CB-7081: Summary: Issue when Cordova upgrade from 2.9 to 3.5 Key: CB-7081 URL: https://issues.apache.org/jira/browse/CB-7081 Project: Apache Cordova Issue Type: Bug Components: Android, CordovaJS Affects Versions: 3.5.0 Reporter: Rajesh Kumar I recently upgraded my cordova app from v2.9 to v3.5. When I start my app, I see a JSONException in the logcat console as below: 07-05 16:04:48.457: W/System.err(1917): org.json.JSONException: Value App at 0 of type java.lang.String cannot be converted to int 07-05 16:04:48.457: W/System.err(1917): at org.json.JSON.typeMismatch(JSON.java:100) 07-05 16:04:48.457: W/System.err(1917): at org.json.JSONArray.getInt(JSONArray.java:357) 07-05 16:04:48.457: W/System.err(1917): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:214) This exception occurs inside the `onJsPrompt()` method of `CordovaChromeClient.java`, when the code tries to read the first element of array. The json array comes from javascript and should be having 4 parameters (bridge secret, service, action, callbackId), but it has only 3. The bridge secret is not present. This call is made from the core plugin `cordova/android/promptbasednativeapi` inside cordova.js. I guess the cordova.js which comes with the cordova download from official cordova site is not correct? I need to know how to pass the bridge secret from js to java. Can someone help me? -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CB-7081) Issue when Cordova upgrade from 2.9 to 3.5
[ https://issues.apache.org/jira/browse/CB-7081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14053133#comment-14053133 ] Rajesh Kumar commented on CB-7081: -- I downloaded cordova from https://www.apache.org/dist/cordova/platforms/ ( cordova-android-3.5.0.zip 2014-05-23 23:03 2.5M ) Issue when Cordova upgrade from 2.9 to 3.5 -- Key: CB-7081 URL: https://issues.apache.org/jira/browse/CB-7081 Project: Apache Cordova Issue Type: Bug Components: Android, CordovaJS Affects Versions: 3.5.0 Reporter: Rajesh Kumar I recently upgraded my cordova app from v2.9 to v3.5. When I start my app, I see a JSONException in the logcat console as below: 07-05 16:04:48.457: W/System.err(1917): org.json.JSONException: Value App at 0 of type java.lang.String cannot be converted to int 07-05 16:04:48.457: W/System.err(1917): at org.json.JSON.typeMismatch(JSON.java:100) 07-05 16:04:48.457: W/System.err(1917): at org.json.JSONArray.getInt(JSONArray.java:357) 07-05 16:04:48.457: W/System.err(1917): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:214) This exception occurs inside the `onJsPrompt()` method of `CordovaChromeClient.java`, when the code tries to read the first element of array. The json array comes from javascript and should be having 4 parameters (bridge secret, service, action, callbackId), but it has only 3. The bridge secret is not present. This call is made from the core plugin `cordova/android/promptbasednativeapi` inside cordova.js. I guess the cordova.js which comes with the cordova download from official cordova site is not correct? I need to know how to pass the bridge secret from js to java. Can someone help me? -- This message was sent by Atlassian JIRA (v6.2#6252)