incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Neveu (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-519) FileReader.readAsText performs automatic JSON.parse
Date Mon, 16 Apr 2012 20:56:16 GMT

    [ 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

       

Mime
View raw message