This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/refactor_bundle_cache
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/feature/refactor_bundle_cache 
by this push:
     new e55ea9cf Avoid `celix_bundle_getEntry` for bundles without 
"X-Web-Resource" manifest attribute.
e55ea9cf is described below

commit e55ea9cfb9520db391282a52737f3520669c0903
Author: PengZheng <[email protected]>
AuthorDate: Wed Feb 22 12:28:39 2023 +0800

    Avoid `celix_bundle_getEntry` for bundles without "X-Web-Resource" manifest 
attribute.
---
 bundles/http_admin/http_admin/src/http_admin.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/bundles/http_admin/http_admin/src/http_admin.c 
b/bundles/http_admin/http_admin/src/http_admin.c
index 3c7ff654..d8ec300a 100755
--- a/bundles/http_admin/http_admin/src/http_admin.c
+++ b/bundles/http_admin/http_admin/src/http_admin.c
@@ -476,11 +476,16 @@ void http_admin_startBundle(void *data, const 
celix_bundle_t *bundle) {
     http_admin_manager_t *admin = data;
     long bndId = celix_bundle_getId(bundle);
     const char* aliases = celix_bundle_getManifestValue(bundle, 
"X-Web-Resource");
+    if (aliases == NULL) {
+        celix_bundleContext_log(admin->context, CELIX_LOG_LEVEL_TRACE, "No 
aliases found for bundle %s",
+                                celix_bundle_getSymbolicName(bundle));
+        return;
+    }
     char* bundleRoot = celix_bundle_getEntry(bundle, "");
-    if (aliases != NULL && bundleRoot != NULL) {
+    if (bundleRoot != NULL) {
         createAliasesSymlink(aliases, admin->root, bundleRoot, bndId, 
admin->aliasList);
-    } else if (aliases == NULL) {
-        celix_bundleContext_log(admin->context, CELIX_LOG_LEVEL_TRACE, "No 
aliases found for bundle %s",
+    } else {
+        celix_bundleContext_log(admin->context, CELIX_LOG_LEVEL_ERROR, "No 
root for bundle %s",
                                 celix_bundle_getSymbolicName(bundle));
     }
     free(bundleRoot);

Reply via email to