Skip to content

Commit

Permalink
Use existing utility to copy jstring
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpaxton committed Nov 20, 2024
1 parent 49f36bd commit a5cc7ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions java/rocksjni/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2311,13 +2311,13 @@ void Java_org_rocksdb_Options_setDailyOffpeakTimeUTC(JNIEnv* env, jclass,
jlong jhandle,
jstring jtimeutc) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle);
const jsize jtimesz = env->GetStringUTFLength(jtimeutc);
const char* timeutc = env->GetStringUTFChars(jtimeutc, nullptr);
if (env->ExceptionCheck()) {
jboolean has_exception;
auto timeutc =
ROCKSDB_NAMESPACE::JniUtil::copyStdString(env, jtimeutc, &has_exception);
if (has_exception == JNI_TRUE) {
return;
}
opt->daily_offpeak_time_utc = std::string(timeutc, jtimesz);
env->ReleaseStringUTFChars(jtimeutc, timeutc);
opt->daily_offpeak_time_utc = timeutc;
}

/*
Expand Down

0 comments on commit a5cc7ab

Please sign in to comment.