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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jni/] [throwit.c] - Blame information for rev 775

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

Line No. Rev Author Line
1 765 jeremybenn
#include <stdlib.h>
2
#include <throwit.h>
3
 
4
JNIEXPORT void JNICALL
5
Java_throwit_throwit (JNIEnv *env, jclass klass, jstring name,
6
                      jboolean is_new)
7
{
8
  const char *buf = (*env)->GetStringUTFChars (env, name, NULL);
9
  jclass k = (*env)->FindClass (env, buf);
10
  (*env)->ReleaseStringUTFChars (env, name, buf);
11
 
12
  if (k == NULL || (*env)->ExceptionCheck (env))
13
    return;
14
 
15
  if (is_new)
16
    (*env)->ThrowNew (env, k, "the word is zardoz");
17
  else
18
    {
19
      jmethodID id = (*env)->GetMethodID (env, k, "<init>",
20
                                          "(Ljava.lang.String;)V");
21
      jstring z = (*env)->NewStringUTF (env, "zardoz is the word");
22
      jobject obj = (*env)->NewObject (env, k, id, z);
23
      (*env)->Throw (env, obj);
24
    }
25
}

powered by: WebSVN 2.1.0

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