gauravjhaindia / restfb

Automatically exported from code.google.com/p/restfb
0 stars 0 forks source link

Example code giving some exception if get 0 sized array response #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the example code:
What steps will reproduce the problem?
1. Example code produces a few index out of bound exception
2. empty friend / feed list

What is the expected output? What do you see instead?
Anything else :)

What version of the product are you using? On what operating system?

1.6.9
Please provide any additional information below.
should have a few 
if(*.size()>0){
...
}
condition, like:
(GraphReaderExample.java)
...[~144]
        if (photosConnectionData.length() > 0) {
            String firstPhotoUrl = photosConnectionData.getJsonObject(0).getString("source");
            out.println(firstPhotoUrl);
        }
...[~174]
        if (myFriends.getData().size() > 0)
            out.println("First item in my feed: " + myFeed.getData().get(0).getMessage());
    }
...[~255]
        if (publicSearch.getData().size() > 0) {
            out.println("Public search: " + publicSearch.getData().get(0).getMessage());
        }
...[~276]
        if (myFriends.getData().size() > 0)
            out.println("First item in my feed: " + myFeed.getData().get(0));

Original issue reported on code.google.com by sas...@gmail.com on 11 Apr 2012 at 9:06

GoogleCodeExporter commented 9 years ago
correction:
  if (myFriends.getData().size() > 0)
            out.println("First item in my feed: " + myFeed.getData().get(0));
->
  if (myFeed.getData().size() > 0)
            out.println("First item in my feed: " + myFeed.getData().get(0));

:)

Original comment by sas...@gmail.com on 11 Apr 2012 at 9:16

GoogleCodeExporter commented 9 years ago
Thanks, this was me being lazy with the examples :)  I'll fix.

Original comment by m...@xmog.com on 19 Apr 2012 at 2:27

GoogleCodeExporter commented 9 years ago
Fixed by 
https://github.com/revetkn/restfb/commit/578b41d6d54783cfeaa93b4cf0fa7f338c5b6f6
7

Thank you!

Original comment by m...@xmog.com on 2 Sep 2012 at 8:15