rekbun / bitlyj

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

the shortening method causes an exception #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. running teh demo in the project homepage
2.
3.

What is the expected output? What do you see instead?
a shortened URL. 
net.sf.json.JSONException: JSONObject["hash"] not found.
at net.sf.json.JSONObject.getString(JSONObject.java:2177)
at com.rosaloves.net.shorturl.bitly.BitlyImpl.shorten(BitlyImpl.java:75)
...

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

Please provide any additional information below.
here's the code i ran,
try {
    Bitly bitly = BitlyFactory.newInstance("bitlyapidemo",
"R_0da49e0a9118ff35f52f629d2d71bf07");
            BitlyUrl bUrl =
bitly.shorten("http://rosaloves.com/stories/view/13");
            System.out.println(bUrl.getShortUrl().toString());
        } catch (Exception e) {
            e.printStackTrace();
  }

Original issue reported on code.google.com by adham.20...@gmail.com on 23 Mar 2010 at 3:48

GoogleCodeExporter commented 9 years ago
Try the same code using your own username and API key. The demo account gets 
rate-limited frequently and I'm 
quite sure you're seeing the intended behavior. The error handling could, 
obviously, be a bit better. Please verify 
that it works with your own credentials, and then we can open an issue for 
better error handling.

Original comment by burningo...@gmail.com on 30 Mar 2010 at 10:55

GoogleCodeExporter commented 9 years ago
I have the same problem. I am using my own credentials, the problem still 
persists.
any help would be appreciated. 

Original comment by priya.ve...@gmail.com on 3 May 2010 at 7:11

GoogleCodeExporter commented 9 years ago
try to make sure that your credentials are put down exactly i.e sometimes when 
we
copy and paste the credentials there's an extra space that is added to the
credentials which may cause a similar problem.

i used my own credentials and it worked fine.

hope that this was useful

Original comment by adham.20...@gmail.com on 3 May 2010 at 11:23

GoogleCodeExporter commented 9 years ago
I have the same problem,using my own credentials too.

Original comment by will.que...@gmail.com on 5 May 2010 at 1:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
well, I'm having this issue too. the error handling needs to be better, 
otherwise, it cannot be really used for a product. I may come back to check it.

Original comment by paul.xio...@gmail.com on 13 Jun 2010 at 12:51

GoogleCodeExporter commented 9 years ago
I have the same problem

Original comment by victor.manuel.toto on 29 Jun 2010 at 5:03

GoogleCodeExporter commented 9 years ago
Hi Guys, for a work around see Issue-6 on the bug track on this site, more work 
but it works!

Scott.

Original comment by ScottJBa...@gmail.com on 2 Jul 2010 at 12:52

GoogleCodeExporter commented 9 years ago
Just started using this for a project I've got coming up - awesome work, but I 
also experienced this issue in two scenarios.

The first one was that I didn't have the required dependencies available. I 
used the maven version of Bitlyj and unfortunately, the POM doesn't include 
it's own required dependencies... should be an easy fix for the developer?

2nd time it occured it was because my tests were not prefixing the url with 
"http://" - make sure that you have the url prefixed with http:// before 
submitting it for shortening. Otherwise the same exception gets thrown

Original comment by matt.kee...@gmail.com on 2 Jul 2010 at 8:31

GoogleCodeExporter commented 9 years ago
I understand the frustrations with the error handling, but that's not really 
what this ticket is about. I've repeated the need to use your own bitly 
credentials when testing. Otherwise you will get errors (rate limiting). I'd 
like to close this ticket as a non issue.

As for the error handling, I'd like to address this in 2.0 (now in trunk). 2.0 
is a smaller rewrite with a simplified architecture and better - that is, 
logical - error handling. Because it's a rewrite, it's incompatible. However, I 
don't see that as a problem given that the library is so small.

So my question is, can those of you suffering the pains of the poor error 
handling in 1.0 switch to 2.0, or do you need a 1.0 fix release?

Original comment by ch...@rosaloves.com on 17 Jul 2010 at 10:25

GoogleCodeExporter commented 9 years ago
@ matt, regarding deps - Every dep of bitlyj is in the pom. The json lib is a 
common library among projects, so the scope is declared to "provided" - meaning 
users of bitlyj are required to supply it. That's intentional, so that bitlyj 
doesn't step on an app by injecting conflicting versions of a dependency. It 
should have been documented, yes, but with bitlyj 2.0 there are no external 
dependencies.

Original comment by ch...@rosaloves.com on 18 Jul 2010 at 2:19

GoogleCodeExporter commented 9 years ago
No response, and 2.0 is stable with no such issue, so I'm closing this one.

Original comment by ch...@rosaloves.com on 16 Aug 2010 at 1:25