01-30-2013 03:30 PM
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?
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();
}
}
}
01-30-2013 04:40 PM
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.
01-30-2013 06:01 PM
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?
01-30-2013 09:00 PM
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?
01-31-2013 08:51 AM
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.
01-31-2013 02:06 PM
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?