Fix for JIRA IOT-2044.
authorSenthil Kumar G S <senthil.gs@samsung.com>
Thu, 13 Apr 2017 15:00:51 +0000 (20:30 +0530)
committerUze Choi <uzchoi@samsung.com>
Fri, 14 Apr 2017 12:15:28 +0000 (12:15 +0000)
Handled "GetStringUTFChars received NULL jstring" error

Change-Id: I67aecab98e496ec715e634246d4ee32efc44aa8b
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18927
Reviewed-by: Jihun Ha <jihun.ha@samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
java/jni/JniOcRepresentation.cpp

index 042e2a4..27e96a9 100644 (file)
@@ -196,7 +196,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setValueStringN
     }
 
     std::string key = env->GetStringUTFChars(jKey, nullptr);
-    std::string value = env->GetStringUTFChars(jValue, nullptr);
+    std::string value;
+    if(jValue)
+        value = env->GetStringUTFChars(jValue, nullptr);
 
     rep->setValue(key, value);
 }