Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Error Fetching Status Entries #2

Open
watsoncj opened this Issue Oct 17, 2011 · 2 comments

Comments

Projects
None yet
2 participants

Hello,

I'm very impressed with the plugin so far. It seems very complete and I have had excellent luck with it.

I ran into an issue this evening with the getStatuses(userId) method.

def facebook = new FacebookTemplate(accessToken)
println facebook.feedOperations().getStatuses(userId)
org.quartz.JobExecutionException [See nested exception: java.lang.NullPointerException]
    at org.codehaus.groovy.grails.plugins.quartz.GrailsJobFactory$GrailsTaskClassJob.execute(GrailsJobFactory.java:81)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
Caused by: java.lang.NullPointerException
    at org.springframework.social.facebook.api.impl.json.PostMixin$LikesCountDeserializer.deserialize(PostMixin.java:130)
    at org.springframework.social.facebook.api.impl.json.PostMixin$LikesCountDeserializer.deserialize(PostMixin.java:126)
    at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:252)
    at org.codehaus.jackson.map.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:620)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:472)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:368)
    at org.codehaus.jackson.map.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:77)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeWithType(BeanDeserializer.java:423)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider$WrappedDeserializer.deserialize(StdDeserializerProvider.java:460)
    at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2376)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1731)
    at org.springframework.social.facebook.api.impl.FeedTemplate.deserializePost(FeedTemplate.java:274)
    at org.springframework.social.facebook.api.impl.FeedTemplate.deserializeList(FeedTemplate.java:260)
    at org.springframework.social.facebook.api.impl.FeedTemplate.getStatuses(FeedTemplate.java:99)
    at org.springframework.social.facebook.api.impl.FeedTemplate.getStatuses(FeedTemplate.java:93)
    at org.springframework.social.facebook.api.FeedOperations$getStatuses.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
    at iforce.FacebookJob.execute(FacebookJob.groovy:42)
    at sun.reflect.GeneratedMethodAccessor530.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:186)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:171)
    at org.codehaus.groovy.grails.plugins.quartz.GrailsJobFactory$GrailsTaskClassJob.execute(GrailsJobFactory.java:77)
    ... 2 more

I found the same issue on this thread as well:
http://forum.springsource.org/showthread.php?114901-NullPointer-to-get-status-from-Facebook

Is there any additional information I should provide to help debug this?

Cheers,
Casey

Member

habuma commented Oct 17, 2011

Sometimes Facebook gives back "likes" as a simple count...other times, it gives back a list of references for those people who have liked the post. As it is written now, the deserialization code in Spring Social Facebook is written to work with the counts and will fail when it encounters a reference list. I've filed this as a bug at https://jira.springsource.org/browse/SOCIALFB-33 to more gracefully handle either situation.

@habuma habuma closed this Oct 17, 2011

@habuma habuma reopened this Oct 17, 2011

Thanks!

Not sure if this helps. but here is a sample of the JSON it is failing on. Names have been changed to protect the innocent.

{
   "data":[
      {
         "id":"2371708687105",
         "from":{
            "name":"Michelle Flannagan",
            "id":"1082137252"
         },
         "message":"Had a fun and restful weekend in Beaver Creek with the girls! But I'm so thankful to come home to such wonderful boys! I'm very blessed!",
         "updated_time":"2011-10-17T03:48:02+0000",
         "likes":{
            "data":[
               {
                  "id":"1260660252",
                  "name":"Lauren"
               },
               {
                  "id":"610467423",
                  "name":"Becky"
               }
            ]
         }
      },
      {
         "id":"2356544668014",
         "from":{
            "name":"Michelle Flannagan",
            "id":"1082137252"
         },
         "message":"My baby just took one step!!!! Hooray!!!",
         "updated_time":"2011-10-12T16:59:57+0000",
         "likes":{
            "data":[
               {
                  "id":"100000425199679",
                  "name":"JoAnn Flannagan"
               },
               {
                  "id":"743281907",
                  "name":"Linda"
               },
               {
                  "id":"1094602517",
                  "name":"Heidi"
               },
               {
                  "id":"1245543054",
                  "name":"Jackie"
               },
               {
                  "id":"537265197",
                  "name":"Lyndsay Wobbler"
               },
               {
                  "id":"65503058",
                  "name":"Hannah Flannagan"
               },
               {
                  "id":"649973071",
                  "name":"Laura Aslan"
               },
               {
                  "id":"620803293",
                  "name":"Cecil Lamascus"
               },
               {
                  "id":"100001980933232",
                  "name":"Larry Cardena"
               },
               {
                  "id":"650399539",
                  "name":"Julie Wash"
               },
               {
                  "id":"815885153",
                  "name":"Katie Weiks"
               },
               {
                  "id":"1003186904",
                  "name":"Jessica Goose"
               }
            ]
         },
         "comments":{
            "data":[
               {
                  "id":"2356544668014_2878833",
                  "from":{
                     "name":"Lyndsay Wobbler",
                     "id":"537265197"
                  },
                  "message":"Way to go James!!!",
                  "created_time":"2011-10-12T17:58:47+0000"
               },
               {
                  "id":"2356544668014_2882483",
                  "from":{
                     "name":"JoAnn Flannagan",
                     "id":"100000425199679"
                  },
                  "message":"Nice!",
                  "created_time":"2011-10-13T03:12:32+0000"
               },
               {
                  "id":"2356544668014_2888414",
                  "from":{
                     "name":"Annette Scheer",
                     "id":"100000473370414"
                  },
                  "message":"Congratulations, start clearing the path for safe landings.",
                  "created_time":"2011-10-14T00:26:28+0000"
               }
            ]
         }
      },
      {
         "id":"2328811814710",
         "from":{
            "name":"Michelle Flannagan",
            "id":"1082137252"
         },
         "message":"Little boys who throw fits will throw them in their rooms by themselves!",
         "updated_time":"2011-10-03T20:23:41+0000",
         "likes":{
            "data":[
               {
                  "id":"1171339951",
                  "name":"Alissa Apodaca"
               },
               {
                  "id":"815885153",
                  "name":"Katie Weeks"
               }
            ]
         },
         "comments":{
            "data":[
               {
                  "id":"2328811814710_2819669",
                  "from":{
                     "name":"Ingrid Schneider",
                     "id":"815744727"
                  },
                  "message":"Poor James.  I can come rescue him, or rescue you... xo See you in a few hours... if you bring him!!",
                  "created_time":"2011-10-03T20:28:35+0000"
               },
               {
                  "id":"2328811814710_2821191",
                  "from":{
                     "name":"Hannah Watson",
                     "id":"65503058"
                  },
                  "message":"It is not as much fun when you don't have an audience.",
                  "created_time":"2011-10-04T00:41:23+0000"
               }
            ]
         }
      },
      {
         "id":"1847289416951",
         "from":{
            "name":"Michelle Flannagan",
            "id":"1082137252"
         },
         "message":"Attention King Soopers shoppers: DON'T TOUCH MY BABY!!!",
         "updated_time":"2011-03-31T21:51:14+0000",
         "likes":{
            "data":[
               {
                  "id":"863070084",
                  "name":"Emily Boyle"
               },
               {
                  "id":"1586558701",
                  "name":"Kaitlin Boyer"
               }
            ]
         },
         "comments":{
            "data":[
               {
                  "id":"1847289416951_1429774",
                  "from":{
                     "name":"Andrew Wobbler",
                     "id":"705602145"
                  },
                  "message":"I bet Casey could MacGyver up a taser for you.",
                  "created_time":"2011-03-31T22:04:03+0000"
               },
               {
                  "id":"1847289416951_1430889",
                  "from":{
                     "name":"Tamara Feucht",
                     "id":"743554135"
                  },
                  "message":"I sympathize with you!  I dropped Chucky off at the Apex child care center today and the lady took him out of his car seat and said, \"do you mind if I kiss him all over? He's just so adorable\" as she started kissing his cheeks...ahhh!  Actually, YES, I do mind, but I didnt say anything to her.  ",
                  "created_time":"2011-04-01T00:37:08+0000"
               },
               {
                  "id":"1847289416951_1431531",
                  "from":{
                     "name":"Michelle Flannagan",
                     "id":"1082137252"
                  },
                  "message":"You should say something! A lady was pinching Liam's cheeks as I was perusing the pork chops. I turned around and shouted \"excuse me!!\" and she smiled and walked away but didn't say anything. I don't know where her dirty grocery shopping hands have been! I don't even touch his face when I'm in the grocery store because I've touched all kinds of things in there! I really hate to me \"that mom\" but seriously people, think!",
                  "created_time":"2011-04-01T02:07:44+0000"
               },
               {
                  "id":"1847289416951_1432577",
                  "from":{
                     "name":"Amanda Hall",
                     "id":"593319773"
                  },
                  "message":"Ha ha ha!  That never happened to me!  Way over the line though!",
                  "created_time":"2011-04-01T04:31:40+0000"
               }
            ]
         }
      },
      {
         "id":"1809985284371",
         "from":{
            "name":"Michelle Flannagan",
            "id":"1082137252"
         },
         "message":"The best solution to the majority of our problems: \"Just let future Casey and Michelle deal with it, they'll know what to do.\"",
         "updated_time":"2011-03-12T23:39:30+0000",
         "likes":{
            "data":[
               {
                  "id":"65503058",
                  "name":"Hannah Flannagan"
               }
            ]
         }
      },
      {
         "id":"1801275906642",
         "from":{
            "name":"Michelle Flannagan",
            "id":"1082137252"
         },
         "message":"Teething...Booooo!",
         "updated_time":"2011-03-08T03:57:01+0000",
         "comments":{
            "data":[
               {
                  "id":"1801275906642_1255127",
                  "from":{
                     "name":"JoAnn Flannagan",
                     "id":"100000425199679"
                  },
                  "message":"I hope it comes in fast so he is not  in pain for long. Give him another hug:)",
                  "created_time":"2011-03-08T14:26:55+0000"
               },
               {
                  "id":"1801275906642_1258767",
                  "from":{
                     "name":"Hannah Flannagan",
                     "id":"65503058"
                  },
                  "message":"Cutest Baby in the world....YEAH!!!",
                  "created_time":"2011-03-08T22:59:30+0000",
                  "likes":1
               },
               {
                  "id":"1801275906642_1258775",
                  "from":{
                     "name":"Michelle Flannagan",
                     "id":"1082137252"
                  },
                  "message":"You're right Hannah!",
                  "created_time":"2011-03-08T23:00:41+0000"
               }
            ]
         }
      },
   ],
   "paging":{
      "previous":"https://graph.facebook.com/1082137252/statuses?limit=25&since=1318823282",
      "next":"https://graph.facebook.com/1082137252/statuses?limit=25&until=1299188505"
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment