您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ throwRuntimeException函数代码示例

51自学网 2021-06-03 08:49:24
  C++
这篇教程C++ throwRuntimeException函数代码示例写得很实用,希望能帮到您。

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

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

示例1: throwRuntimeException

JNIEXPORT void JNICALL Java_com_intel_bluetooth_BluetoothStackBlueZ_l2Send  (JNIEnv* env, jobject peer, jlong handle, jbyteArray data, jint transmitMTU) {#ifdef BLUECOVE_L2CAP_MTU_TRUNCATE    struct l2cap_options opt;    if (!l2Get_options(env, handle, &opt)) {        return;    }#endif //BLUECOVE_L2CAP_MTU_TRUNCATE    if (data == NULL) {        throwRuntimeException(env, "Invalid argument");        return;    }    jbyte *bytes = (*env)->GetByteArrayElements(env, data, 0);    if (bytes == NULL) {        throwRuntimeException(env, "Invalid argument");        return;    }    int len = (int)(*env)->GetArrayLength(env, data);    if (len > transmitMTU) {		len = transmitMTU;	}#ifdef BLUECOVE_L2CAP_MTU_TRUNCATE    if (len > opt.omtu) {        len = opt.omtu;    }#endif //BLUECOVE_L2CAP_MTU_TRUNCATE    int count = send(handle, (char *)bytes, len, 0);    if (count < 0) {        throwIOException(env, "Failed to write. [%d] %s", errno, strerror(errno));    }    (*env)->ReleaseByteArrayElements(env, data, bytes, 0);}
开发者ID:AfonsodelCB,项目名称:bluecove,代码行数:35,


示例2: throwRuntimeException

JNIEXPORT void JNICALL Java_com_intel_bluetooth_BluetoothStackBlueZDBus_connectionRfWrite__J_3BII  (JNIEnv* env, jobject peer, jlong handle, jbyteArray b, jint off, jint len) {    if (b == NULL) {        throwRuntimeException(env, "Invalid argument");        return;    }    jbyte *bytes = (*env)->GetByteArrayElements(env, b, 0);    if (bytes == NULL) {        throwRuntimeException(env, "Invalid argument");        return;    }    int done = 0;    while(done < len) {        int count = send(handle, (char *)(bytes + off + done), len - done, 0);        if (count < 0) {            throwIOException(env, "Failed to write. [%d] %s", errno, strerror(errno));            break;        }        if (isCurrentThreadInterrupted(env, peer)) {            break;        }        done += count;    }    (*env)->ReleaseByteArrayElements(env, b, bytes, 0);}
开发者ID:AfonsodelCB,项目名称:bluecove,代码行数:25,


示例3: DeviceInquiryCallback_builDeviceInquiryCallbacks

bool DeviceInquiryCallback_builDeviceInquiryCallbacks(JNIEnv * env, struct DeviceInquiryCallback* callback, jobject inquiryRunnable, jobject startedNotify) {    jclass inquiryRunnableClass = (*env)->GetObjectClass(env, inquiryRunnable);    if (inquiryRunnableClass == NULL) {        throwRuntimeException(env, "Fail to get Object Class");        return false;    }    jmethodID deviceDiscoveredCallbackMethod = (*env)->GetMethodID(env, inquiryRunnableClass, "deviceDiscoveredCallback", "(Ljavax/bluetooth/DiscoveryListener;JILjava/lang/String;Z)V");    if (deviceDiscoveredCallbackMethod == NULL) {        throwRuntimeException(env, "Fail to get MethodID deviceDiscoveredCallback");        return false;    }    jclass notifyClass = (*env)->GetObjectClass(env, startedNotify);    if (notifyClass == NULL) {        throwRuntimeException(env, "Fail to get Object Class");        return false;    }    jmethodID notifyMethod = (*env)->GetMethodID(env, notifyClass, "deviceInquiryStartedCallback", "()V");    if (notifyMethod == NULL) {        throwRuntimeException(env, "Fail to get MethodID deviceInquiryStartedCallback");        return false;    }    callback->inquiryRunnable = inquiryRunnable;    callback->deviceDiscoveredCallbackMethod = deviceDiscoveredCallbackMethod;    callback->startedNotify = startedNotify;    callback->startedNotifyNotifyMethod = notifyMethod;    return true;}
开发者ID:enptfb55,项目名称:total-control-remote-control-android-app,代码行数:32,


示例4: setText

static void setText(JNIEnv* env, jclass clazz, RegExData* data, jstring text){    UErrorCode status = U_ZERO_ERROR;    uregex_setText(data->regex, &EMPTY_STRING, 0, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);        return;    }    if (data->text != &EMPTY_STRING) {        delete[] data->text;        data->text = NULL;    }    int textLen = env->GetStringLength(text);    if (textLen == 0) {        data->text = &EMPTY_STRING;    } else {        data->text = new jchar[textLen + 1];        env->GetStringRegion(text, 0, textLen, data->text);        data->text[textLen] = 0;    }    uregex_setText(data->regex, data->text, textLen, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:29,


示例5: sizeof

JNIEXPORT jstring JNICALL Java_com_intel_bluetooth_BluetoothStackBlueZ_getRemoteDeviceVersionInfoImpl(JNIEnv *env, jobject peer, jint deviceDescriptor, jlong remoteDeviceAddressLong) {    struct hci_conn_info_req *conn_info;    struct hci_version ver;    char info[256];    conn_info = (struct hci_conn_info_req*)malloc(sizeof(*conn_info) + sizeof(struct hci_conn_info));    if (!conn_info) {        throwRuntimeException(env, cOUT_OF_MEMORY);        return NULL;    }    memset(conn_info, 0, sizeof(struct hci_conn_info));    longToDeviceAddr(remoteDeviceAddressLong, &(conn_info->bdaddr));    conn_info->type = ACL_LINK;    if (ioctl((int)deviceDescriptor, HCIGETCONNINFO, (unsigned long) conn_info) < 0) {        free(conn_info);        throwRuntimeException(env, "Fail to get connection info");        return NULL;    }    int error = hci_read_remote_version((int)deviceDescriptor, conn_info->conn_info->handle, &ver, READ_REMOTE_NAME_TIMEOUT);    if (error < 0) {        throwRuntimeException(env, "Can not get remote device info");        free(conn_info);        return NULL;    }    snprintf(info, 256, "manufacturer=%i,lmp_version=%i,lmp_sub_version=%i", ver.manufacturer, ver.lmp_ver, ver.lmp_subver);    free(conn_info);    return (*env)->NewStringUTF(env, info);}
开发者ID:enptfb55,项目名称:total-control-remote-control-android-app,代码行数:31,


示例6: convertException

inline void convertException(JNIEnv* env, Func func) noexcept{    try {        func();    } catch (JavaException& e) {        return;    } catch (std::exception& e) {        throwRuntimeException(env, e.what());    } catch (...) {        throwRuntimeException(env, "Unindentified exception thrown (not derived from std::exception)");    }}
开发者ID:meryngii,项目名称:jni_util,代码行数:12,


示例7: getGetMethodID

jmethodID getGetMethodID(JNIEnv * env, jclass clazz, const char *name, const char *sig) {    if (clazz == NULL) {        throwRuntimeException(env, "Fail to get MethodID %s for NULL class", name);        return NULL;    }    jmethodID methodID = (*env)->GetMethodID(env, clazz, name, sig);    if (methodID == NULL) {        throwRuntimeException(env, "Fail to get MethodID %s", name);        return NULL;    }    return methodID;}
开发者ID:enptfb55,项目名称:total-control-remote-control-android-app,代码行数:12,


示例8: epollCtl

jint epollCtl(JNIEnv * env, jint efd, int op, jint fd, jint flags, jint id) {    uint32_t events = EPOLLET;    if (flags & EPOLL_ACCEPT) {        events |= EPOLLIN;    }    if (flags & EPOLL_READ) {        events |= EPOLLIN | EPOLLRDHUP;    }    if (flags & EPOLL_WRITE) {        events |= EPOLLOUT;    }    struct epoll_event ev = {        .events = events,        // encode the id into the events        .data.u64 = (((uint64_t) id) << 32L)    };    return epoll_ctl(efd, op, fd, &ev);}jint getOption(JNIEnv *env, jint fd, int level, int optname, const void *optval, socklen_t optlen) {    int code;    code = getsockopt(fd, level, optname, optval, &optlen);    if (code == 0) {        return 0;    }    int err = errno;    throwRuntimeException(env, exceptionMessage("Error during getsockopt(...): ", err));    return code;}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:32,


示例9: getIOControl

static inline struct io_control * getIOControl(JNIEnv* env, jobject pointer) {    struct io_control * ioControl = (struct io_control *) (*env)->GetDirectBufferAddress(env, pointer);    if (ioControl == NULL) {       throwRuntimeException(env, "Controller not initialized");    }    return ioControl;}
开发者ID:jamezp,项目名称:activemq-artemis,代码行数:7,


示例10: NativeCrypto_EVP_PKEY_new_RSA

/** * private static native int EVP_PKEY_new_RSA(byte[] n, byte[] e, byte[] d, byte[] p, byte[] q); */static EVP_PKEY* NativeCrypto_EVP_PKEY_new_RSA(JNIEnv* env, jclass clazz, jbyteArray n, jbyteArray e, jbyteArray d, jbyteArray p, jbyteArray q) {    // LOGD("Entering EVP_PKEY_new_RSA()");    RSA* rsa = RSA_new();    rsa->n = arrayToBignum(env, n);    rsa->e = arrayToBignum(env, e);    if (d != NULL) {        rsa->d = arrayToBignum(env, d);    }    if (p != NULL) {        rsa->p = arrayToBignum(env, p);    }    if (q != NULL) {        rsa->q = arrayToBignum(env, q);    }    // int check = RSA_check_key(rsa);    // LOGI("RSA_check_key returns %d", check);    if (rsa->n == NULL || rsa->e == NULL) {        RSA_free(rsa);        throwRuntimeException(env, "Unable to convert BigInteger to BIGNUM");        return NULL;    }    EVP_PKEY* pkey = EVP_PKEY_new();    EVP_PKEY_assign_RSA(pkey, rsa);    return pkey;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:37,


示例11: NativeCrypto_EVP_PKEY_new_DSA

/** * private static native int EVP_PKEY_new_DSA(byte[] p, byte[] q, byte[] g, byte[] pub_key, byte[] priv_key); */static EVP_PKEY* NativeCrypto_EVP_PKEY_new_DSA(JNIEnv* env, jclass clazz, jbyteArray p, jbyteArray q, jbyteArray g, jbyteArray pub_key, jbyteArray priv_key) {    // LOGD("Entering EVP_PKEY_new_DSA()");    DSA* dsa = DSA_new();    dsa->p = arrayToBignum(env, p);    dsa->q = arrayToBignum(env, q);    dsa->g = arrayToBignum(env, g);    dsa->pub_key = arrayToBignum(env, pub_key);    if (priv_key != NULL) {        dsa->priv_key = arrayToBignum(env, priv_key);    }    if (dsa->p == NULL || dsa->q == NULL || dsa->g == NULL || dsa->pub_key == NULL) {        DSA_free(dsa);        throwRuntimeException(env, "Unable to convert BigInteger to BIGNUM");        return NULL;    }    EVP_PKEY* pkey = EVP_PKEY_new();    EVP_PKEY_assign_DSA(pkey, dsa);    return pkey;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:28,


示例12: threadSleep

bool threadSleep(JNIEnv *env, jlong millis) {    jclass clazz = (*env)->FindClass(env, "java/lang/Thread");    if (clazz == NULL) {        throwRuntimeException(env, "Fail to get Thread class");        return false;    }    jmethodID methodID = (*env)->GetStaticMethodID(env, clazz, "sleep", "(J)V");    if (methodID == NULL) {        throwRuntimeException(env, "Fail to get MethodID Thread.sleep");        return false;    }    (*env)->CallStaticVoidMethod(env, clazz, methodID, millis);    if ((*env)->ExceptionCheck(env)) {        return false;    }    return true;}
开发者ID:enptfb55,项目名称:total-control-remote-control-android-app,代码行数:17,


示例13: Java_io_netty_channel_epoll_Native_epollCreate

JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_epollCreate(JNIEnv * env, jclass clazz) {    jint efd = epoll_create1(EPOLL_CLOEXEC);    if (efd < 0) {        int err = errno;        throwRuntimeException(env, exceptionMessage("Error during epoll_create(...): ", err));    }    return efd;}
开发者ID:CliffYuan,项目名称:netty,代码行数:8,


示例14: reset

static void reset(JNIEnv* env, jclass clazz, RegExData* data, jint position){    UErrorCode status = U_ZERO_ERROR;    uregex_reset(data->regex, position, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:8,


示例15: setOption

int setOption(JNIEnv *env, jint fd, int level, int optname, const void *optval, socklen_t len) {    int rc = setsockopt(fd, level, optname, optval, len);    if (rc < 0) {        int err = errno;        throwRuntimeException(env, exceptionMessage("Error during setsockopt(...): ", err));    }    return rc;}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:8,


示例16: Java_io_netty_channel_epoll_Native_read

JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_read(JNIEnv * env, jclass clazz, jint fd, jobject jbuffer, jint pos, jint limit) {    void *buffer = (*env)->GetDirectBufferAddress(env, jbuffer);    if (buffer == NULL) {        throwRuntimeException(env, "Unable to access address of buffer");        return -1;    }    return read0(env, clazz, fd, buffer, pos, limit);}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:8,


示例17: isCurrentThreadInterrupted

bool isCurrentThreadInterrupted(JNIEnv *env, jobject peer) {    jclass peerClass = (*env)->GetObjectClass(env, peer);    if (peerClass == NULL) {        throwRuntimeException(env, "Fail to get Object Class");        return true;    }    jmethodID aMethod = (*env)->GetMethodID(env, peerClass, "isCurrentThreadInterruptedCallback", "()Z");    if (aMethod == NULL) {        throwRuntimeException(env, "Fail to get MethodID isCurrentThreadInterruptedCallback");        return true;    }    if ((*env)->CallBooleanMethod(env, peer, aMethod)) {        throwInterruptedIOException(env, "thread interrupted");        return true;    }    return (*env)->ExceptionCheck(env);}
开发者ID:AfonsodelCB,项目名称:bluecove,代码行数:17,


示例18: malloc

/* * Creates compatible GraphicsInfo structure for specified device context */static inline GraphicsInfo *createCompatibleImageInfo(JNIEnv *env, HDC hdc, jint width, jint height) {    GraphicsInfo *gi = (GraphicsInfo *) malloc(sizeof(GraphicsInfo));       // To avoid issue of joint operation Windows NetMeeting and GL,       // we create HDC and Bitmap for Volatile Image which will compatible        // HDC of the entire screen. It may leads to other issues on        // multimonitor systems in the future.        gi->hwnd = 0;       HDC dc = GetDC(NULL);    //gi->hdc = CreateCompatibleDC(hdc);    gi->hdc = CreateCompatibleDC(dc);    if (gi->hdc == NULL) {        // We are out of GDI resources        runGC(env);        //gi->hdc = CreateCompatibleDC(hdc);        gi->hdc = CreateCompatibleDC(dc);        if (gi->hdc == NULL)            throwRuntimeException(env);    }                // Creating bitmap and setting it to DC    //gi->bmp = CreateCompatibleBitmap(hdc, width, height);    gi->bmp = CreateCompatibleBitmap(dc, width, height);    if (gi->bmp == NULL) {        // We are out of GDI resources        runGC(env);        //gi->bmp = CreateCompatibleBitmap(hdc, width, height);        gi->bmp = CreateCompatibleBitmap(dc, width, height);        if (gi->bmp == NULL)            throwRuntimeException(env);    }    SelectObject(gi->hdc, gi->bmp);       ReleaseDC(NULL, dc);        gi->graphics = new Graphics(gi->hdc);    gi->pen = 0;    gi->brush = 0;       gi->matrix = 0;    gi->clip = new Region(Rect(0, 0, width, height));    gi->graphics->SetClip(gi->clip);        return gi; }
开发者ID:dennis-xlc,项目名称:ORDER,代码行数:49,


示例19: Java_io_netty_channel_epoll_Native_epollCtlDel

JNIEXPORT void JNICALL Java_io_netty_channel_epoll_Native_epollCtlDel(JNIEnv * env, jclass clazz, jint efd, jint fd) {    // Create an empty event to workaround a bug in older kernels which can not handle NULL.    struct epoll_event event = { 0 };    if (epoll_ctl(efd, EPOLL_CTL_DEL, fd, &event) < 0) {        int err = errno;        throwRuntimeException(env, exceptionMessage("Error during calling epoll_ctl(...): ", err));    }}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:8,


示例20: Java_io_netty_channel_epoll_Native_sendTo

JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_sendTo(JNIEnv * env, jclass clazz, jint fd, jobject jbuffer, jint pos, jint limit, jbyteArray address, jint scopeId, jint port) {    void *buffer = (*env)->GetDirectBufferAddress(env, jbuffer);    if (buffer == NULL) {        throwRuntimeException(env, "Unable to access address of buffer");        return -1;    }    return sendTo0(env, fd, buffer, pos, limit, address, scopeId, port);}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:8,


示例21: Java_io_netty_channel_epoll_Native_eventFdRead

JNIEXPORT void JNICALL Java_io_netty_channel_epoll_Native_eventFdRead(JNIEnv * env, jclass clazz, jint fd) {    uint64_t eventfd_t;    if (eventfd_read(fd, &eventfd_t) != 0) {        // something is serious wrong        throwRuntimeException(env, "Error calling eventfd_read(...)");    }}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:8,


示例22: Java_io_netty_channel_epoll_Native_eventFdWrite

JNIEXPORT void JNICALL Java_io_netty_channel_epoll_Native_eventFdWrite(JNIEnv * env, jclass clazz, jint fd, jlong value) {    jint eventFD = eventfd_write(fd, (eventfd_t)value);    if (eventFD < 0) {        int err = errno;        throwRuntimeException(env, exceptionMessage("Error calling eventfd_write(...): ", err));    }}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:8,


示例23: setRegion

static void setRegion(JNIEnv* env, jclass clazz, RegExData* data, jint start,                      jint end){    UErrorCode status = U_ZERO_ERROR;    uregex_setRegion(data->regex, start, end, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:9,


示例24: regionStart

static jint regionStart(JNIEnv* env, jclass clazz, RegExData* data){    UErrorCode status = U_ZERO_ERROR;    int result = uregex_regionStart(data->regex, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }    return result;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:9,


示例25: useAnchoringBounds

static void useAnchoringBounds(JNIEnv* env, jclass clazz, RegExData* data,                               jboolean value){    UErrorCode status = U_ZERO_ERROR;    uregex_useAnchoringBounds(data->regex, value, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:9,


示例26: Java_io_netty_channel_epoll_Native_eventFd

JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_eventFd(JNIEnv * env, jclass clazz) {    jint eventFD =  eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);    if (eventFD < 0) {        int err = errno;        throwRuntimeException(env, exceptionMessage("Error creating eventFD(...): ", err));    }    return eventFD;}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:9,


示例27: requireEnd

static jboolean requireEnd(JNIEnv* env, jclass clazz, RegExData* data){    UErrorCode status = U_ZERO_ERROR;    jboolean result = uregex_requireEnd(data->regex, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }    return result;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:9,


示例28: throwRuntimeException

JNIEXPORT void JNICALL Java_org_apache_activemq_artemis_jlibaio_LibaioContext_freeBuffer  (JNIEnv * env, jclass clazz, jobject jbuffer) {    if (jbuffer == NULL)    {       throwRuntimeException(env, "Null pointer");       return;    }  	void *  buffer = (*env)->GetDirectBufferAddress(env, jbuffer);  	free(buffer);}
开发者ID:jamezp,项目名称:activemq-artemis,代码行数:10,


示例29: Java_io_netty_channel_epoll_Native_kernelVersion

JNIEXPORT jstring JNICALL Java_io_netty_channel_epoll_Native_kernelVersion(JNIEnv *env, jclass clazz) {    struct utsname name;    int res = uname(&name);    if (res == 0) {        return (*env)->NewStringUTF(env, name.release);    }    int err = errno;    throwRuntimeException(env, exceptionMessage("Error during uname(...): ", err));    return NULL;}
开发者ID:ByungChulHwang,项目名称:netty,代码行数:11,


示例30: lookingAt

static jboolean lookingAt(JNIEnv* env, jclass clazz, RegExData* data,                          jint startIndex){    UErrorCode status = U_ZERO_ERROR;    jboolean result = uregex_lookingAt(data->regex, startIndex, &status);    if (!U_SUCCESS(status)) {        throwRuntimeException(env, status);    }    return result;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:12,



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


C++ throwUnexpected函数代码示例
C++ throwNotEnoughArgumentsError函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。