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: 27
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

ActiveAutoTextEditField "Cut" menu item throws a java.lang.securityexception

I have an application with a login screen which has a ActiveAutoTextEditField for a username (which is an email address).  If an email address is displayed in the field, and the user highlights it and selects the "Cut" menu item a java.lang.securityexception is thrown and the application exits.

 

We are currently testing our application on 3 different devices - 8800, 8310, 8100.  This error occurs on both the 8800 and 8310 devices, but not the 8100.  I cannot replicate this error in any of the simulators on my PC.

 

Does anybody have any suggestions for resolving this issue, or know if I am able to remove the offending "Cut" menu item from the context menu?

Highlighted
Developer
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: ActiveAutoTextEditField "Cut" menu item throws a java.lang.securityexception

Long time ago I got the same problem with Date field on JDE 4.0 with BB 7290 device.

 

Exception occured when I ran Menu-Copy.

 

I implemented the following workaround.

 

 

/** * Invoked when the trackwheel is clicked. * @param status - Modifier key status. * @param time - Ticks since device reset. * @return True if the event was consumed; otherwise, false. */ public boolean trackwheelClick(int status, int time) { try{ Menu menu = new Menu(); makeMenu(menu, 0); menu.show(); } catch(Exception e){ // HACK!!!!! // this try-catch added to prevent SecurityException on device // (on simulator this bug does not appear) // When user tries to do the following // Open menu on date field, and select "Copy" // I do nothing here, I am just catching and ignoring this exception } return true; }

 

 Just catch and ignore this exception in place where you invoke the menu.

 

 

 

 

----------------
if your issue solved set "Solution" mark at the relevant post
Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified

Re: ActiveAutoTextEditField "Cut" menu item throws a java.lang.securityexception

Thanks for this suggestion.  At least now I can stop the app exiting when the user selects "Cut". Cheers :-)