nourelhoudabenahmed / facebook-java-api

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

Document.getElementsByTagName() returns incorrect result for some users #299

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Send friend request for Facebook member "Tom Sawyer" and wait for reply.
2. Use the code below to fetch the member's sex (note that in the member's 
Facebook profile, he is declared "male").
3. Notice that the code returns "female".

What is the expected output? What do you see instead?
The variable 'element' should contain the String "male"; instead, it 
contains "female"

What version of the product are you using? On what operating system?
3.0.2 on Windows XP, SP3

Please provide any additional information below.

    static String[] profile_list = {"LOCALE:", "BIRTHDAY:", "INTERESTED 
IN:", "RELATIONSHIP STATUS:", "SEX:", "TIMEZONE (GMT):", "CURRENT CITY:", 
"FAVORITE BOOKS:", "INTERESTS:", "FAVORITE MOVIES:", "FAVORITE MUSIC:", 
"FAVORITE QUOTATIONS:", "LOOKING FOR:", "HIGH SCHOOL:", "COLLEGE:", 
"ACTIVITIES:", "FAVORITE TV SHOWS:", "POLITICAL VIEWS:", "RELIGIOUS 
VIEWS:", "HOMETOWN:", "EMPLOYER:"};

      fields_init = Arrays.asList(ProfileField.LOCALE, 
ProfileField.BIRTHDAY, ProfileField.MEETING_SEX, 
ProfileField.RELATIONSHIP_STATUS, ProfileField.SEX, ProfileField.TIMEZONE, 
ProfileField.CURRENT_LOCATION, ProfileField.BOOKS, ProfileField.INTERESTS, 
ProfileField.MOVIES, ProfileField.MUSIC, ProfileField.QUOTES, 
ProfileField.MEETING_FOR, ProfileField.HS_INFO, 
ProfileField.EDUCATION_HISTORY, ProfileField.ACTIVITIES, ProfileField.TV, 
ProfileField.POLITICAL, ProfileField.RELIGION, 
ProfileField.HOMETOWN_LOCATION, ProfileField.WORK_HISTORY);

Document doc = client.users_getInfo(uids, fields_init);

index = 0;
for (ProfileField pfield : fields_init)
  {            
  element = "";

  if (!profile_list[index].equals("HIGH SCHOOL:") &&
      !profile_list[index].equals("COLLEGE:") &&
      !profile_list[index].equals("EMPLOYER:") &&
      !profile_list[index].equals("INTERESTED IN:") &&
      !profile_list[index].equals("LOOKING FOR:") &&
      !profile_list[index].equals("HOMETOWN:"))
    {                    
    element = 
doc.getElementsByTagName(pfield.fieldName()).item(0).getTextContent();
    content = profile_list[index] + element;
    }
  index++;
  }

Original issue reported on code.google.com by ruom...@gmail.com on 1 Mar 2010 at 4:56