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
Contributor
azoc
Posts: 35
Registered: ‎09-15-2011
My Device: Torch 9800, Tour 9630
My Carrier: VZW

ControlledAccessException when saving to persistent store on BES

Our customer is getting a ControlledAccessException when our app tries to save data to the persistent store. All app permissions are set to Allow. The device is corporate-managed via BES -- we are waiting to hear back on what IT policies are in effect and if writing to the persistent store is allowed. We are able to run the apps in house with no problem.

 

Here is the full error they are getting:

 

S Java Exceptions - ControlledAccessException - 1/30 11:35:49
| No detail message
| net_rim_cldc(4F5BEA10)
|  ControlledAccess
|  assertSignature
|  0x3AE4
| net_rim_cldc(4F5BEA10)
|  ControlledAccess
|  assertReplacePermission
|  0x3A30
| net_rim_cldc(4F5BEA10)
|  PersistentObject
|  setContents
|  0xAB03
| net_rim_cldc(4F5BEA10)
|  PersistentObject
|  setContents
|  0xA997
| my_app_library(
510830AC)
|  MyUserPreferences
|  commit
|  0x2602
| my_app_name(510830AE)
|  SplashScreen$2
|  run
|  0x2CF0

 

Could a restrictive IT policy cause this error, or is something else at work?

 

 
Here are the contents of the MyUserPreferences wrapper class we use to save data to the persistent store, which is within the my_app_library cod (the appGuid field is set correctly on launch):
 
package com.company.util;

import java.util.Hashtable;
import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;

public class MyUserPreferences
{
    public static long appGuid;
    private static IFUserPreferences preferences = new MyUserPreferences();
    private PersistentObject store;
    private Hashtable preferenceTable;

    private IFUserPreferences()
    {
        try
        {
            store = PersistentStore.getPersistentObject(appGuid);
            Hashtable temp = (Hashtable)store.getContents();
            if( temp == null )
            {
                // First run. Set defaults here.
                preferenceTable = new Hashtable();
                setItem("rememberMe", new Boolean(true));
            }
            else
            {
                preferenceTable = temp;
            }
        }
        catch( Exception e )
        {
            preferenceTable = new Hashtable();
            setItem("rememberMe", new Boolean(true));
        }
    }
    
    public static IFUserPreferences getPreferences()
    {
        return preferences;
    }
    
    public void setItem(String itemName, Object itemValue) {
        preferenceTable.put(itemName, itemValue);
    }
    
    public Hashtable getItems() {
        return preferenceTable;
    }

    public Object getItem(String itemName) {
        return preferenceTable.get(itemName);
    }
    
    public void clear()
    {
        preferenceTable.clear();
    }
    
    public void removeItem(String itemName) {
        preferenceTable.remove(itemName);
    }
    
    public void commit() {
        if( store == null ) return;
        synchronized (store) {
            store.setContents(preferenceTable);
            store.commit();
        }
    }
}

 

 
Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: ControlledAccessException when saving to persistent store on BES

In my experience, if the corporate policy is not allowing persistent store, then the Interactions Cross Application Communication permissions will be set to deny.- check this.

 

I have also seen this specific error occur in corporate devices, and the problem is fixed after a cold (battery out) restart. 

Please use plain text.
Contributor
azoc
Posts: 35
Registered: ‎09-15-2011
My Device: Torch 9800, Tour 9630
My Carrier: VZW

Re: ControlledAccessException when saving to persistent store on BES

Thanks for your response Peter.

 

I set the Interactions - Cross Application Communication permission to Deny on my device and the app still ran fine.

 

We'll ask them to try a battery out restart.

 

Any other clues as to what it might be if the restart proves unsuccessful?

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: ControlledAccessException when saving to persistent store on BES

Interesting, I just tried with Deny, and I get a different error, along similar lines, when the app tries to put something in persistent store.  Can I get you to confirm your test?  Did you reboot after you set the Deny?

 

Can you tell us the OS levels involved?

Please use plain text.
Contributor
azoc
Posts: 35
Registered: ‎09-15-2011
My Device: Torch 9800, Tour 9630
My Carrier: VZW

Re: ControlledAccessException when saving to persistent store on BES

Yes, I rebooted after changing the permissions. I even set all Interactions and User Data permissions to Deny, for both the app and its library module, and the app still opens. I have tested on a 9630 / OS 5, 9800 / OS 6, and 9900 Simuator / OS 7.1.

 

The customer is having the problem on a 9900 / OS 7.1.

Please use plain text.
Contributor
azoc
Posts: 35
Registered: ‎09-15-2011
My Device: Torch 9800, Tour 9630
My Carrier: VZW

Re: ControlledAccessException when saving to persistent store on BES

The customer reports that a battery out reset does not resolve the issue.

 

We have been trying to simulate IT policies on our end that might reproduce the error, including:
- Disable Persisted Plain Text IT policy rule set to True
- Allow Third Party Apps to Use Persistent Store IT policy rule set to False

 

But neither produced the error for us.

 

Any other ideas /  policies we might try to simulate?

Please use plain text.
Contributor
bryanwang
Posts: 22
Registered: ‎03-01-2010
My Device: Z10
My Carrier: Bell Canada

Re: ControlledAccessException when saving to persistent store on BES

We are seeing this as well on a couple of our BES managed customer as well. Somehow it went away after a day. Their disable plain text is set to off and IPC is set tot allowed... very strange. I am trying to reproduce this with different IT policy and content protection settings. I think for the disable plain text to take effect the Content Protection (device encryption) must be turned on, maybe give that a try.

Please use plain text.