当前位置: 首页>>代码示例>>C++>>正文


C++ JNU_ThrowNullPointerException函数代码示例

本文整理汇总了C++中JNU_ThrowNullPointerException函数的典型用法代码示例。如果您正苦于以下问题:C++ JNU_ThrowNullPointerException函数的具体用法?C++ JNU_ThrowNullPointerException怎么用?C++ JNU_ThrowNullPointerException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了JNU_ThrowNullPointerException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Java_java_io_ObjectInputStream_bytesToFloats

/*
 * Class:     java_io_ObjectInputStream
 * Method:    bytesToFloats
 * Signature: ([BI[FII)V
 * 
 * Reconstitutes nfloats float values from their byte representations.  Byte
 * values are read from array src starting at offset srcpos; the resulting
 * float values are written to array dst starting at dstpos.
 */
JNIEXPORT void JNICALL 
Java_java_io_ObjectInputStream_bytesToFloats(JNIEnv *env, 
					     jclass thisObj, 
					     jbyteArray src, 
					     jint srcpos, 
					     jfloatArray dst, 
					     jint dstpos, 
					     jint nfloats)
{
    union {
	int i;
	float f;
    } u;
    jfloat *floats;
    jbyte *bytes;
    jsize dstend;
    jint ival;

    if (nfloats == 0)
	return;
    
    /* fetch source array */
    if (src == NULL) {
	JNU_ThrowNullPointerException(env, NULL);
	return;
    }
    bytes = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, src, NULL);
    if (bytes == NULL)		/* exception thrown */
	return;
    
    /* fetch dest array */
    if (dst == NULL) {
	(*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
	JNU_ThrowNullPointerException(env, NULL);
	return;
    }
    floats = (jfloat *)(*env)->GetPrimitiveArrayCritical(env, dst, NULL);
    if (floats == NULL) {	/* exception thrown */
	(*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
	return;
    }
    
    /* do conversion */
    dstend = dstpos + nfloats;
    for ( ; dstpos < dstend; dstpos++) {
	ival = ((bytes[srcpos + 0] & 0xFF) << 24) +
	       ((bytes[srcpos + 1] & 0xFF) << 16) +
	       ((bytes[srcpos + 2] & 0xFF) << 8) +
	       ((bytes[srcpos + 3] & 0xFF) << 0);
	u.i = (long) ival;
	floats[dstpos] = (jfloat) u.f;
	srcpos += 4;
    }
    
    (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
    (*env)->ReleasePrimitiveArrayCritical(env, dst, floats, 0);
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:66,代码来源:ObjectInputStream.c

示例2: Java_java_io_ObjectInputStream_bytesToDoubles

/*
 * Class:     java_io_ObjectInputStream
 * Method:    bytesToDoubles
 * Signature: ([BI[DII)V
 * 
 * Reconstitutes ndoubles double values from their byte representations.
 * Byte values are read from array src starting at offset srcpos; the
 * resulting double values are written to array dst starting at dstpos.
 */
JNIEXPORT void JNICALL 
Java_java_io_ObjectInputStream_bytesToDoubles(JNIEnv *env, 
					      jclass thisObj, 
					      jbyteArray src, 
					      jint srcpos, 
					      jdoubleArray dst, 
					      jint dstpos, 
					      jint ndoubles)

{
    union {
	jlong l;
	double d;
    } u;
    jdouble *doubles;
    jbyte *bytes;
    jsize dstend;
    jlong lval;

    if (ndoubles == 0)
	return;
    
    /* fetch source array */
    if (src == NULL) {
	JNU_ThrowNullPointerException(env, NULL);
	return;
    }
    bytes = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, src, NULL);
    if (bytes == NULL)		/* exception thrown */
	return;
    
    /* fetch dest array */
    if (dst == NULL) {
	(*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
	JNU_ThrowNullPointerException(env, NULL);
	return;
    }
    doubles = (jdouble *)(*env)->GetPrimitiveArrayCritical(env, dst, NULL);
    if (doubles == NULL) {	/* exception thrown */
	(*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
	return;
    }
    
    /* do conversion */
    dstend = dstpos + ndoubles;
    for ( ; dstpos < dstend; dstpos++) {
	lval = READ_JLONG_FROM_BUF(bytes, srcpos);
	jlong_to_jdouble_bits(&lval);
	u.l = lval;
	doubles[dstpos] = (jdouble) u.d;
	srcpos += 8;
    }
    
    (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
    (*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0);
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:65,代码来源:ObjectInputStream.c

示例3: Java_java_awt_AWTEvent_nativeSetSource

JNIEXPORT void JNICALL
Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
				       jobject newSource)
{
    jbyteArray bdata;

    AWT_LOCK();

    bdata = (jbyteArray)(*env)->GetObjectField(env, self, awtEventIDs.bdata);

    if (bdata != NULL) {
	XEvent *xev;
	Window w;
	jboolean dummy;

	/* get the widget out of the peer newSource */
	struct ComponentData *cdata = (struct ComponentData *)
	    JNU_GetLongFieldAsPtr(env, newSource, mComponentPeerIDs.pData);
	if (JNU_IsNull(env, cdata) || (cdata == NULL) ||
	    ((cdata->widget != NULL) && (XtIsObject(cdata->widget)) &&
	     (cdata->widget->core.being_destroyed))) {
	    JNU_ThrowNullPointerException(env, "null widget");
	    AWT_UNLOCK();
	    return;
	}
	
	/* get the Window out of the widget */
	w = XtWindow(cdata->widget);

	if (w == None) {
	    JNU_ThrowNullPointerException(env, "null window");
	    AWT_UNLOCK();
	    return;
	}

	/* reset the filed in the event */
	xev = (XEvent *)(*env)->GetPrimitiveArrayCritical(env, bdata, &dummy);
	if (xev == NULL) {
	    JNU_ThrowNullPointerException(env, "null data");
	    AWT_UNLOCK();
	    return;
	}
	xev->xany.window = w;
	(*env)->ReleasePrimitiveArrayCritical(env, bdata, (void *)xev, 0);
    }

    AWT_UNLOCK();
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:48,代码来源:awt_AWTEvent.c

示例4: awt_GetComponent

JNIEXPORT jobject JNICALL
    awt_GetComponent(JNIEnv* env, void* platformInfo)
{
    Window window = (Window)platformInfo;
    jobject peer = NULL;
    jobject target = NULL;

    AWT_LOCK();

    if (window != None) {
        peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
            "windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
    }
    if ((peer != NULL) &&
        (JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
        target = (*env)->GetObjectField(env, peer, targetID);
    }

    if (target == NULL) {
        JNU_ThrowNullPointerException(env, "NullPointerException");
        AWT_UNLOCK();
        return (jobject)NULL;
    }

    AWT_UNLOCK();

    return target;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:28,代码来源:awt_DrawingSurface.c

示例5: Java_java_awt_image_ColorModel_initIDs

JNIEXPORT void JNICALL
Java_java_awt_image_ColorModel_initIDs(JNIEnv *env, jclass cls) {
    g_CMpDataID = (*env)->GetFieldID (env, cls, "pData", "J");
    g_CMnBitsID  = (*env)->GetFieldID(env, cls, "nBits", "[I");
    g_CMcspaceID = (*env)->GetFieldID(env, cls, "colorSpace",
                                    "Ljava/awt/color/ColorSpace;");
    g_CMnumComponentsID = (*env)->GetFieldID(env, cls, "numComponents", "I");
    g_CMsuppAlphaID  = (*env)->GetFieldID(env, cls, "supportsAlpha", "Z");
    g_CMisAlphaPreID = (*env)->GetFieldID(env, cls, "isAlphaPremultiplied",
                                          "Z");
    g_CMtransparencyID = (*env)->GetFieldID(env, cls, "transparency", "I");
    g_CMgetRGBMID      = (*env)->GetMethodID(env, cls, "getRGB",
                                             "(Ljava/lang/Object;)I");
    g_CMcsTypeID       = (*env)->GetFieldID(env, cls, "colorSpaceType", "I");
    g_CMis_sRGBID      = (*env)->GetFieldID(env, cls, "is_sRGB", "Z");
    g_CMgetRGBdefaultMID   = (*env)->GetStaticMethodID(env, cls,
                                                       "getRGBdefault",
                                             "()Ljava/awt/image/ColorModel;");
    if (g_CMnBitsID == NULL || g_CMcspaceID == NULL 
        || g_CMnumComponentsID == NULL || g_CMsuppAlphaID == NULL
        || g_CMisAlphaPreID == NULL || g_CMtransparencyID == NULL
        || g_CMgetRGBMID == NULL || g_CMgetRGBMID == NULL
        || g_CMis_sRGBID == NULL || g_CMgetRGBdefaultMID == NULL
	|| g_CMpDataID == NULL)
    {
        JNU_ThrowNullPointerException(env, "Unable to grab field ids");
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:28,代码来源:imageInitIDs.c

示例6: Java_java_awt_image_Raster_initIDs

JNIEXPORT void JNICALL
Java_java_awt_image_Raster_initIDs(JNIEnv *env, jclass cls) {
    g_RasterWidthID    = (*env)->GetFieldID(env, cls, "width", "I");
    g_RasterHeightID   = (*env)->GetFieldID(env, cls, "height", "I");
    g_RasterNumBandsID = (*env)->GetFieldID(env, cls, "numBands", "I");
    g_RasterGetDataMID = (*env)->GetMethodID(env, cls, "getDataElements",
                              "(IIIILjava/lang/Object;)Ljava/lang/Object;");
    g_RasterMinXID  = (*env)->GetFieldID(env, cls, "minX", "I");
    g_RasterMinYID  = (*env)->GetFieldID(env, cls, "minY", "I");
    g_RasterBaseOriginXID  = (*env)->GetFieldID(env, cls,
                                 "sampleModelTranslateX", "I");
    g_RasterBaseOriginYID  = (*env)->GetFieldID(env, cls, 
                                 "sampleModelTranslateY", "I");
    g_RasterSampleModelID = (*env)->GetFieldID(env, cls,
                                 "sampleModel","Ljava/awt/image/SampleModel;");
    g_RasterNumDataElementsID = (*env)->GetFieldID(env, cls, "numDataElements",
                                                   "I");
    g_RasterNumBandsID = (*env)->GetFieldID(env, cls, "numBands", "I");
    g_RasterDataBufferID = (*env)->GetFieldID(env, cls, "dataBuffer",
                                              "Ljava/awt/image/DataBuffer;");
    if (g_RasterWidthID == NULL || g_RasterHeightID == NULL
        || g_RasterNumBandsID == NULL || g_RasterGetDataMID == NULL
        || g_RasterMinXID == NULL || g_RasterMinYID == NULL
        || g_RasterBaseOriginXID == NULL || g_RasterBaseOriginYID == NULL
        || g_RasterSampleModelID == NULL || g_RasterNumDataElementsID == NULL
        || g_RasterNumBandsID == NULL || g_RasterDataBufferID == NULL)
    {
        JNU_ThrowNullPointerException(env, "Unable to grab field ids");
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:30,代码来源:imageInitIDs.c

示例7: JNU_ThrowNullPointerException

/*
 * Class:     sun_java2d_x11_X11Renderer
 * Method:    XDrawPoly
 * Signature: (IJII[I[IIZ)V
 */
JNIEXPORT void JNICALL Java_sun_java2d_x11_X11Renderer_XDrawPoly
    (JNIEnv *env, jobject xr,
     jlong pXSData, jlong xgc,
     jint transx, jint transy,
     jintArray xcoordsArray, jintArray ycoordsArray, jint npoints,
     jboolean isclosed)
{
#ifndef HEADLESS
    XPoint pTmp[POLYTEMPSIZE], *points;
    X11SDOps *xsdo = (X11SDOps *) pXSData;

    if (xsdo == NULL) {
        return;
    }

    if (JNU_IsNull(env, xcoordsArray) || JNU_IsNull(env, ycoordsArray)) {
        JNU_ThrowNullPointerException(env, "coordinate array");
        return;
    }
    if ((*env)->GetArrayLength(env, ycoordsArray) < npoints ||
        (*env)->GetArrayLength(env, xcoordsArray) < npoints)
    {
        JNU_ThrowArrayIndexOutOfBoundsException(env, "coordinate array");
        return;
    }

    if (npoints < 2) {
        return;
    }

    points = transformPoints(env, xcoordsArray, ycoordsArray, transx, transy,
                             pTmp, (int *)&npoints, isclosed);
    if (points == 0) {
        JNU_ThrowOutOfMemoryError(env, "translated coordinate array");
    } else {
        if (npoints == 2) {
            /*
             * Some X11 implementations fail to draw anything for
             * simple 2 point polygons where the vertices are the
             * same point even though this violates the X11
             * specification.  For simplicity we will dispatch all
             * 2 point polygons through XDrawLine even if they are
             * non-degenerate as this may invoke less processing
             * down the line than a Poly primitive anyway.
             */
            XDrawLine(awt_display, xsdo->drawable, (GC) xgc,
                      points[0].x, points[0].y,
                      points[1].x, points[1].y);
        } else {
            XDrawLines(awt_display, xsdo->drawable, (GC) xgc,
                       points, npoints, CoordModeOrigin);
        }
        if (points != pTmp) {
            free(points);
        }
        X11SD_DirectRenderNotify(env, xsdo);
    }
#endif /* !HEADLESS */
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:64,代码来源:X11Renderer.c

示例8: Java_java_awt_image_DataBufferInt_initIDs

JNIEXPORT void JNICALL
Java_java_awt_image_DataBufferInt_initIDs(JNIEnv *env, jclass cls) {
    g_DataBufferIntPdataID = (*env)->GetFieldID(env, cls, "pData", "J");
    if (g_DataBufferIntPdataID == NULL) {
        JNU_ThrowNullPointerException(env, "Unable to grab DataBufferInt.pData");
        return;
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:8,代码来源:imageInitIDs.c

示例9: JNU_ThrowNullPointerException

JNIEXPORT void JNICALL
Java_java_awt_Color_initIDs
  (JNIEnv *env, jclass clazz)
{
    colorValueID = (*env)->GetFieldID(env, clazz, "value", "I");

    if(colorValueID == NULL)
        JNU_ThrowNullPointerException (env, "Can't get java/awt/Color.value fieldID");
}
开发者ID:frohoff,项目名称:jdk6,代码行数:9,代码来源:initIDs.c

示例10: Java_java_awt_image_IndexColorModel_initIDs

JNIEXPORT void JNICALL
Java_java_awt_image_IndexColorModel_initIDs(JNIEnv *env, jclass cls) {
    g_ICMtransIdxID = (*env)->GetFieldID(env, cls, "transparent_index", "I");
    g_ICMmapSizeID  = (*env)->GetFieldID(env, cls, "map_size", "I");
    g_ICMrgbID      = (*env)->GetFieldID(env, cls, "rgb", "[I");
    if (g_ICMtransIdxID == NULL || g_ICMmapSizeID == NULL
        || g_ICMrgbID == NULL) {
        JNU_ThrowNullPointerException(env, "Unable to grab field ids");
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:10,代码来源:imageInitIDs.c

示例11: Java_java_awt_image_ComponentSampleModel_initIDs

JNIEXPORT void JNICALL
Java_java_awt_image_ComponentSampleModel_initIDs(JNIEnv *env, jclass cls) {
    g_CSMPixStrideID = (*env)->GetFieldID(env, cls, "pixelStride", "I");
    g_CSMScanStrideID = (*env)->GetFieldID(env, cls, "scanlineStride", "I");
    g_CSMBandOffsetsID = (*env)->GetFieldID(env, cls, "bandOffsets", "[I");
    if (g_CSMPixStrideID == NULL || g_CSMScanStrideID == NULL ||
        g_CSMBandOffsetsID == NULL) {
        JNU_ThrowNullPointerException(env, "Unable to grab field ids");
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:10,代码来源:imageInitIDs.c

示例12: awt_util_hide

void
awt_util_hide(Widget w)
{
    if (w == NULL) {
        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
        JNU_ThrowNullPointerException(env,"NullPointerException");
        return;
    }
    XtSetMappedWhenManaged(w, False);
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:10,代码来源:awt_util.c

示例13: dlsym

void *findFunction(JNIEnv *env, void *hModule, char *functionName) {
    void *fAddress = dlsym(hModule, functionName);
    if (fAddress == NULL) {
        char errorMessage[256];
        snprintf(errorMessage, sizeof(errorMessage), "Symbol not found: %s", functionName);
        JNU_ThrowNullPointerException(env, errorMessage);
        return NULL;
    }
    return fAddress;
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:10,代码来源:pcsc_md.c

示例14: Java_java_awt_image_Kernel_initIDs

JNIEXPORT void JNICALL
Java_java_awt_image_Kernel_initIDs(JNIEnv *env, jclass cls) {
    g_KernelWidthID   = (*env)->GetFieldID(env, cls, "width", "I");
    g_KernelHeightID  = (*env)->GetFieldID(env, cls, "height", "I");
    g_KernelDataID    = (*env)->GetFieldID(env, cls, "data", "[F");
    if (g_KernelWidthID == NULL || g_KernelHeightID == NULL
        || g_KernelDataID == NULL)
    {
        JNU_ThrowNullPointerException(env, "Unable to grab field ids");
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:11,代码来源:imageInitIDs.c

示例15: GetProcAddress

void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
    HINSTANCE hModule = (HINSTANCE)jHandle;
    void *fAddress = GetProcAddress(hModule, functionName);
    if (fAddress == NULL) {
        char errorMessage[256];
        _snprintf(errorMessage, sizeof(errorMessage), "Symbol not found: %s", functionName);
        JNU_ThrowNullPointerException(env, errorMessage);
        return NULL;
    }
    return fAddress;
}
开发者ID:michalwarecki,项目名称:ManagedRuntimeInitiative,代码行数:11,代码来源:j2secmod_md.c


注:本文中的JNU_ThrowNullPointerException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。