Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

NPE in parse of update response #57

Open
juniorklein opened this issue Jun 2, 2014 · 0 comments
Open

NPE in parse of update response #57

juniorklein opened this issue Jun 2, 2014 · 0 comments

Comments

@juniorklein
Copy link

Hi,
When when perform a call to get the user network updates I got an NPE exception.

The stacktrace is:

java.lang.NullPointerException
    at org.codehaus.jackson.node.TreeTraversingParser.<init>(TreeTraversingParser.java:72)
    at org.codehaus.jackson.map.ObjectMapper.treeAsTokens(ObjectMapper.java:1717)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:2015)
    at org.springframework.social.linkedin.api.impl.json.LinkedInNetworkUpdateListDeserializer.deserialize(LinkedInNetworkUpdateListDeserializer.java:88)
    at org.springframework.social.linkedin.api.impl.json.LinkedInNetworkUpdateListDeserializer.deserialize(LinkedInNetworkUpdateListDeserializer.java:43)
    at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217)
    at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:194)
    at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30)
    at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)
    at org.codehaus.jackson.map.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:905)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObjectUsingNonDefault(BeanDeserializer.java:739)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:683)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1923)
    at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readJavaType(MappingJacksonHttpMessageConverter.java:166)
    at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.read(MappingJacksonHttpMessageConverter.java:161)
    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:94)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:496)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:465)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:236)
    at org.springframework.social.linkedin.api.impl.NetworkUpdateTemplate.getNetworkUpdates(NetworkUpdateTemplate.java:141)
    at org.springframework.social.linkedin.api.impl.NetworkUpdateTemplate.getNetworkUpdates(NetworkUpdateTemplate.java:98)

Debugging the code, I found the problem. The response sent by LinkedIn is invalid because doesn't have updateContent.
This is JSON response for update with problem:

{
    "isCommentable": true,
    "isLikable": true,
    "isLiked": false,
    "likes": {
        "_total": 10,
        "values": [
            ...
        ]
    },
    "numLikes": 10,
    "timestamp": 1401725796929,
    "updateComments": {
        "_total": 0
    },
    "updateContent": {},
    "updateKey": "UPDATE-19924-5879264111107284992",
    "updateType": "SHAR"
}

In line 88 from LinkedInNetworkUpdateListDeserializer class, when jackson attempts to readValue from a null person, the NPE is raised.

This is an error in linkedin spring social or in linkedin?

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant