Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

IndexOutOfBounds: ContactImpl.getStringArray() in 4.5.0/4.6.0

[ Edited ]

When I call Contact.getStringArray() requesting Contact.NAME, I receive an IndexOutOfBoundsException.
I even call isSupportedField( Contact.NAME ), and it returns true.
I get this when running on several 4.6.0 beta devices, and also on a 4.5.0 8100 device.
I am compiling for 4.3.0 to run on 4.5.0 and 4.6.0.

The same function call works when compiling for 4.2.1 and running on a 4.2.2 8300, and when compiling for 4.3.0 and running on the 4.3.0 8130-verizon simulator.

The call I make is:

String[] nameArray = contact.getStringArray( Contact.NAME, Contact.ATTR_NONE );

This is the stack trace I get:

Name: IndexOutOfBoundsException
GUID: 9c3cd62e3320b498
Time: Jul 26, 2008 17:19:07
No detail message
net_rim_pdap
 ContactImpl
 getStringArray
 0x137E
vcard_bb-4
 Utility
 displayName
 0xCD64
vcard_bb-2
 ExportAction
 onRun
 0x254
vcard_bb-1
 SDCardAction
 run
 0x6F
vcard_bb-7
 Timers$1
 run
 0xA0A8
net_rim_cldc-1
 TimerThread
 <private>
 0xBE21
net_rim_cldc-1
 TimerThread
 run
 0xBD1B

Is this a known problem, or am I just doing something wrong?
Thanks!

 

Message Edited by mreed on 08-01-2008 08:54 AM
Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: IndexOutOfBounds: ContactImpl.getStringArray() in 4.5.0/4.6.0

Update: Apparently this only happens on certain contacts, not all of them.
Developer
Posts: 21
Registered: ‎07-16-2008
My Device: Not Specified

Re: IndexOutOfBounds: ContactImpl.getStringArray() in 4.5.0/4.6.0

This may be something really obvious, but I know I've gotten this exception before when trying to call that method when the contact has no name.  So, do you check first if the contact has a name before calling the .getStringArray method?
Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: IndexOutOfBounds: ContactImpl.getStringArray() in 4.5.0/4.6.0

[ Edited ]

That is most likely it. I didn't call countValues() before I requested the array. Apparently there were some contacts with just a company name. In 4.2.2 it returns an empty array, but 4.5.0/4.6.0 throws an exception.

Message Edited by mreed on 08-01-2008 09:24 AM