Implement a few of the easy JNI functions.

ExceptionCheck was the next thing we need; the others are just targets of
opportunity.

Change-Id: I1c9e50fd5b5702b6f2afc8b4a31231af2a871b66
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index f77e4d0..55a9d71 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -25,7 +25,7 @@
 class ScopedJniThreadState {
  public:
   explicit ScopedJniThreadState(JNIEnv* env) {
-    self_ = threadForEnv(env);
+    self_ = ThreadForEnv(env);
     self_->SetState(Thread::kRunnable);
   }
 
@@ -33,11 +33,12 @@
     self_->SetState(Thread::kNative);
   }
 
-  Thread* self() {
+  Thread* Self() {
     return self_;
   }
 
-  static Thread* threadForEnv(JNIEnv* env) {
+ private:
+  static Thread* ThreadForEnv(JNIEnv* env) {
     // TODO: need replacement for gDvmJni.
     bool workAroundAppJniBugs = true;
     Thread* env_self = reinterpret_cast<JNIEnvExt*>(env)->self;
@@ -50,7 +51,6 @@
     return self;
   }
 
- private:
   Thread* self_;
   DISALLOW_COPY_AND_ASSIGN(ScopedJniThreadState);
 };
@@ -60,10 +60,9 @@
   return JNI_VERSION_1_6;
 }
 
-jclass DefineClass(JNIEnv *env, const char *name,
-    jobject loader, const jbyte *buf, jsize len) {
+jclass DefineClass(JNIEnv* env, const char*, jobject, const jbyte*, jsize) {
   ScopedJniThreadState ts(env);
-  UNIMPLEMENTED(FATAL);
+  LOG(WARNING) << "JNI DefineClass is not supported";
   return NULL;
 }
 
@@ -164,12 +163,12 @@
 
 void ExceptionClear(JNIEnv* env) {
   ScopedJniThreadState ts(env);
-  UNIMPLEMENTED(FATAL);
+  ts.Self()->ClearException();
 }
 
 void FatalError(JNIEnv* env, const char* msg) {
   ScopedJniThreadState ts(env);
-  UNIMPLEMENTED(FATAL);
+  LOG(FATAL) << "JNI FatalError called: " << msg;
 }
 
 jint PushLocalFrame(JNIEnv* env, jint cap) {
@@ -1437,7 +1436,7 @@
   return 0;
 }
 
-jint GetJavaVM(JNIEnv* env, JavaVM* *vm) {
+jint GetJavaVM(JNIEnv* env, JavaVM** vm) {
   ScopedJniThreadState ts(env);
   UNIMPLEMENTED(FATAL);
   return 0;
@@ -1492,8 +1491,7 @@
 
 jboolean ExceptionCheck(JNIEnv* env) {
   ScopedJniThreadState ts(env);
-  UNIMPLEMENTED(FATAL);
-  return JNI_FALSE;
+  return ts.Self()->IsExceptionPending() ? JNI_TRUE : JNI_FALSE;
 }
 
 jobject NewDirectByteBuffer(JNIEnv* env, void* address, jlong capacity) {
@@ -1860,7 +1858,7 @@
   }
 }
 
-jint JniInvokeInterface::GetEnv(JavaVM *vm, void **env, jint version) {
+jint JniInvokeInterface::GetEnv(JavaVM* vm, void** env, jint version) {
   if (version < JNI_VERSION_1_1 || version > JNI_VERSION_1_6) {
     return JNI_EVERSION;
   }
diff --git a/src/thread.h b/src/thread.h
index a6e137f..23272f1 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -135,7 +135,7 @@
   }
 
   bool IsExceptionPending() const {
-    return false;  // TODO exception_ != NULL;
+    return exception_ != NULL;
   }
 
   Object* GetException() const {