qt-jambi / qtjambi-community

To clone this repository:

git clone git@gitorious.org:qt-jambi/qtjambi-community.git

To push to this repository:

# Add a new remote
git remote add origin git@gitorious.org:qt-jambi/qtjambi-community.git

# Push the master branch to the newly added origin, and configure
# this remote and branch as the default:
git push -u origin master

# From now on you can push master to the "origin" remote with:
git push

Commit: #7efb3f9

Parent: #7fe5ea9

Implement static convenience method to throw RuntimeException

Add static global method qtjambishell_throw_runtimeexception().

Change-Id: I201c467e86072f0b4a502588637be89587510c53

avatar Darryl L. Miles about 2 years ago

676 676 Q_ASSERT(NullPointerException.class_ref);
677 677 }
678 678
679 void StaticCache::resolveRuntimeException_internal()
680 {
681 JNIEnv *env = qtjambi_current_environment();
682
683 Q_ASSERT(!RuntimeException.class_ref);
684
685 RuntimeException.class_ref = ref_class(qtjambi_find_class(env, "java/lang/RuntimeException"));
686 Q_ASSERT(RuntimeException.class_ref);
687 }
688
679 689 void StaticCache::resolveCollection_internal()
680 690 {
681 691 JNIEnv *env = qtjambi_current_environment();
300 300
301 301 struct {
302 302 jclass class_ref;
303 } RuntimeException;
304
305 struct {
306 jclass class_ref;
303 307 } String;
304 308
305 309 struct {
496 496 DECLARE_RESOLVE_FUNCTIONS(Modifier);
497 497 DECLARE_RESOLVE_FUNCTIONS(NativePointer);
498 498 DECLARE_RESOLVE_FUNCTIONS(NullPointerException);
499 DECLARE_RESOLVE_FUNCTIONS(RuntimeException);
499 500 DECLARE_RESOLVE_FUNCTIONS(Object);
500 501 DECLARE_RESOLVE_FUNCTIONS(Pair);
501 502 DECLARE_RESOLVE_FUNCTIONS(QModelIndex);
2554 2554 env->ThrowNew(sc->NullPointerException.class_ref, msg);
2555 2555 }
2556 2556
2557 void qtjambishell_throw_runtimeexception(JNIEnv *env, const char *msg)
2558 {
2559 StaticCache *sc = StaticCache::instance();
2560 sc->resolveRuntimeException();
2561 env->ThrowNew(sc->RuntimeException.class_ref, msg);
2562 }
2563
2557 2564 void qtjambi_debug_trace(const char *location, const char *file, int line)
2558 2565 {
2559 2566 static int should = getenv("QTJAMBI_DEBUG_TRACE") != 0;
240 240
241 241 QTJAMBI_EXPORT void qtjambishell_throw_nullpointerexception(JNIEnv *env, const char *msg);
242 242
243 QTJAMBI_EXPORT void qtjambishell_throw_runtimeexception(JNIEnv *env, const char *msg);
244
243 245 inline void *qtjambi_to_interface(JNIEnv *env,
244 246 jobject java_object,
245 247 const char *interface_name,

Comments