magesh0407 / facebook-java-api

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

ExtensibleClient.users_hasAppPermission(Permission, Long) throws ClassCastException #272

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Instantiate a FacebookJsonRestClient
2. Use the client instance to make a call to users_hasAppPermission()
3. ClassCastException is thrown by trying to cast Integer to Boolean

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
v3.0.1 on Windows Vista, JDK 1.6.0.14

Please provide any additional information below.

Possible solution in ExtensibleClient, line 1123
-----
    public boolean users_hasAppPermission( Permission perm, Long userId 
) throws FacebookException {
        if ( userId != null ) {
//          return extractBoolean( callMethod( 
FacebookMethod.USERS_HAS_APP_PERMISSION_NOSESSION, Pairs.newPair( 
"ext_perm", perm.getName() ), Pairs.newPair( "uid", userId ) ) );
            return extractInt( callMethod( 
FacebookMethod.USERS_HAS_APP_PERMISSION_NOSESSION, Pairs.newPair( 
"ext_perm", perm.getName() ), Pairs.newPair( "uid", userId ) ) ) == 1;

        } else {
//          return extractBoolean( callMethod( 
FacebookMethod.USERS_HAS_APP_PERMISSION, Pairs.newPair( "ext_perm", 
perm.getName() ) ) );
            return extractInt( callMethod( 
FacebookMethod.USERS_HAS_APP_PERMISSION, Pairs.newPair( "ext_perm", 
perm.getName() ) ) ) == 1;
        }
    }

Original issue reported on code.google.com by lawrence...@gmail.com on 25 Nov 2009 at 3:58

GoogleCodeExporter commented 8 years ago
Additional info, Facebook users_hasAppPermission method returns value "1/0" 
instead of 
"true/false"

Original comment by lawrence...@gmail.com on 25 Nov 2009 at 4:00