2016-08-22 20:01:42 +02:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2016-08-22 20:01:42 +02:00
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
#include "include/org_rocksdb_RocksDBExceptionTest.h"
|
|
|
|
|
|
|
|
#include "rocksdb/slice.h"
|
|
|
|
#include "rocksdb/status.h"
|
|
|
|
#include "rocksjni/portal.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseException
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseException(JNIEnv* env,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env,
|
|
|
|
std::string("test message"));
|
2016-08-22 20:01:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionWithStatusCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCode(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(
|
|
|
|
env, "test message", ROCKSDB_NAMESPACE::Status::NotSupported());
|
2016-08-22 20:01:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionNoMsgWithStatusCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCode(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(
|
|
|
|
env, ROCKSDB_NAMESPACE::Status::NotSupported());
|
2016-08-22 20:01:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionWithStatusCodeSubCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeSubCode(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(
|
2016-08-22 20:01:42 +02:00
|
|
|
env, "test message",
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::Status::TimedOut(
|
|
|
|
ROCKSDB_NAMESPACE::Status::SubCode::kLockTimeout));
|
2016-08-22 20:01:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionNoMsgWithStatusCodeSubCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCodeSubCode(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(
|
|
|
|
env, ROCKSDB_NAMESPACE::Status::TimedOut(
|
|
|
|
ROCKSDB_NAMESPACE::Status::SubCode::kLockTimeout));
|
2016-08-22 20:01:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionWithStatusCodeState
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeState(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
ROCKSDB_NAMESPACE::Slice state("test state");
|
|
|
|
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(
|
|
|
|
env, "test message", ROCKSDB_NAMESPACE::Status::NotSupported(state));
|
2016-08-22 20:01:42 +02:00
|
|
|
}
|