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

kwin pushed a commit to branch feature/SLING-8291_expose-error
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git

commit 2fe294dc2bd80e3778d716c785c324da4872301d
Author: Konrad Windszus <[email protected]>
AuthorDate: Mon Feb 25 13:38:09 2019 +0100

    SLING-8291 expose error message as well for existing bundle which is not
    yet in INSTALLED state
---
 pom.xml                                                           | 2 +-
 .../sling/installer/provider/installhook/OsgiInstallerHook.java   | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4b62962..ac7d8fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,7 +90,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.installer.core</artifactId>
-            <version>3.6.8</version>
+            <version>3.8.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git 
a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
 
b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
index 6ca0eec..92d0a7b 100644
--- 
a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
+++ 
b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
@@ -20,6 +20,7 @@ package org.apache.sling.installer.provider.installhook;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Dictionary;
@@ -267,7 +268,12 @@ public class OsgiInstallerHook implements InstallHook {
                                 + currentlyActiveBundleVersion + " that 
matches " + bundle.version + " as provided in package");
                     }
                 } else {
-                    logger.log("Bundle " + bundle.symbolicName + " is not in 
state INSTALLED but in " + resource.getState());
+                    String msg = MessageFormat.format("Bundle {0} is not in 
state INSTALLED but in {1}", bundle.symbolicName, resource.getState());
+                    if (StringUtils.isNotEmpty(resource.getError())) {
+                        // related error if there is some
+                        msg += " due to error '" + resource.getError() + "'";
+                    }
+                    logger.log(msg);
                     needsInstallation = true;
                 }
 

Reply via email to