ritamnrg / facebook-java-api

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

Calling 'users_setStatus()' sometimes results in ClassCastException being thrown #318

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Make a users_setStatus call many times
2. Eventually (it seems sporatic) a ClassCastException is thrown from this
method
3.

What is the expected output? What do you see instead?
Expected result is a true/false return from the method

What version of the product are you using? On what operating system?
I have seen this in 2 versions: 2.1.1 and 3.0.1 (two separate applications)

Please provide any additional information below.
It does not always happen. The application will run for days and will
occassionally throw this error, which even when caught results in part of
the application failing. The following error is thrown:

java.lang.ClassCastException: java.lang.String cannot be cast to
java.lang.Boolean
      at
com.google.code.facebookapi.ExtensibleClient.extractBoolean(ExtensibleClient.jav
a:2618)
      at
com.google.code.facebookapi.ExtensibleClient.users_setStatus(ExtensibleClient.ja
va:2059)
      at
com.google.code.facebookapi.ExtensibleClient.users_setStatus(ExtensibleClient.ja
va:2044)
      at
com.google.code.facebookapi.SpecificReturnTypeAdapter.users_setStatus(SpecificRe
turnTypeAdapter.java:621)
      at com.turbine.facebook.PlayerFeed.runJob(PlayerFeed.java:760)
      at com.turbine.scheduler.Scheduler.run(Scheduler.java:173)
      at java.lang.Thread.run(Thread.java:619)

I have seen a similar problem mentioned in issue #307. Surprisingly, the
fix provided in that thread only fixes that one method. I  believe that the
following check, implemented in issue #307:

String userId = callMethod(FacebookMethod.USERS_GET_LOGGED_IN_USER);
            userId = userId.replace("\"", "");
            cacheUserId = extractLong(userId);

should instead be applied to the method "extractBoolean" so that this fix
applies across all methods. The fix would then be along the lines of changing:

return Boolean.parseBoolean( String.valueOf( out ) );

to

return Boolean.parseBoolean( String.valueOf( out ).replace("\"", "") );

Original issue reported on code.google.com by ellese...@gmail.com on 13 May 2010 at 4:22