prevented crash when init is called with null String at address.
Change-Id: I390fdd036e6afae44af36d935564b2fa5045d990
Signed-off-by: jyong2.kim <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/6307
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit
9cbaf9309f0f671b899641a3ed2286621b5b6ed5)
Reviewed-on: https://gerrit.iotivity.org/gerrit/7687
JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingInit
(JNIEnv *env, jobject obj,jstring j_addr)
{
- const char* addr = env->GetStringUTFChars(j_addr,NULL);
-
if (NULL == j_addr)
+ {
return (jint)OCSTACK_ERROR;
+ }
- if(OCInit(addr,USE_RANDOM_PORT,OC_CLIENT_SERVER)!=OC_STACK_OK)
+ if(OCInit1(OC_CLIENT_SERVER, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS))
{
return (jint)OCSTACK_ERROR;
}
- env->ReleaseStringUTFChars(j_addr,addr);
return (jint)OCSTACK_OK;
}