Commit 620dc9e0 authored by Tim Kourt's avatar Tim Kourt Committed by Patrick Lankswert

Android: Enhancement for the IOT-764

It is OK now to do the following:

OcRepresentation rep = new OcRepresentation();
OcRepresentation repNull = null;
rep.setValue("key", repNull);

Change-Id: I10d554490190561e40cc97c8a1973f6ace0478cd
Signed-off-by: default avatarTim Kourt <tim.a.kourt@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3651Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
Reviewed-by: default avatarPatrick Lankswert <patrick.lankswert@intel.com>
parent 0e8a3908
......@@ -170,10 +170,17 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setValueRepresent
if (!rep) return;
std::string key = env->GetStringUTFChars(jKey, nullptr);
OCRepresentation *value = JniOcRepresentation::getOCRepresentationPtr(env, jValue);
if (!value) return;
rep->setValue(key, *value);
if (jValue)
{
OCRepresentation *value = JniOcRepresentation::getOCRepresentationPtr(env, jValue);
if (!value) return;
rep->setValue(key, *value);
}
else
{
rep->setNULL(key);
}
}
/*
......
......@@ -190,6 +190,12 @@ public class OcRepresentationTest extends InstrumentationTestCase {
public void testAttributeAccessByType() throws OcException {
OcRepresentation rep = new OcRepresentation();
//null
OcRepresentation repNull = null;
rep.setValue("nullKey", repNull);
OcRepresentation repNullActual = rep.getValue("nullKey");
assertNull(repNullActual);
//integer
String intK = "intK";
int intV = 4;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment