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
LSphone
Posts: 140
Registered: ‎02-08-2010
My Device: Torch 9800, Storm 9530, Curve 8330
My Carrier: AT&T, Verizon
Accepted Solution

addMenuItem( ApplicationMenuItem ) throws java.lang.Error

[ Edited ]

 

ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM, applicationmenuitem)

 

This pops up an error:  "Uncaught exception: Java.lang.Error"

 

The exception cannot be caught, and does not appear in the debugger, only on the phone.  It occurs after addMenuItem calls toString in the ApplicationMenuItem, but the string is fine -- a literal.

 

Call stack is several levels deep into unknown methods.

 

 

Works fine in simulators and on the Storm, but not on an 8330 running 4.5 .

 

Please use plain text.
Developer
LSphone
Posts: 140
Registered: ‎02-08-2010
My Device: Torch 9800, Storm 9530, Curve 8330
My Carrier: AT&T, Verizon

Re: addMenuItem( ApplicationMenuItem ) throws java.lang.Error

Solved.  For some reason you need PIM / Organizer permission to add system-wide menu items.  I had the module set with this permission, but the CodeModuleGroup didn't have it.

 

They sure made it hard to debug this one -- it didn't throw a ControlledAccessException as it was supposed to.  Instead, it threw something that can't even be caught, which means that if the users don't have the permissions set right, the app bombs with an error that could be anything.

 

Am checking for permissions in advance and prompting if necessary, but in the past have still had permissions-related support requests despite that, so it doesn't always work.

 

 

Please use plain text.