java.lang.NullPointerException

Spring JIRA | Robert Blair | 5 years ago
  1. 0

    Using FQL to access the stream table, many of the json elements return are null at times. if you call FqlResult.getList(String fieldName, FqlResultMapper<T> mapper) with a field that exists, but is null, a null pointer exception will be thrown: java.lang.NullPointerException at org.springframework.social.facebook.api.FqlResult.getList(FqlResult.java:163) at com.inqmobile.inqcloud.domain.facebook.FbStreamItemMapper.mapObject(FbStreamItemMapper.java:58) at com.inqmobile.inqcloud.domain.facebook.FbStreamItemMapper.mapObject(FbStreamItemMapper.java:1) at org.springframework.social.facebook.api.impl.FqlTemplate.query(FqlTemplate.java:48) which corresponds to List<Map<String, Object>> arrayItems = (List<Map<String, Object>>) resultMap.get(fieldName); for (Map<String, Object> arrayItem : arrayItems) { ~~~~~ this line ~~~~~ response.add(mapper.mapObject(new FqlResult(arrayItem))); } Expected behavior is to return null if the json value is null. https://graph.facebook.com/fql?q=SELECT post_id, message, action_links FROM stream WHERE source_id=100002487294420 LIMIT 1 returns { "data": [ { "post_id": "100002487294420_404871966208922", "message": "Robert Blair http://sphotos.xx.fbcdn.net/hphotos-ash4/s320x320/375127_183841518401962_100003283444808_309767_1436664147_n.jpg wat is dat! ", "action_links": null } ] } --- note that other getXYZ calls throw null pointer or number format exceptions if the value is null, as opposed to not present. Facebook fql will sometimes return null for values documented as type 'int' I would like the ability to call getLong without first checking if the original result is null. Might also want to expose resultMap.containsKey() on the FqlResult class too.

    Spring JIRA | 5 years ago | Robert Blair
    java.lang.NullPointerException
  2. 0

    Using FQL to access the stream table, many of the json elements return are null at times. if you call FqlResult.getList(String fieldName, FqlResultMapper<T> mapper) with a field that exists, but is null, a null pointer exception will be thrown: java.lang.NullPointerException at org.springframework.social.facebook.api.FqlResult.getList(FqlResult.java:163) at com.inqmobile.inqcloud.domain.facebook.FbStreamItemMapper.mapObject(FbStreamItemMapper.java:58) at com.inqmobile.inqcloud.domain.facebook.FbStreamItemMapper.mapObject(FbStreamItemMapper.java:1) at org.springframework.social.facebook.api.impl.FqlTemplate.query(FqlTemplate.java:48) which corresponds to List<Map<String, Object>> arrayItems = (List<Map<String, Object>>) resultMap.get(fieldName); for (Map<String, Object> arrayItem : arrayItems) { ~~~~~ this line ~~~~~ response.add(mapper.mapObject(new FqlResult(arrayItem))); } Expected behavior is to return null if the json value is null. https://graph.facebook.com/fql?q=SELECT post_id, message, action_links FROM stream WHERE source_id=100002487294420 LIMIT 1 returns { "data": [ { "post_id": "100002487294420_404871966208922", "message": "Robert Blair http://sphotos.xx.fbcdn.net/hphotos-ash4/s320x320/375127_183841518401962_100003283444808_309767_1436664147_n.jpg wat is dat! ", "action_links": null } ] } --- note that other getXYZ calls throw null pointer or number format exceptions if the value is null, as opposed to not present. Facebook fql will sometimes return null for values documented as type 'int' I would like the ability to call getLong without first checking if the original result is null. Might also want to expose resultMap.containsKey() on the FqlResult class too.

    Spring JIRA | 5 years ago | Robert Blair
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.social.facebook.api.FqlResult.getList()
    2. Facebook API
      FqlResult.getList
      1. org.springframework.social.facebook.api.FqlResult.getList(FqlResult.java:163)
      1 frame
    3. com.inqmobile.inqcloud
      FbStreamItemMapper.mapObject
      1. com.inqmobile.inqcloud.domain.facebook.FbStreamItemMapper.mapObject(FbStreamItemMapper.java:58)
      2. com.inqmobile.inqcloud.domain.facebook.FbStreamItemMapper.mapObject(FbStreamItemMapper.java:1)
      2 frames
    4. Facebook API
      FqlTemplate.query
      1. org.springframework.social.facebook.api.impl.FqlTemplate.query(FqlTemplate.java:48)
      1 frame