Getting "java.lang.ArrayIndexOutOfBoundsException: 0" whiel trying to Authenticate using XAuth.

  14 posts   Feedicon  
Replies: 13 - Last Post: February 02, 2012 14:17
by: konysolution
showing 1 - 14 of 14
 
Posted: January 05, 2012 15:01 by konysolution

Hi, I'm using the latest Twitter API ME 1.8.2 libraries and trying to authenticate the using the Xauth.

I'm using the following to authenticate using the Xauth: Credential c = new Credential("user_name", "password", "conKey", "conSecret"); UserAccountManager m = UserAccountManager.getInstance(c);

if (m.verifyCredential()) { System.out.println("User's credentials are OK! You're now logged in!"); } else { System.out.println("User name and/or password are invalid!"); } which is given in the website.

But I'm continuously getting the ArrayIndexOutOfBoundsException at "UserAccount ua = handler.getParsedUserAccounts()[0] "

In the AccountHandler.java I have added a print statement to get the size of the usersList using usersList.size() and it is returning "0"(Zero).

I tried to print the response using "resp.getBodyContent()" in the UserAccountManager.java and it is printing a valid xml response which contains latest tweet, no. of followers, description, image etc by which I think it is authenticating. But if I include this print it is giving another exception java.io.IOException: Premature end of file. at at com.twitterapime.rest.UserAccountManager.verifyCredential(UserAccountManager.java:at com.twitterapime.rest.UserAccountManager.verifyCredential(UserAccountManager.java:

Please help me resolve this. I'm facing this issue for past 3-4 days and any help to resolve this would be highly appreciated. PS: I have registered my application and got the approval for Xauth authentication from twitter.

 
Posted: January 06, 2012 14:34 by Ernandes Mourao Junior
What is your platform?
 
Posted: January 07, 2012 11:19 by konysolution
I'm trying to run it on Eclipse Helios on Windows 7. I used with different twitter accounts but getting the same exceptions.
 
Posted: January 08, 2012 13:53 by konysolution
Hi I'm using the "twitter_api_me-1.8.2-android". My goal is to integrate the twitter to an android app.
 
Posted: January 08, 2012 20:02 by Ernandes Mourao Junior
Have you ever managed it to work with older versions? You could download Twapime for Android, an open source app that I developed using Twitter API ME. You acn downlod from download section, under Twapime folder.
 
Posted: January 09, 2012 11:47 by konysolution
Hi,
This is the first time I'm using this api.
Our requirement is:
Any user can login with his/her credential. I need to show the user's home timeline. And user should be able to post a tweet on another fixed twitter account(which is the support twitter id).
Same as user posting the tweet "@support HI".
We implemented these features in iPhone app using the xauth libraries and are trying to do the same. We preferred xauth because at that time **oauth** doesn't have all these features. Please let me know if all these features are supported with **oauth** now.
 
Posted: January 11, 2012 20:10 by Ernandes Mourao Junior
Yes! You can do all those things using this API and xAuth.

Support this project:
Donate now!
 
Posted: January 09, 2012 13:17 by konysolution
Hi Erandes,
I took the Twapime for Android. At the first glance I think you are using "oAuth" rather than "xauth". Will I able to authenticate any user, show the user's timeline and post a tweet on a specific(fixed) user's wall?

Thanks in advance.
 
Posted: January 11, 2012 20:12 by Ernandes Mourao Junior
Yes! TwAPIme for Android now uses OAuth. On the other hand, there is an Activity to log in using xAuth. But it is there just for reference.

Yes, you can do! If you want, you try the app using your keys, regardless it uses OAuth. It is going to be good, because you will be able to see all what the API can do!

Support this project:
Donate now!
 
Posted: January 09, 2012 13:21 by konysolution
One more thing is we have the got the approval for xauth from twitter when we were integrating to iPhone app. Now we are using the same Consumer Key and Consumer Secret which we used for iPhone integration. So I'm assuming that I don't need to ask twitter for xauth provision again. Moreover when I try to print using "resp.getbodycontent" it is giving the response which we get only after a user signs in. I think the exception is coming when the parsing is executed.

Thanks.
 
Posted: January 11, 2012 20:15 by Ernandes Mourao Junior
Yes! You can use the same keys for this new app. It does not matter.

I have no idea about this exception. It is not supposed to happen and it is not a issue that everybody is facing.

For which platform you are developing? Java ME, RIM or Android?

Support this project:
Donate now!
 
Posted: January 12, 2012 15:24 by konysolution

Hi, I'm developing for Android. But right now I'm testing from a java project. I have written a main method and put the snippet for xauth authentication and running it. It is actually due to the parse exception. I have changed the following ones in "AccountHandler.java" from super.endElement(namespaceURI, localName, qName); to super.endElement(namespaceURI, qName, qName); and it is working fine now.

I think this might be because of JDK version issues. What is the version of JDK should I use for this?

I'm using JDK 1.6.21 Android API 3.0

 
Posted: January 12, 2012 18:56 by Ernandes Mourao Junior
Hummm.. I have seen this issue before, running on Java SDK. Actually, I did not go further to check up on it. But it happens only when you run on a regular Java app. You will not face this issue running on any emulator/simulator.

Support this project:
Donate now!
 
Posted: February 02, 2012 14:17 by konysolution
Hi,
Is the api supported in Android 1.6 version? I am able to integrate the api into our app but the app is not installing on devices with Android OS 1.6. If we remove the twitter integration then the app is installing.
showing 1 - 14 of 14
Replies: 13 - Last Post: February 02, 2012 14:17
by: konysolution
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close