#include "JNIEnvWrapper.h"
#include "Log.h"
#include "Verify.h"
+#include <dlfcn.h>
#include "ResourceContainerBundleAPI.h"
#include "JniBundleResource.h"
{
LOGD("nativeStartContainer");
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
+
EXPECT(configFileObj, "ConfigFile is null.");
auto configFile = toStdString(env, configFileObj);
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeStopContainer
-(JNIEnv *env, jobject)
+Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeStopContainer(JNIEnv *env, jobject)
{
LOGD("nativeStopContainers");
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
+
RCSResourceContainer::getInstance()->stopContainer();
}
{
LOGD("nativeAddBundle");
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
+
EXPECT(idObj, "BundleId is null.");
EXPECT(pathObj, "BundlePath is null.");
EXPECT(activatorObj, "Activator is null.");
{
LOGD("nativeRemoveBundle");
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
+
EXPECT(idObj, "BundleId is null.");
auto id = toStdString(env, idObj);
{
LOGD("nativeListBundles");
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
+
JNIEnvWrapper envWrapper(env);
try
Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeStartBundle
(JNIEnv *env, jobject, jstring idObj)
{
- LOGD("nativeStartBundle2");
+ LOGD("nativeStartBundle");
+
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
EXPECT(idObj, "BundleId is null.");
{
LOGD("nativeStopBundle");
+ // A strange error message happens if the container is used as native library on Android
+ // and further native libraries are loaded at runtime.
+ const char *error;
+ if ((error = dlerror()) != NULL)
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer",
+ "dlerror: %s.", error);
+ }
+
EXPECT(idObj, "BundleId is null.");
auto id = env->GetStringUTFChars(idObj, NULL);
JNIEnvWrapper envWrapper(env);
LOGD("nativeRegisterJniBundleResource");
auto str_bundle_id = toStdString(&envWrapper, bundleId);
- __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved bundle id: %s.", str_bundle_id.c_str());
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved bundle id: %s.",
+ str_bundle_id.c_str());
auto str_uri = toStdString(&envWrapper, uri);
- __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved uri: %s.", str_uri.c_str());
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved uri: %s.",
+ str_uri.c_str());
auto str_resourceType = toStdString(&envWrapper, resourceType);
- __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved resource type: %s.", str_resourceType.c_str());
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved resource type: %s.",
+ str_resourceType.c_str());
auto str_res_name = toStdString(&envWrapper, res_name);
LOGD("retrieved res name.");
JniBundleResource res;