huuanh1987 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

friends_getList( friendListId ) method not working i.e throws exception #220

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. From a web application,  
2. create FacebookJaxbRestClient object
3. get valid session key
4. call friends_getList( friendListId ) where friendListId is a valid Id.

What is the expected output? What do you see instead?
Expected output is that we receive friends Id present in that friendListId.
Actual output is 
SEVERE: Servlet.service() for servlet GetSessionKeyServlet threw exception
java.lang.IllegalArgumentException: given invalid friendListId 1180442313509
    at
com.google.code.facebookapi.ExtensibleClient.friends_getList(ExtensibleClient.ja
va:1336)
    at
GetSessionKeyServlet.getFriendsOfFriendListGroup(GetSessionKeyServlet.java:232)
    at GetSessionKeyServlet.processRequest(GetSessionKeyServlet.java:155)
    at GetSessionKeyServlet.doGet(GetSessionKeyServlet.java:39)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:290)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:206)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
33)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
91)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109
)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Pr
otocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

What version of the product are you using? On what operating system?
Tryed on 2 version 
a) facebook-java-api-2.1.0-bin.zip 
b)and facebook-java-api-2.1.1-bin.zip

Please provide any additional information below.

Original issue reported on code.google.com by rajesh....@gmail.com on 28 Jun 2009 at 11:05

GoogleCodeExporter commented 8 years ago
This is the code snippet that has been used.

public List<Long> getFriendsOfFriendListGroup( long friendListId,
FacebookJaxbRestClient facebookJaxbRestClient )
    {
        List<Long> friendsUID = null;
        FriendsGetResponse response = null;

        try
        {
            facebookJaxbRestClient.friends_getList( friendListId );
            System.out.println( "Document returned by friends_getList : "
                    + facebookJaxbRestClient.getRawResponse() );
            response = (FriendsGetResponse) facebookJaxbRestClient
                    .getResponsePOJO();
            friendsUID = response.getUid();
        } catch ( FacebookException exception )
        {
            exception.printStackTrace();
        }
        return friendsUID;
    }

Original comment by rajesh....@gmail.com on 28 Jun 2009 at 11:07

GoogleCodeExporter commented 8 years ago
Tested on Windows XP

Original comment by rajesh....@gmail.com on 28 Jun 2009 at 11:14

GoogleCodeExporter commented 8 years ago
To fix this issue replace 
public T friends_getList( Long friendListId ) throws FacebookException {
        if ( null != friendListId && 0L <= friendListId ) {
            throw new IllegalArgumentException( "given invalid friendListId " + friendListId );
        }
        return callMethod( FacebookMethod.FRIENDS_GET, newPair( "flid", friendListId ) );
    }

with 

public T friends_getList( Long friendListId ) throws FacebookException {
        if ( ( null == friendListId ) || ( 0L > friendListId ) ) {
            throw new IllegalArgumentException( "given invalid friendListId " + friendListId );
        }
        return callMethod( FacebookMethod.FRIENDS_GET, newPair( "flid", friendListId ) );
    }

in ExtensibleClient<T> class

Original comment by rajesh....@gmail.com on 5 Jul 2009 at 4:28

GoogleCodeExporter commented 8 years ago
This is also occurring in v3.0.1 of the SDK.

-Ron

Original comment by ronemr...@gmail.com on 5 Nov 2009 at 4:56

GoogleCodeExporter commented 8 years ago
This is because facebook no longer supports getting friends list of any other 
id except yours. Replaced the ID with your own id. If it works then this issue 
should be closed since this is a facebook limitation

Original comment by ganesh.k...@gmail.com on 12 Sep 2010 at 10:27