Changed j*ID family of methods to panic on failure.
These methods return null to go and throw an No*FoundException in java, but the exception wasn't visible because the program crashed in a funny way. With the panics added, the expected behavior occurs.
Change-Id: I6b9e9ccb85af366a00fbeb6c70ccc0ed5d459c95
diff --git a/runtimes/google/security/jni/caveat.go b/runtimes/google/security/jni/caveat.go
index e3901dc..b09885a 100644
--- a/runtimes/google/security/jni/caveat.go
+++ b/runtimes/google/security/jni/caveat.go
@@ -58,10 +58,10 @@
C.AttachCurrentThread(c.jVM, &env, nil)
defer C.DetachCurrentThread(c.jVM)
util.GoRef(&context) // un-refed when the Java Context object is finalized.
- cid := C.jmethodID(util.JMethodIDPtr(env, jContextImplClass, "<init>", fmt.Sprintf("(%s)%s", util.LongSign, util.VoidSign)))
+ cid := C.jmethodID(util.JMethodIDPtrOrDie(env, jContextImplClass, "<init>", fmt.Sprintf("(%s)%s", util.LongSign, util.VoidSign)))
jContext := C.CallCaveatNewContextObject(env, jContextClass, cid, C.jlong(util.PtrValue(&context)))
contextSign := "Lcom/veyron2/security/Context;"
- mid := C.jmethodID(util.JMethodIDPtr(env, C.GetObjectClass(env, c.jCaveat), "validate", fmt.Sprintf("(%s)%s", contextSign, util.VoidSign)))
+ mid := C.jmethodID(util.JMethodIDPtrOrDie(env, C.GetObjectClass(env, c.jCaveat), "validate", fmt.Sprintf("(%s)%s", contextSign, util.VoidSign)))
C.CallCaveatValidateMethod(env, c.jCaveat, mid, jContext)
return util.JExceptionMsg(env)
}