Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PENDING] Updates necessitated by changed core Group API #324

Merged
merged 1 commit into from Aug 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion realm_jni/src/io_realm_Group.cpp
Expand Up @@ -137,7 +137,7 @@ JNIEXPORT jlong JNICALL Java_io_realm_Group_nativeGetTableNativePtr(
{
try {
JStringAccessor tableName(env, name); // throws
Table* pTable = LangBindHelper::get_table_ptr(G(nativeGroupPtr), tableName);
Table* pTable = LangBindHelper::get_or_add_table(*G(nativeGroupPtr), tableName);
return (jlong)pTable;
} CATCH_STD()
return 0;
Expand Down
4 changes: 2 additions & 2 deletions realm_jni/src/io_realm_table.cpp
Expand Up @@ -508,7 +508,7 @@ JNIEXPORT jlong JNICALL Java_io_realm_Table_nativeGetLinkTarget
{
try {
Table* pTable = &(*TBL(nativeTablePtr)->get_link_target( S(columnIndex) ));
LangBindHelper::bind_table_ref(pTable);
LangBindHelper::bind_table_ptr(pTable);
return (jlong)pTable;
} CATCH_STD()
return 0;
Expand Down Expand Up @@ -1296,7 +1296,7 @@ JNIEXPORT void JNICALL Java_io_realm_Table_nativeClose(
JNIEnv* env, jclass, jlong nativeTablePtr)
{
TR((env, "nativeClose(nativeTablePtr: %x)\n", nativeTablePtr));
LangBindHelper::unbind_table_ref(TBL(nativeTablePtr));
LangBindHelper::unbind_table_ptr(TBL(nativeTablePtr));
}

JNIEXPORT jlong JNICALL Java_io_realm_Table_createNative(JNIEnv* env, jobject jTable)
Expand Down
19 changes: 11 additions & 8 deletions realm_jni/src/util.hpp
Expand Up @@ -34,22 +34,25 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved);
#define CATCH_FILE(fileName) \
catch (InvalidDatabase&) { \
ThrowException(env, IllegalArgument, "Invalid Group file format."); \
} catch (util::File::PermissionDenied& e) { \
} \
catch (util::File::PermissionDenied& e) { \
ThrowException(env, IOFailed, fileName, string("Permission denied. ") + e.what()); \
} catch (util::File::NotFound&) { \
} \
catch (util::File::NotFound&) { \
ThrowException(env, FileNotFound, fileName); \
} catch (util::File::AccessError& e) { \
} \
catch (util::File::AccessError& e) { \
ThrowException(env, FileAccessError, string(fileName), e.what()); \
}

#define CATCH_STD() \
catch (ResourceAllocError& e) { \
ThrowException(env, OutOfMemory, "Resource allocation error.", e.what()); \
} catch (std::bad_alloc& e) { \
catch (std::bad_alloc& e) { \
ThrowException(env, OutOfMemory, e.what()); \
} catch (std::exception& e) { \
} \
catch (std::exception& e) { \
ThrowException(env, Unspecified, e.what()); \
} catch (...) { \
} \
catch (...) { \
TIGHTDB_ASSERT(false); \
ThrowException(env, RuntimeError, "Unknown Exception"); \
}
Expand Down