rekbun / bitlyj

Automatically exported from code.google.com/p/bitlyj
0 stars 0 forks source link

Throws JSONException on certain URL's #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  I'm using the following groovy code to call the bitlyj library

        def bitly = BitlyFactory.newInstance("visforvoltage", "--my API
key--");
        def shorty = bitly.shorten(url);
        return shorty.getShortUrl();

2.
3.

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

With the URL:
http://blog.ttxgp.com/index.php?op=ViewArticle&articleId=74&blogId=1

It throws JSONException saying "null object"

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

trunk, as of june 28, 2009

Please provide any additional information below.

Original issue reported on code.google.com by reiki...@gmail.com on 29 Jun 2009 at 4:49

GoogleCodeExporter commented 9 years ago
I can confirm this. I get

net.sf.json.JSONException:
JSONObject["http://blog.ttxgp.com/index.php?op=ViewArticle&articleId=74&blogId=1
"]
not found.
    at net.sf.json.JSONObject.get(JSONObject.java:1449)
    at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1536)
    at com.rosaloves.net.shorturl.bitly.ResponseImpl.getJSONResult(ResponseImpl.java:39)
    at com.rosaloves.net.shorturl.bitly.BitlyImpl.shorten(BitlyImpl.java:62)

Original comment by bohtvaroh@gmail.com on 9 Sep 2009 at 3:30

GoogleCodeExporter commented 9 years ago
The problem is with '&' character. Without it shortening works fine.

Original comment by bohtvaroh@gmail.com on 9 Sep 2009 at 3:37

GoogleCodeExporter commented 9 years ago
Here is alternative simple shortener client with only apache commons-httpclient
dependency (see attach).

Original comment by bohtvaroh@gmail.com on 9 Sep 2009 at 4:55

Attachments:

GoogleCodeExporter commented 9 years ago
fixed via urlencoding the longUrl - must have missed that ;)

Original comment by ch...@rosaloves.com on 7 Oct 2009 at 3:26