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
Highlighted
Developer
Posts: 26
Registered: ‎02-02-2010
My Device: 9630
My Carrier: Verizon

CodeModuleManager ControlledAccessException

Hi. I'm trying to protect a company necessary cod module on BlackBerry devices. It is essential for compliance issues. Unfortunately the company isn't running a BES server. I have tried having 1 app install another so I could set the CodeModuleGroup flags AND have tried having a module set the flags on its own group. 

 

* I am signing the applicaiton

* I am installing on real devices

* I am installing OTA via downloading the COD

* I have tried installing OTA from the JAD

 

I have verified I am accessing the correct CodeModuleGroup.

 

THIS line throws the ControlledAccessException:

 

group.setFlag(CodeModuleGroup.FLAG_HIDDEN,my true);

 

 myCodeModuleGroup.setFlag(CodeModuleGroup.FLAG_HIDDEN, true);

 

I have also tried setting FLAG_REQUIRED.

 

I know of some spyware that successfully does this but I have never had access to the source.

 

Thanks,

Rick

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: CodeModuleManager ControlledAccessException

[ Edited ]

What's the full stack trace?

 

I hope you're aware that without a proper IT Policy you still can't prevent the deletion/modification of this module by the user or spyware. The user can always delete the module via the module list screen. As to spyware, it has full access to the CodeModuleManager API where it doesn't really matter whether a code module group is marked as hidden or not...

Developer
Posts: 26
Registered: ‎02-02-2010
My Device: 9630
My Carrier: Verizon

Re: CodeModuleManager ControlledAccessException

Full stack trace? ONE line - calling setFlag causes the controlled access exception. The trace is that one line. It doesn't matter if this is happening during an install of a new code module group OR an application trying to modify its own CodeModuleGroup.

 

The devices are not being managed by a BES - no IT policies are in effect.

 

I'm looking for someone to weigh in on the actual use of HIDDEN AND REQUIRED. These flags exist and the method exists. The application is code signed PER the docs. Why is an exception being thrown on a NON BES BlackBerry (no IT policies), on my OWN application, that is code signed per the docs? My expectation is this is a bug in the OS or the documentation is incorrect in the usage.

 

Rick

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: CodeModuleManager ControlledAccessException

Well, your "one line" invokes a method from BlackBerry API, which invokes another method and so forth. Somewhere deep inside there's an exception thrown. The stack trace might give you more idea why the exception is thrown.

Developer
Posts: 26
Registered: ‎02-02-2010
My Device: 9630
My Carrier: Verizon

Re: CodeModuleManager ControlledAccessException

Debug log from device:

 

 

ensureHidden::net.rim.device.api.system.ControlledAccessException
No stack trace

 

ensureHidden::net.rim.device.api.system.ControlledAccessException

No stack trace

 

ex.printStackTrace() results in "No stack trace"....

 

Rick

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: CodeModuleManager ControlledAccessException

[ Edited ]

Wrap your code into try {} catch (Throwable ...) {}. The OS will automatically log the full stack trace into the Event Log when an exception propagates into a catch(Throwable) clause. Also, the Debugger will (by default) automatically break on such exception.

Contributor
Posts: 17
Registered: ‎08-02-2010
My Device: 8900

Re: CodeModuleManager ControlledAccessException

Hello,now I have the same question.I have not made that success. Have you made it?

If you can help me,please email xingzheng756@163.com. thx

 

Tinus.