Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in importing contacts #44

Open
pouraghajanOldAcc opened this issue Dec 4, 2015 · 2 comments
Open

Problem in importing contacts #44

pouraghajanOldAcc opened this issue Dec 4, 2015 · 2 comments

Comments

@pouraghajanOldAcc
Copy link

I'm using below code to import a contact in my Telegram account.
Strange thing is the doRpcCall method runs without error (I suppose it means that the import has been taken place successfully), but in the next line of the code I'm getting IndexOutOfBound exception, which indicates that the successful imported contacts Vector is empty.

TLInputContact tlic = new TLInputContact(10, PhNo, Fname, Lname);
TLVector contacts = new TLVector<>();
contacts.add(tlic);
TLRequestContactsImportContacts importContacts = new TLRequestContactsImportContacts(contacts, true);
TLImportedContacts importedContacts = api.doRpcCall(importContacts);
System.out.println("Contact imported with ID:"+importedContacts.getUsers().get(0).getId());
TLAbsUser recipient=importedContacts.getUsers().get(0);
TLInputPeerContact peer = new TLInputPeerContact(recipient.getId());
TLRequestMessagesSendMessage sendMessageRequest = new TLRequestMessagesSendMessage(peer, "Test", rnd.nextInt());
TLAbsSentMessage sentMessage = api.doRpcCall(sendMessageRequest);

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.telegram.tl.TLVector.get(TLVector.java:158)
at org.telegram.bot.Application.importContacts(Application.java:58)
at org.telegram.bot.Application.main(Application.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

@gioyell
Copy link

gioyell commented Mar 16, 2016

I've got the same issue.. Did you managed to import contacts ?

@taxmaniac
Copy link

Hello, I have the same case when add a certain contact. In the others cases works well.
Do you have a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants