huuanh1987 / facebook-java-api

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

admin_getAppPropertiesAsSet throws java.lang.StringIndexOutOfBoundsException #212

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Here's a code snippet...

    List<ApplicationProperty> appPropertyNames = 
        new ArrayList<ApplicationProperty>();
    appPropertyNames.add(ApplicationProperty.APPLICATION_NAME);
    appPropertyNames.add(ApplicationProperty.CALLBACK_URL);
    appPropertyNames.add(ApplicationProperty.CANVAS_NAME);
    facebookClient.admin_getAppPropertiesAsSet(appPropertyNames);

What is the expected output? What do you see instead?
I was somewhat hoping to see a list of application properties.  Instead I get 
the following ugly stack trace:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1768)
    at com.google.code.facebookapi.ApplicationPropertySet.parseFragment(ApplicationPropertySet.java:222)
    at com.google.code.facebookapi.ApplicationPropertySet.parseProperties(ApplicationPropertySet.java:212)
    at com.google.code.facebookapi.ApplicationPropertySet.<init>(ApplicationPropertySet.java:62)
    at com.google.code.facebookapi.ExtensibleClient.admin_getAppPropertiesAsSet(ExtensibleClient.java:2594)
    at com.google.code.facebookapi.ExtensibleClient.admin_getAppPropertiesMap(ExtensibleClient.java:2573)

What version of the product are you using? On what operating system?
I'm using version 2.1.1 on OS X with JDK 1.5.0_16.

Original issue reported on code.google.com by carl.sch...@gmail.com on 2 Jun 2009 at 4:10

GoogleCodeExporter commented 8 years ago
Sorry, I should also point out that I'm using FacebookJaxbRestClient.  Also, 
here's the response from 
Facebook:

<?xml version="1.0" encoding="UTF-8"?>
<admin_getAppProperties_response xmlns="http://api.facebook.com/1.0/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://api.facebook.com/1.0/ 
http://api.facebook.com/1.0/facebook.xsd">{"application_name":"Playground of 
Carl","callback_url":"http:\/\/cschmidt.homelinux.org:8080\/facebook\/","
canvas_name":"playgroundofcarl"}</admin_getAppProperties_response>

Original comment by carl.sch...@gmail.com on 2 Jun 2009 at 4:23

GoogleCodeExporter commented 8 years ago

Original comment by abdinoor on 5 Jun 2009 at 4:31

GoogleCodeExporter commented 8 years ago
As it turns out there was an issue with the JaxB client not decoding the 
response from 
facebook and instead of normal double quotes there were " html-entities. I've 
fixed this and checked it in. If you want to use the newest code you'll have to 
download the source code and build it locally. Or you can wait for a snapshot 
release.

Original comment by abdinoor on 5 Jun 2009 at 8:40

GoogleCodeExporter commented 8 years ago
I'll likely wait for a snapshot.  Thanks for the quick fix!

Original comment by carl.sch...@gmail.com on 8 Jun 2009 at 4:42