huuanh1987 / facebook-java-api

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

Incorrect signature if users_getInfo is called with an empty list of uids #199

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

client.users_getInfo(new ArrayList<Long>(), EnumSet.of(ProfileField.NAME));

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

Results in "com.google.code.facebookapi.FacebookException: Incorrect signature"

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

2.1.0

Please provide any additional information below.

Original issue reported on code.google.com by lauri.h.lehtinen@gmail.com on 28 Apr 2009 at 9:10

Attachments:

GoogleCodeExporter commented 8 years ago
I would agree that it is rather pointless to make this call with en empty list 
of
uids (I fixed my own code too), but this is a result of a more generic problem 
with
building the signature when one or more of the param values are null.

Original comment by lauri.h.lehtinen@gmail.com on 28 Apr 2009 at 9:12

GoogleCodeExporter commented 8 years ago

Original comment by david.j....@googlemail.com on 30 Apr 2009 at 9:48

GoogleCodeExporter commented 8 years ago
JUnit test would be great (I'm just trying to get developers to write JUnit 
tests at
the moment rather than me taking sample code and writing a JUnit test from it.) 
Thanks!

Original comment by david.j....@googlemail.com on 1 May 2009 at 9:10

GoogleCodeExporter commented 8 years ago
Here goes

Original comment by lauri.h.lehtinen@gmail.com on 1 May 2009 at 3:03

Attachments:

GoogleCodeExporter commented 8 years ago
Cool, thanks. The following lines are not necessary (they're meaningless):
Assert.assertTrue( true );

But I'm getting the same failures here as I'm sure you are, so thanks!

Working on this...

Original comment by david.j....@googlemail.com on 6 May 2009 at 6:33

GoogleCodeExporter commented 8 years ago
Line 704 of ExtensibleClient.java contains an assertion:

        assert ( !fields.isEmpty() );

So, the original developer built an assumption in that nobody would pass an 
empty 
list in. I'm not sure that we should actually add any code for this; what's the 
behaviour you'd like to see? Perhaps it is worth constructing and throwing a 
FacebookException with a decent error message?

Original comment by david.j....@googlemail.com on 6 May 2009 at 6:41

GoogleCodeExporter commented 8 years ago
Well I would expect the client to make the call I'm asking it to make no matter 
what
.. be it empty and waste of resources or not.

IMO, there is a bug in the signature generation if a null value finds it's way 
there.

When the call to Facebook API is prepared, null values are checked for and 
replaced
with empty strings, and that's what I think should happen in the signature 
generation
phase. 

Original comment by lauri.h.lehtinen@gmail.com on 6 May 2009 at 6:50

GoogleCodeExporter commented 8 years ago
Sure. Would appreciate it if you could create a patch; I'll apply it. Thanks.

Original comment by david.j....@googlemail.com on 6 May 2009 at 7:04

GoogleCodeExporter commented 8 years ago
Did you look at the one that I attached earlier?

Original comment by lauri.h.lehtinen@gmail.com on 6 May 2009 at 7:05

GoogleCodeExporter commented 8 years ago
Sorry, I missed it. I've applied it and checked in the JUnit test with a couple 
of 
modifications.

All JUnit tests pass, so we can be confident that this small change in a 
critical 
class hasn't broken anything (much).

Please update your code and ensure you're happy. Thanks. I've also bumped you 
to 
member status of this project which means you can make code commits if you 
like. 
Please use with care and run JUnit tests through; feel free to mail me with 
patches 
you're thinking of committing for review the first couple of times. Enjoy.

Original comment by david.j....@googlemail.com on 6 May 2009 at 7:30

GoogleCodeExporter commented 8 years ago
Thanks, I hope I get a chance contribute smth in the future!

Original comment by lauri.h.lehtinen@gmail.com on 6 May 2009 at 7:50