Author: abroekhuis
Date: Mon Jul 11 10:11:20 2011
New Revision: 1145107
URL: http://svn.apache.org/viewvc?rev=1145107&view=rev
Log:
#CELIX-9: Pushed a patch so Celix doesn't crash if the manifest file is empty.
Some error message is being print, but with more updates regarding error
handling and APR this will improve over time.
Modified:
incubator/celix/trunk/framework/private/src/bundle.c
incubator/celix/trunk/framework/private/src/bundle_archive.c
incubator/celix/trunk/framework/private/src/framework.c
incubator/celix/trunk/framework/private/src/manifest.c
incubator/celix/trunk/launcher/launcher.c
Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1145107&r1=1145106&r2=1145107&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Mon Jul 11 10:11:20
2011
@@ -211,7 +211,9 @@ MODULE bundle_createModule(BUNDLE bundle
}
void startBundle(BUNDLE bundle, int options) {
- fw_startBundle(bundle->framework, bundle, options);
+ if (bundle != NULL) {
+ fw_startBundle(bundle->framework, bundle, options);
+ }
}
celix_status_t bundle_update(BUNDLE bundle, char *inputFile) {
Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1145107&r1=1145106&r2=1145107&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Mon Jul 11
10:11:20 2011
@@ -532,8 +532,6 @@ void bundleArchive_deleteTree(char * dir
}
apr_finfo_t dp;
while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) ==
APR_SUCCESS) {
- printf("Stat: %d\n", stat);
- printf("File: %s\n", dp.name);
if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..")
!= 0)) {
char subdir[strlen(directory) + strlen(dp.name) + 2];
strcpy(subdir, directory);
Modified: incubator/celix/trunk/framework/private/src/framework.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1145107&r1=1145106&r2=1145107&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Mon Jul 11 10:11:20
2011
@@ -389,7 +389,7 @@ celix_status_t fw_installBundle2(FRAMEWO
if (status == CELIX_SUCCESS) {
hashMap_put(framework->installedBundleMap, location, *bundle);
} else {
- printf("Unable to install bundle\n");
+ printf("Unable to install bundle: %s\n", location);
bundleArchive_closeAndDelete(bundle_archive);
apr_pool_destroy(bundlePool);
}
Modified: incubator/celix/trunk/framework/private/src/manifest.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1145107&r1=1145106&r2=1145107&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Mon Jul 11 10:11:20
2011
@@ -126,6 +126,9 @@ celix_status_t manifest_read(char *filen
fclose(file);
*manifest = mf;
+ } else {
+ printf("Could not read manifest file.\n");
+ status = CELIX_FILE_IO_EXCEPTION;
}
} else {
status = CELIX_ENOMEM;
Modified: incubator/celix/trunk/launcher/launcher.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/launcher/launcher.c?rev=1145107&r1=1145106&r2=1145107&view=diff
==============================================================================
--- incubator/celix/trunk/launcher/launcher.c (original)
+++ incubator/celix/trunk/launcher/launcher.c Mon Jul 11 10:11:20 2011
@@ -80,8 +80,14 @@ int main(void) {
while (linkedListIterator_hasNext(iter)) {
BUNDLE current = NULL;
char * location = linkedListIterator_next(iter);
- bundleContext_installBundle(context, location, ¤t);
- arrayList_add(installed, current);
+ if (bundleContext_installBundle(context, location, ¤t) ==
CELIX_SUCCESS) {
+ // Only add bundle if it is installed correctly
+ arrayList_add(installed, current);
+ } else {
+ char error[256];
+ sprintf(error, "Could not install bundle from %s", location);
+ celix_log(error);
+ }
linkedListIterator_remove(iter);
}
linkedListIterator_destroy(iter);