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: 111
Registered: ‎12-16-2008
My Device: Not Specified

Contact bug on certain OS versions

I've found what appears to be a bug on certain OS versions. I'll outline the steps to reproduce and hope someone can shed some light on the issue. Please help!

 

This bug was found on these OS versions:

 

Devices:

8320, 4.5.0.93

4.5.0.135
4.5.0.131

4.5.0.138
4.5.0.55

Don't know the model # for the last 4. Data is from customers.


Simulators:

8300, OS 4.5.0.44

9000, OS 4.6.0.92

 

No problem was found with these OS versions:

 
Devices:

8820, OS 4.2.2.193
8900, OS 4.6.1.231
8130, OS 4.3.0.97
9000, OS 4.6.0.167

Simulators:

8120, OS 4.3.0.59
8900, OS 4.6.1.92
8800, OS 4.2.1.89

 

Steps to reproduce:

 

Create a test contact in the Address Book with only the following information:

 

First: Frank

Last: Smith

Work: 1112223333

 

Be sure there is only one "Frank" in the address book. Now execute the following code:

 

BlackBerryContactList contactList = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);

 

Enumeration e = contactList.itemsByName("frank");


for (int j=0; e.hasMoreElements() ; ++j) {

    Contact c = (Contact)e.nextElement();

    int n = c.countValues(Contact.TEL);  // returns 2 on red OS versions, 1 on green OSes

    for (int i=0; i<n; ++i) {
        String s = c.getString(Contact.TEL, i);  // returns "1112223333" for both index 0 and 1

    }

    for (int i=0; i<n; ++i)

        c.removeValue(Contact.TEL, 0);   // throws IndexOutOfBounds exception when j == 1

 

    break;

}

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Contact bug on certain OS versions

this bug was confirmed by MSohm in another thread, i don't seem able to find it right now.
it seems only to affect certain build ranges of the 4.5 and 4.6 OS.

putting an extra try/catch does not hurt and provides a workaround. good to have a post with the correct tags etc around.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Developer
Posts: 111
Registered: ‎12-16-2008
My Device: Not Specified

Re: Contact bug on certain OS versions

Thanks Simon. I feel much better knowing someone else has confirmed this. I think I can come up with a work-around by catching the exception.