Java 类io.realm.exceptions.RealmError 实例源码

项目:Android-Client    文件:KwalaApplication.java   
@Override
public void onCreate() {
    super.onCreate();
    application = this;

    Nammu.init(this);

    /*
     * Configure Realm
     */
    Realm.init(this);
    RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
            .deleteRealmIfMigrationNeeded()
            .build();

    Realm.setDefaultConfiguration(realmConfiguration);

    try {
        DataStore.getInstance();
    } catch (RealmError e) {
        Log.e(TAG, "Error configuring realm, deleting and trying again.", e);

        Realm.deleteRealm(realmConfiguration);
        DataStore.getInstance();
    }
}
项目:GitHub    文件:OsSharedRealmTests.java   
@Test
public void renameTable_tableNotExist() {
    sharedRealm.beginTransaction();
    assertFalse(sharedRealm.hasTable("TableToRemove"));
    thrown.expect(RealmError.class);
    sharedRealm.renameTable("TableToRemove", "newName");
    sharedRealm.cancelTransaction();
}