u4819210 / social-networks-for-fun

Automatically exported from code.google.com/p/social-networks-for-fun
0 stars 0 forks source link

getUserFavorites retunrs wrong json string when there's only one favourite #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This was the string I got back when there was only one favourite. Notice the 
"[" and "]" around the restaurant are missing.

{"faviouriteRestarurant":{"id":"69371","address":"3191 Middlefield Rd, Palo 
Alto, CA 94306 ","name":"Philz 
Coffee","restaurantForeignName":"","restaurantEnglishName":"Philz 
Coffee","phone":"650-251-9798","distance":"12799.168147416613","ratingGeneral":"
2.7","distanceString":"12799.16815","latitude":"37.42923","longtitude":"-122.122
7"},"lastAction":"0","lastLogin":"0","passwordValid":"true","prevLastAction":"0"
,"prevLastLogin":"0","userValid":"true"}

After I saved another favourite, the return string from getUserFavorites 
included the right format. like this:

{"faviouriteRestarurant":[{"id":"19501","address":"3163 Middlefield Rd, Palo 
Alto, CA 94306 ","name":"Fandango 
Pizza","restaurantForeignName":"","restaurantEnglishName":"Fandango 
Pizza","phone":"650-494-2928","distance":"12799.196424744208","ratingGeneral":"2
.5","distanceString":"12799.19642","latitude":"37.429558","longtitude":"-122.123
2"},{"id":"69371","address":"3191 Middlefield Rd, Palo Alto, CA 94306 
","name":"Philz 
Coffee","restaurantForeignName":"","restaurantEnglishName":"Philz 
Coffee","phone":"650-251-9798","distance":"12799.168147416613","ratingGeneral":"
2.7","distanceString":"12799.16815","latitude":"37.42923","longtitude":"-122.122
7"}],"lastAction":"0","lastLogin":"0","passwordValid":"true","prevLastAction":"0
","prevLastLogin":"0","userValid":"true"}

Notice the "[" before the first "id" .

Original issue reported on code.google.com by johnliu...@gmail.com on 31 Aug 2010 at 7:52

GoogleCodeExporter commented 8 years ago
Quick note -- it's a know issuse of Jersey and there is a known workaround. 

Original comment by zhangyon...@gmail.com on 31 Aug 2010 at 2:05

GoogleCodeExporter commented 8 years ago
A solution is mentioned in this page 
http://blogs.sun.com/enterprisetechtips/entry/configuring_json_for_restful_web .

New code was checked in but not tested. It should fix this issue. I will test 
it tonight.

Please resync code and verify. 

Original comment by zhangyon...@gmail.com on 31 Aug 2010 at 5:05

GoogleCodeExporter commented 8 years ago
Mark as fixed. Please reopen if it still occurs.

Original comment by zhangyon...@gmail.com on 2 Sep 2010 at 2:57

GoogleCodeExporter commented 8 years ago
I got the latest code as of Sept 2 20:54.
This issue is still there.

Here's the returned json string:

2010-09-03 10:01:35.905 SocialRays[22185:207] asynchronized request result: 
{"faviouriteRestarurant":{"id":"69371","address":"3191 Middlefield Rd, Palo 
Alto, CA 94306 ","name":"Philz 
Coffee","restaurantForeignName":"","restaurantEnglishName":"Philz 
Coffee","phone":"650-251-9798","distance":"12799.168147416613","ratingGeneral":"
2.7","distanceString":"12799.16815","latitude":"37.42923","longtitude":"-122.122
7"},"lastAction":"0","lastLogin":"0","passwordValid":"true","prevLastAction":"0"
,"prevLastLogin":"0","userValid":"true"}

Also, this is not just favorites, I'm seeing this for invites as well:

2010-09-03 09:53:47.808 SocialRays[21711:207] synchronized request result: 
{"list":{"createTime":"2010-08-30T23:33:09-07:00","id":"2","invitee":{"banned":"
no","code":"99999","email":"a@b.com","guid":"894","language":"en","lastAction":"
0","lastLogin":"0","loginTime":"2010-08-30T23:07:13-07:00","name":"John 
Liu","password":"1553f12839fe5a7043b05b107bdd8448","passwordValid":"true","prevL
astAction":"0","prevLastLogin":"0","salt":"4ec7df16","userValid":"true","usernam
e":"JohnLiu"},"inviter":{"banned":"no","code":"99999","email":"a@c.com","guid":"
895","language":"en","lastAction":"0","lastLogin":"0","loginTime":"2010-08-30T23
:13:20-07:00","name":"John Liu 
1","password":"f8f14e2a582d484116eef494b5f0a8a2","passwordValid":"true","prevLas
tAction":"0","prevLastLogin":"0","salt":"8d4fa3d7","userValid":"true","username"
:"JohnLiu1"},"joinGroup":{"closed":"false","guid":"9","name":"1283018611671","ow
ner":{"banned":"no","code":"99999","email":"a@c.com","guid":"895","language":"en
","lastAction":"0","lastLogin":"0","loginTime":"2010-08-30T23:13:20-07:00","name
":"John Liu 
1","password":"f8f14e2a582d484116eef494b5f0a8a2","passwordValid":"true","prevLas
tAction":"0","prevLastLogin":"0","salt":"8d4fa3d7","userValid":"true","username"
:"JohnLiu1"},"siteId":"0","size":"0"},"status":"ACCEPTED"}}

I have not tested this scenario for all other functions, but I suspect it's 
across the server.

Original comment by johnliu...@gmail.com on 3 Sep 2010 at 5:06

GoogleCodeExporter commented 8 years ago
Should be fixed now. Below is one sample data for the invitation list.

{"list":[{"createTime":"2010-09-03T10:30:29-07:00","id":"6","invitee":{"banned":
"no","code":"94040","email":"1283535028427646000","guid":"929","language":"en","
lastAction":"0","lastLogin":"0","loginTime":"2010-09-03T10:30:28-07:00","name":"
1283535028427646000","password":"0648e0cc7a7839e0961b1194ba127f18","passwordVali
d":"true","prevLastAction":"0","prevLastLogin":"0","salt":"123e55c6","userValid"
:"true","username":"1283535028427646000"},"inviter":{"banned":"no","code":"94040
","email":"1283535028836890000","guid":"931","language":"en","lastAction":"0","l
astLogin":"0","loginTime":"2010-09-03T10:30:28-07:00","name":"128353502883689000
0","password":"79895896be9b4da5a2850dc3e9ec7211","passwordValid":"true","prevLas
tAction":"0","prevLastLogin":"0","salt":"3e2901aa","userValid":"true","username"
:"1283535028836890000"},"joinGroup":{"closed":"false","groupType":"PRIVATE","gui
d":"40","name":"1283535029101288000","owner":{"banned":"no","code":"94040","emai
l":"1283535028836890000","guid":"931","language":"en","lastAction":"0","lastLogi
n":"0","loginTime":"2010-09-03T10:30:28-07:00","name":"1283535028836890000","pas
sword":"79895896be9b4da5a2850dc3e9ec7211","passwordValid":"true","prevLastAction
":"0","prevLastLogin":"0","salt":"3e2901aa","userValid":"true","username":"12835
35028836890000"},"siteId":"0","size":"0"},"status":"ACCEPTED"}]}

Original comment by zhangyon...@gmail.com on 3 Sep 2010 at 5:42

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r116.

Fixed the NPE.

Original comment by zhangyon...@gmail.com on 9 Sep 2010 at 5:57