You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Alan Neveu (Created) (JIRA)" <ji...@apache.org> on 2012/04/16 20:52:19 UTC

[jira] [Created] (CB-519) FileReader.readAsText performs automatic JSON.parse

FileReader.readAsText performs automatic JSON.parse
---------------------------------------------------

                 Key: CB-519
                 URL: https://issues.apache.org/jira/browse/CB-519
             Project: Apache Callback
          Issue Type: Bug
          Components: WP7
    Affects Versions: 1.6.1
         Environment: VS.NET 2010 and WP7.1 emulator
            Reporter: Alan Neveu
            Assignee: Jesse MacFadyen
            Priority: Minor


After upgrading from 1.5 I find that FileReader.readAsText takes the liberty of performing a JSON.parse if my file happens to be a stringified JSON object. While this seems like a nice addition, my app connects to an ASP.NET web service which uses Microsoft's serialization objects to serve the JSON to my app. Because of this I have had to roll my own JSON parse and stringify functions to deal with Microsoft's version of date serialization.  I am able to work with the automatic JSON.parse by checking for typeof == "object" and if that is what FileReader.readAsText has returned then I go ahead and use my own JSON.stringify and JSON.parse and go along on my way. But I thought it was odd that this automatic JSON.parse would happen in the first place, so I submit this as a bug in case someone was doing some testing/debugging and accidentally left a line of code in place that should really not be there.  I can live with it if it is intentional, but I think it would be more intuitive to not do automatic JSON operations that the function name does not indicate.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (CB-519) FileReader.readAsText performs automatic JSON.parse

Posted by "Alan Neveu (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255043#comment-13255043 ] 

Alan Neveu edited comment on CB-519 at 4/16/12 9:06 PM:
--------------------------------------------------------

I am also seeing a lot of this error while my code is just looping through fileEntries:

A first chance exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.dll

I think there is some automatic attempts at JSON conversions taking place and some of my files are not JSON and so this error is being thrown. Looks like a similar thing is happening in another Jira case, CB-276 - https://issues.apache.org/jira/browse/CB-276

                
      was (Author: offshorewahoo):
    I am also seeing a lot of this error while my code is just looping through fileEntries:

A first chance exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.dll

I think there is some automatic attempts at JSON conversions taking place and some of my files are not JSON and so this error is being thrown. Looks like a similar thing is happening in another here in Jira I was just reading.
                  
> FileReader.readAsText performs automatic JSON.parse
> ---------------------------------------------------
>
>                 Key: CB-519
>                 URL: https://issues.apache.org/jira/browse/CB-519
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: WP7
>    Affects Versions: 1.6.1
>         Environment: VS.NET 2010 and WP7.1 emulator
>            Reporter: Alan Neveu
>            Assignee: Jesse MacFadyen
>            Priority: Minor
>
> After upgrading from 1.5 I find that FileReader.readAsText takes the liberty of performing a JSON.parse if my file happens to be a stringified JSON object. While this seems like a nice addition, my app connects to an ASP.NET web service which uses Microsoft's serialization objects to serve the JSON to my app. Because of this I have had to roll my own JSON parse and stringify functions to deal with Microsoft's version of date serialization.  I am able to work with the automatic JSON.parse by checking for typeof == "object" and if that is what FileReader.readAsText has returned then I go ahead and use my own JSON.stringify and JSON.parse and go along on my way. But I thought it was odd that this automatic JSON.parse would happen in the first place, so I submit this as a bug in case someone was doing some testing/debugging and accidentally left a line of code in place that should really not be there.  I can live with it if it is intentional, but I think it would be more intuitive to not do automatic JSON operations that the function name does not indicate.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CB-519) FileReader.readAsText performs automatic JSON.parse

Posted by "Alan Neveu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255043#comment-13255043 ] 

Alan Neveu commented on CB-519:
-------------------------------

I am also seeing a lot of this error while my code is just looping through fileEntries:

A first chance exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.dll

I think there is some automatic attempts at JSON conversions taking place and some of my files are not JSON and so this error is being thrown. Looks like a similar thing is happening in another here in Jira I was just reading.
                
> FileReader.readAsText performs automatic JSON.parse
> ---------------------------------------------------
>
>                 Key: CB-519
>                 URL: https://issues.apache.org/jira/browse/CB-519
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: WP7
>    Affects Versions: 1.6.1
>         Environment: VS.NET 2010 and WP7.1 emulator
>            Reporter: Alan Neveu
>            Assignee: Jesse MacFadyen
>            Priority: Minor
>
> After upgrading from 1.5 I find that FileReader.readAsText takes the liberty of performing a JSON.parse if my file happens to be a stringified JSON object. While this seems like a nice addition, my app connects to an ASP.NET web service which uses Microsoft's serialization objects to serve the JSON to my app. Because of this I have had to roll my own JSON parse and stringify functions to deal with Microsoft's version of date serialization.  I am able to work with the automatic JSON.parse by checking for typeof == "object" and if that is what FileReader.readAsText has returned then I go ahead and use my own JSON.stringify and JSON.parse and go along on my way. But I thought it was odd that this automatic JSON.parse would happen in the first place, so I submit this as a bug in case someone was doing some testing/debugging and accidentally left a line of code in place that should really not be there.  I can live with it if it is intentional, but I think it would be more intuitive to not do automatic JSON operations that the function name does not indicate.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (CB-519) FileReader.readAsText performs automatic JSON.parse

Posted by "Jesse MacFadyen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-519?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-519.
--------------------------------

    Resolution: Duplicate

See CB-276
                
> FileReader.readAsText performs automatic JSON.parse
> ---------------------------------------------------
>
>                 Key: CB-519
>                 URL: https://issues.apache.org/jira/browse/CB-519
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: WP7
>    Affects Versions: 1.6.1
>         Environment: VS.NET 2010 and WP7.1 emulator
>            Reporter: Alan Neveu
>            Assignee: Jesse MacFadyen
>            Priority: Minor
>
> After upgrading from 1.5 I find that FileReader.readAsText takes the liberty of performing a JSON.parse if my file happens to be a stringified JSON object. While this seems like a nice addition, my app connects to an ASP.NET web service which uses Microsoft's serialization objects to serve the JSON to my app. Because of this I have had to roll my own JSON parse and stringify functions to deal with Microsoft's version of date serialization.  I am able to work with the automatic JSON.parse by checking for typeof == "object" and if that is what FileReader.readAsText has returned then I go ahead and use my own JSON.stringify and JSON.parse and go along on my way. But I thought it was odd that this automatic JSON.parse would happen in the first place, so I submit this as a bug in case someone was doing some testing/debugging and accidentally left a line of code in place that should really not be there.  I can live with it if it is intentional, but I think it would be more intuitive to not do automatic JSON operations that the function name does not indicate.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira