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

Joe Bowser resolved CB-3548.
----------------------------

    Resolution: Fixed

Sounds good to me!
                
> Error handling in onJsPrompt not working
> ----------------------------------------
>
>                 Key: CB-3548
>                 URL: https://issues.apache.org/jira/browse/CB-3548
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.7.0
>            Reporter: Peter
>            Assignee: Joe Bowser
>
> (This is a contrived scenario written to try to understand the bridging 
> implementation)
> It seems the error handling in the onJsPrompt() bridge in 
> CordovaChromeClient.java is not working correctly.
> {code}
>         if (reqOk && defaultValue != null && defaultValue.length() > 3 && 
> defaultValue.substring(0, 4).equals("gap:")) {
>             JSONArray array;
>             try {
>                 array = new JSONArray(defaultValue.substring(4));
>                 String service = array.getString(0);
>                 String action = array.getString(1);
>                 String callbackId = array.getString(2);
>                 String r = this.appView.exposedJsApi.exec(service, action, 
> callbackId, message);
>                 result.confirm(r == null ? "" : r);
>             } catch (JSONException e) {
>                 e.printStackTrace();
>             }
> {code}
> ---
> If JSONException occurs then my application fails and cannot recover. For 
> example, try below.
> {code}
> <button onclick="myFunction()">Try it</button>
> <script>
> function myFunction()
> {
> var one=prompt("test1","Harry Potter");
> var two=prompt("test2","gap: abc");
> }
> </script>
> {code}
> ---
> But if I modify the onJsPrompt code as follows then it behaves more 
> gracefully:
> {code}
>             } catch (JSONException e) {
>                 e.printStackTrace();
>                 return false; // added
>             }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to