PDA

View Full Version : Spring Social Facebook, STATUS message, post.getType().toString() return LINK



dontpanic
Aug 25th, 2011, 12:52 PM
Not sure if I've stumbled across a defect or if I've misconfigured/misused something, I have some basic code that is retrieving facebook posts from the main feed. For some status messages the post.getType().toString() message returns LINK rather than STATUS, even though the underlying JSON says STATUS, here is some example code

ObjectMapper mapper = new ObjectMapper();
String originalPost = mapper.writeValueAsString(post);

logger.info("FB item with...");
logger.info("post.getType(): " + post.getType().toString());
logger.info("post.getFrom()" + post.getFrom().getName());
logger.info("json is: " + mapper.writeValueAsString(post));

in the logs i see

2011-08-25 10:37:47.280 post.getType(): LINK

but when I inspect the JSON I see a status message...

{"name":null,"message":null,"id":"1438884935_2308048907541","type":"STATUS","description":null,"icon":null,"link":null,"from":{"name":"xxxxxx","id":"1438884935"},"createdTime":1314255056000,"updatedTime":1314255056000,"comments":null,...

Anyone else seeing something similar?

habuma
Aug 25th, 2011, 03:24 PM
I just tried this against a couple of feeds with a nice mix of post types and getType() matched up perfectly with what was in the JSON. I'm wondering a few things:

- Is this with the latest snapshots (or even RC2)? Or is it with some older version of Spring Social?
- Where did you put the code above to get the logging?
- Is there something unusual about the feed your testing this against? I only see a bit of the JSON here so it's hard to say.
- And what you show here is curious to me because the "type" is "STATUS", when I know FB returns lowercase "status". And there are other oddities, such as null values and non-wellformed JSON. Is this really the JSON you got back from Facebook?