android


Gson fromJson parsing a list sometimes returning null


I have an application communicating to a server through Json data. Sometimes the server answers back with a list of objects and the application parses the json string using the syntax :
List<My_Object_Type> list = new Gson().fromJson(json, new TypeToken<List<My_Object_Type>>() {}.getType());
Through my application log, i always print what the server answer in order to be able to check if everything is correct and diagnosis errors. Thus i'm able to see if the gson syntax is correct, if the server encountered a problem or...
The application works fine, almost 99% of the time, but in the little 1% remaining the json List is null. And that's not even a problem about the data structure, neither the json String because in the same application log i saw the exact same json line in the exact same query being answered, and there was no problem.
Question : if the gson deserialization is called on another Thread (asynTask), could it lead to it to fail deserializing ? I dont see any reason why the first call works, the second one too, but not the third one.
In order to further get any problem, I copy/past the Json string and directly called the deserialization through the exact same call (also copy/pasted)... And it worked.
Worked first --> no data structure error
Worked with copy/pasted string --> No string error
what could be other problems with deserialization ?
PS: I read other questions leading to "wrong json string" or "wrong object structure" and it seems not being the case as it worked with the exact same string before.... Of course, I could deal with the null variable and prevent problems, but as it does not take data sent by the server it may lead to inappropriate behaviors....

Related Links

NDK Debug for Nexus 9 arm64-v8a build not working for eclipse
How to load image from url into InfoWindowAdapter android ? image is not shown
Repeat Alarm Manager At Exact Interval in API=>19?
How to debug on an Android device with Air and captive runtime?
How to delete a row from a ListView with a CursorAdapter
Android Estimote Region Monitoring
How can I limit appended text to EditText to a single character without limiting the EditText?
null pointer exception in android not starting activity
Run Robolectric with proguard
Different styling errors on different devices
Android ImageButton slow click response Inside a ScrollView
How to show arraylist data in a textview?
Schedule Push Notifications on parse.com
Android - Passing a lot of paremeters to an ASyncTask
Line renderer is not working for android build game
How is it possible to test a wear app is packaged correctly before publishing it to the play store?

Categories

HOME
go
phpword
azure-stream-analytics
cheerio
c99
ggplot2
phpmyadmin
mysql-workbench
mstest
grafana
newrelic
cublas
hugo
limit
ado.net
spring-session
mql5
vimdiff
reactive-programming
http-post
intershop
wolframalpha
sencha-touch
charles
asp.net-core-webapi
gulp-watch
parcelable
pimcore
displaytag
jboss6.x
jquery-multiselect
inversion-of-control
uitapgesturerecognizer
twiml
userdefaults
jmockit
quickfixj
rselenium
android-maps-extensions
docfx
connection-pool
demo
metawidget
p4merge
unordered-map
ogc
sharp-snmp
signal-strength
oim
ovf
opennms
proget
netbeans6.8
facebook-pixel
twilio-click-to-call
scalding
sandcastle
webjars
lrs
wso2developerstudio
udpclient
cassia
angular-ui-typeahead
hadoop-partitioning
ellucian-scribe
httpruntime.cache
vhosts
themoviedb-api
vigenere
morton-number
video-player
canalyzer
jdk1.7
rdflib
snoop
nsurlsessiondatatask
android-broadcast
java-security
easyrtc
punycode
trdion2011
named-parameters
ss7
gnumeric
gae-quotas
scringo
gpars
virtual-pc
alice
sqlclr
resource-management
wimax
veracity
faye
luabind
catransform3d
android-holo-everywhere
cgbitmapcontextcreate
zend-rest
escrow
contentpresenter

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App