本文整理汇总了C++中JNU_ThrowInternalError函数的典型用法代码示例。如果您正苦于以下问题:C++ JNU_ThrowInternalError函数的具体用法?C++ JNU_ThrowInternalError怎么用?C++ JNU_ThrowInternalError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JNU_ThrowInternalError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JNU_ThrowInternalError
/*
* Class: sun_awt_shell_Win32ShellFolder2
* Method: initSpecial
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_sun_awt_shell_Win32ShellFolder2_initSpecial
(JNIEnv* env, jobject folder, jlong desktopIShellFolder, jint folderType)
{
// Get desktop IShellFolder interface
IShellFolder* pDesktop = (IShellFolder*)desktopIShellFolder;
if (pDesktop == NULL) {
JNU_ThrowInternalError(env, "Desktop shell folder missing");
return;
}
// Get special folder relative PIDL
LPITEMIDLIST relPIDL;
HRESULT res = fn_SHGetSpecialFolderLocation(NULL, folderType,
&relPIDL);
if (res != S_OK) {
JNU_ThrowIOException(env, "Could not get shell folder ID list");
return;
}
// Set field ID for relative PIDL
env->CallVoidMethod(folder, MID_relativePIDL, (jlong)relPIDL);
// Get special folder IShellFolder interface
IShellFolder* pFolder;
res = pDesktop->BindToObject(relPIDL, NULL, IID_IShellFolder,
(void**)&pFolder);
if (res != S_OK) {
JNU_ThrowInternalError(env,
"Could not bind shell folder to interface");
return;
}
// Set field ID for pIShellFolder
env->CallVoidMethod(folder, MID_pIShellFolder, (jlong)pFolder);
}
示例2: get_thread_state_info
static void get_thread_state_info(JNIEnv *env, jint state,
jobjectArray stateValues,
jobjectArray stateNames) {
char errmsg[128];
jintArray values;
jobjectArray names;
values = (*GetThreadStateValues_fp)(env, state);
if (values == NULL) {
sprintf(errmsg, "Mismatched VM version: Thread state (%d) "
"not supported", state);
JNU_ThrowInternalError(env, errmsg);
return;
}
/* state is also used as the index in the array */
(*env)->SetObjectArrayElement(env, stateValues, state, values);
names = (*GetThreadStateNames_fp)(env, state, values);
if (names == NULL) {
sprintf(errmsg, "Mismatched VM version: Thread state (%d) "
"not supported", state);
JNU_ThrowInternalError(env, errmsg);
return;
}
(*env)->SetObjectArrayElement(env, stateNames, state, names);
}
示例3: putGV
int putGV(JNIEnv* env, jint gmask, jint baseIndex, jobject gvdata, const LayoutEngine* engine, int glyphCount) {
int count = env->GetIntField(gvdata, gvdCountFID);
jarray glyphArray = (jarray)env->GetObjectField(gvdata, gvdGlyphsFID);
if (IS_NULL(glyphArray)) {
JNU_ThrowInternalError(env, "glypharray null");
return 0;
}
jint capacity = env->GetArrayLength(glyphArray);
if (count + glyphCount > capacity) {
JNU_ThrowArrayIndexOutOfBoundsException(env, "");
return 0;
}
jarray posArray = (jarray)env->GetObjectField(gvdata, gvdPositionsFID);
if (IS_NULL(glyphArray)) {
JNU_ThrowInternalError(env, "positions array null");
return 0;
}
jarray inxArray = (jarray)env->GetObjectField(gvdata, gvdIndicesFID);
if (IS_NULL(inxArray)) {
JNU_ThrowInternalError(env, "indices array null");
return 0;
}
int countDelta = 0;
// le_uint32 is the same size as jint... forever, we hope
le_uint32* glyphs = (le_uint32*)env->GetPrimitiveArrayCritical(glyphArray, NULL);
if (glyphs) {
jfloat* positions = (jfloat*)env->GetPrimitiveArrayCritical(posArray, NULL);
if (positions) {
jint* indices = (jint*)env->GetPrimitiveArrayCritical(inxArray, NULL);
if (indices) {
LEErrorCode status = (LEErrorCode)0;
engine->getGlyphs(glyphs + count, gmask, status);
engine->getGlyphPositions(positions + (count * 2), status);
engine->getCharIndices((le_int32*)(indices + count), baseIndex, status);
countDelta = glyphCount;
// !!! need engine->getFlags to signal positions, indices data
/* "0" arg used instead of JNI_COMMIT as we want the carray
* to be freed by any VM that actually passes us a copy.
*/
env->ReleasePrimitiveArrayCritical(inxArray, indices, 0);
}
env->ReleasePrimitiveArrayCritical(posArray, positions, 0);
}
env->ReleasePrimitiveArrayCritical(glyphArray, glyphs, 0);
}
if (countDelta) {
count += countDelta;
env->SetIntField(gvdata, gvdCountFID, count);
}
return 1;
}
示例4: Java_java_util_zip_Inflater_init
JNIEXPORT jlong JNICALL
Java_java_util_zip_Inflater_init(JNIEnv *env, jclass cls, jboolean nowrap)
{
z_stream *strm = calloc(1, sizeof(z_stream));
if (strm == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
return jlong_zero;
} else {
const char *msg;
int ret = inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS);
switch (ret) {
case Z_OK:
return ptr_to_jlong(strm);
case Z_MEM_ERROR:
free(strm);
JNU_ThrowOutOfMemoryError(env, 0);
return jlong_zero;
default:
msg = ((strm->msg != NULL) ? strm->msg :
(ret == Z_VERSION_ERROR) ?
"zlib returned Z_VERSION_ERROR: "
"compile time and runtime zlib implementations differ" :
(ret == Z_STREAM_ERROR) ?
"inflateInit2 returned Z_STREAM_ERROR" :
"unknown error initializing zlib library");
free(strm);
JNU_ThrowInternalError(env, msg);
return jlong_zero;
}
}
}
示例5: OGLSD_GetRasInfo
/**
* This is the implementation of the general GetRasInfoFunc defined in
* SurfaceData.h.
*/
void
OGLSD_GetRasInfo(JNIEnv *env,
SurfaceDataOps *ops,
SurfaceDataRasInfo *pRasInfo)
{
JNU_ThrowInternalError(env, "OGLSD_GetRasInfo not implemented!");
}
示例6: D3DSD_Unlock
/**
* This is the implementation of the general surface UnlockFunc defined in
* SurfaceData.h.
*/
void
D3DSD_Unlock(JNIEnv *env,
SurfaceDataOps *ops,
SurfaceDataRasInfo *pRasInfo)
{
JNU_ThrowInternalError(env, "D3DSD_Unlock not implemented!");
}
示例7: Java_java_util_zip_Deflater_init
JNIEXPORT jlong JNICALL
Java_java_util_zip_Deflater_init(JNIEnv *env, jclass cls, jint level,
jint strategy, jboolean nowrap)
{
z_stream *strm = calloc(1, sizeof(z_stream));
if (strm == 0) {
JNU_ThrowOutOfMemoryError(env, 0);
return jlong_zero;
} else {
char *msg;
switch (deflateInit2(strm, level, Z_DEFLATED,
nowrap ? -MAX_WBITS : MAX_WBITS,
DEF_MEM_LEVEL, strategy)) {
case Z_OK:
return ptr_to_jlong(strm);
case Z_MEM_ERROR:
free(strm);
JNU_ThrowOutOfMemoryError(env, 0);
return jlong_zero;
case Z_STREAM_ERROR:
free(strm);
JNU_ThrowIllegalArgumentException(env, 0);
return jlong_zero;
default:
msg = strm->msg;
free(strm);
JNU_ThrowInternalError(env, msg);
return jlong_zero;
}
}
}
示例8: Java_sun_nio_ch_InheritedChannel_open0
JNIEXPORT jint JNICALL
Java_sun_nio_ch_InheritedChannel_open0(JNIEnv *env, jclass cla, jstring path, jint oflag)
{
const char* str;
int oflag_actual;
/* convert to OS specific value */
switch (oflag) {
case sun_nio_ch_InheritedChannel_O_RDWR :
oflag_actual = O_RDWR;
break;
case sun_nio_ch_InheritedChannel_O_RDONLY :
oflag_actual = O_RDONLY;
break;
case sun_nio_ch_InheritedChannel_O_WRONLY :
oflag_actual = O_WRONLY;
break;
default :
JNU_ThrowInternalError(env, "Unrecognized file mode");
return -1;
}
str = JNU_GetStringPlatformChars(env, path, NULL);
if (str == NULL) {
return (jint)-1;
} else {
int fd = open(str, oflag_actual);
if (fd < 0) {
JNU_ThrowIOExceptionWithLastError(env, str);
}
JNU_ReleaseStringPlatformChars(env, path, str);
return (jint)fd;
}
}
示例9: JNU_ThrowInternalError
JNIEXPORT jobject JNICALL Java_sun_management_MemoryManagerImpl_getMemoryPools0
(JNIEnv *env, jobject mgr) {
jobject pools = jmm_interface->GetMemoryPools(env, mgr);
if (pools == NULL) {
JNU_ThrowInternalError(env, "Memory Manager not found");
}
return pools;
}
示例10: D3DSD_Lock
/**
* This is the implementation of the general surface LockFunc defined in
* SurfaceData.h.
*/
jint
D3DSD_Lock(JNIEnv *env,
SurfaceDataOps *ops,
SurfaceDataRasInfo *pRasInfo,
jint lockflags)
{
JNU_ThrowInternalError(env, "D3DSD_Lock not implemented!");
return SD_FAILURE;
}
示例11: Java_sun_misc_VM_getThreadStateValues
JNIEXPORT void JNICALL
Java_sun_misc_VM_getThreadStateValues(JNIEnv *env, jclass cls,
jobjectArray values,
jobjectArray names)
{
char errmsg[128];
// check if the number of Thread.State enum constants
// matches the number of states defined in jvm.h
jsize len1 = (*env)->GetArrayLength(env, values);
jsize len2 = (*env)->GetArrayLength(env, names);
if (len1 != JAVA_THREAD_STATE_COUNT || len2 != JAVA_THREAD_STATE_COUNT) {
sprintf(errmsg, "Mismatched VM version: JAVA_THREAD_STATE_COUNT = %d "
" but JDK expects %d / %d",
JAVA_THREAD_STATE_COUNT, len1, len2);
JNU_ThrowInternalError(env, errmsg);
return;
}
if (GetThreadStateValues_fp == NULL) {
GetThreadStateValues_fp = (GET_THREAD_STATE_VALUES_FN)
JDK_FindJvmEntry("JVM_GetThreadStateValues");
if (GetThreadStateValues_fp == NULL) {
JNU_ThrowInternalError(env,
"Mismatched VM version: JVM_GetThreadStateValues not found");
return;
}
GetThreadStateNames_fp = (GET_THREAD_STATE_NAMES_FN)
JDK_FindJvmEntry("JVM_GetThreadStateNames");
if (GetThreadStateNames_fp == NULL) {
JNU_ThrowInternalError(env,
"Mismatched VM version: JVM_GetThreadStateNames not found");
return ;
}
}
get_thread_state_info(env, JAVA_THREAD_STATE_NEW, values, names);
get_thread_state_info(env, JAVA_THREAD_STATE_RUNNABLE, values, names);
get_thread_state_info(env, JAVA_THREAD_STATE_BLOCKED, values, names);
get_thread_state_info(env, JAVA_THREAD_STATE_WAITING, values, names);
get_thread_state_info(env, JAVA_THREAD_STATE_TIMED_WAITING, values, names);
get_thread_state_info(env, JAVA_THREAD_STATE_TERMINATED, values, names);
}
示例12: sprintf
/*
* Class: sun_awt_shell_Win32ShellFolderManager2
* Method: initializeCom
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_awt_shell_Win32ShellFolderManager2_initializeCom
(JNIEnv* env, jclass cls)
{
HRESULT hr = ::CoInitialize(NULL);
if (FAILED(hr)) {
char c[64];
sprintf(c, "Could not initialize COM: HRESULT=0x%08X", hr);
JNU_ThrowInternalError(env, c);
}
}
示例13: Java_sun_awt_motif_X11RemoteOffScreenImage_initIDs
/*
* Class: sun_awt_X11RemoteOffScreenImage
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_sun_awt_motif_X11RemoteOffScreenImage_initIDs(JNIEnv *env, jclass bisd)
{
static char *bimgName = "java/awt/image/BufferedImage";
jclass bimg = (*env)->FindClass(env, bimgName);
if (JNU_IsNull(env, bimg)) {
JNU_ThrowClassNotFoundException(env, bimgName);
return;
}
sDataID = (*env)->GetFieldID(env, bimg, "sData", "Lsun/java2d/SurfaceData;");
if (sDataID == 0) {
JNU_ThrowInternalError(env, "Could not get field IDs");
}
rasterID = (*env)->GetFieldID(env, bimg, "raster", "Ljava/awt/image/WritableRaster;");
if (rasterID == 0) {
JNU_ThrowInternalError(env, "Could not get field IDs");
}
}
示例14: Java_sun_misc_VMSupport_initAgentProperties
JNIEXPORT jobject JNICALL
Java_sun_misc_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props)
{
char errmsg[128];
if (InitAgentProperties_fp == NULL) {
if (!JDK_InitJvmHandle()) {
JNU_ThrowInternalError(env,
"Handle for JVM not found for symbol lookup");
}
InitAgentProperties_fp = (INIT_AGENT_PROPERTIES_FN)
JDK_FindJvmEntry("JVM_InitAgentProperties");
if (InitAgentProperties_fp == NULL) {
JNU_ThrowInternalError(env,
"Mismatched VM version: JVM_InitAgentProperties not found");
return NULL;
}
}
return (*InitAgentProperties_fp)(env, props);
}
示例15: initFieldIDs
static int
initFieldIDs(JNIEnv *env, jobject process, jobject fd) {
jclass tmpC;
if (field_exitcode != 0) return 0;
tmpC = (*env)->GetObjectClass(env, process);;
field_exitcode = (*env)->GetFieldID(env, tmpC, "exitcode", "I");
if (field_exitcode == 0) {
JNU_ThrowInternalError(env, "Can't find field UNIXProcess.exitcode");
return -1;
}
tmpC = (*env)->GetObjectClass(env, fd);
field_fd = (*env)->GetFieldID(env, tmpC, "fd", "I");
if (field_fd == 0) {
JNU_ThrowInternalError(env, "Can't find field FileDescriptor.fd");
field_exitcode = 0;
return -1;
}
return 0;
}