huuanh1987 / facebook-java-api

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

Desktop App: d.getElementsByTagName( "secret" ).item( 0 ) is null #99

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello, I'm brand new with these Facebook developments, but have quite some
experience in Java. As I bump into a NullPointerException when trying to
create a desktop application connecting to Facebook, I was wondering
whether I am the only one who experiences this issue. Anyone else
recognizes this problem and/or knows how to solve it? Thanks!

What steps will reproduce the problem?
1. I try to execute the code which you find attached (FaceBookTestCode)
2. When "String session = client.auth_getSession(token);" is called, I get
a NullPointerException
3. This NullPointerException is being raised in FacebookRestClient, line 1899
4. It seems that the session secret key is null. However, for desktop
applications, the client wants to retrieve this key: 

if ( this._isDesktop ) {
this._sessionSecret = d.getElementsByTagName( "secret" ).item( 0
).getFirstChild().getTextContent();
}

What is the expected output? What do you see instead?
session secret to be found or this part of the coding not being executed if
desktop application.

What version of the product are you using? On what operating system?
1.8 / Windows XP

Please provide any additional information below.

Original issue reported on code.google.com by frederik...@gmail.com on 3 Sep 2008 at 9:40

Attachments:

GoogleCodeExporter commented 8 years ago
did you try turning on debug mode?  Could you put up that output?

Original comment by fern...@gmail.com on 4 Sep 2008 at 6:45

GoogleCodeExporter commented 8 years ago
Hi,

I've attached a screenshot of the debugging beneath. Is there something 
specific you
want me to capture?

Kind regards,

Frederik

Original comment by frederik...@gmail.com on 4 Sep 2008 at 7:32

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for having patience with us :)

I meant calling the client.setDebug( true ) method.  It asks the library to 
print out
more debug information, such as the exact request/response to/from facebook.

Original comment by fern...@gmail.com on 6 Sep 2008 at 12:57

GoogleCodeExporter commented 8 years ago
this looks like might be related to another bug.. we'll look into it.

Original comment by fern...@gmail.com on 23 Nov 2008 at 7:48

GoogleCodeExporter commented 8 years ago
I've recreated this issue using your code and have fixed the issue that you've
reported by modifying the following code:

    public String auth_getSession( String authToken ) throws FacebookException {
        List<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>();
        params.add( newPair( "auth_token", authToken ) );
        if ( this._isDesktop ) {
            params.add( newPair( "generate_session_secret", "true" ) );
        }
        Document d = callMethod( FacebookMethod.AUTH_GET_SESSION, params );

However, there are a couple more problems I'm seeing, so I'll sort those out 
before
checking anything in.

Original comment by david.j....@googlemail.com on 21 Dec 2008 at 10:48

GoogleCodeExporter commented 8 years ago
Fixed and JUnit test checked in to demonstrate the solution.
Issue99FriendsGetCachedPOJOTest.java.

The fix isn't pretty. I don't like the way that the caching of the friends list 
works
anyway. If anyone's interested to take a peek, you can see that I've suggested a
different approach in the branch/composition version in subversion.

Original comment by david.j....@googlemail.com on 22 Dec 2008 at 9:15