OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jni/] [throwit.c] - Rev 790

Go to most recent revision | Compare with Previous | Blame | View Log

#include <stdlib.h>
#include <throwit.h>
 
JNIEXPORT void JNICALL
Java_throwit_throwit (JNIEnv *env, jclass klass, jstring name,
		      jboolean is_new)
{
  const char *buf = (*env)->GetStringUTFChars (env, name, NULL);
  jclass k = (*env)->FindClass (env, buf);
  (*env)->ReleaseStringUTFChars (env, name, buf);
 
  if (k == NULL || (*env)->ExceptionCheck (env))
    return;
 
  if (is_new)
    (*env)->ThrowNew (env, k, "the word is zardoz");
  else
    {
      jmethodID id = (*env)->GetMethodID (env, k, "<init>",
					  "(Ljava.lang.String;)V");
      jstring z = (*env)->NewStringUTF (env, "zardoz is the word");
      jobject obj = (*env)->NewObject (env, k, id, z);
      (*env)->Throw (env, obj);
    }
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.