Alexander Wels has uploaded a new change for review.

Change subject: userportal,webadmin: BrandingManager fails with missing etcdir
......................................................................

userportal,webadmin: BrandingManager fails with missing etcdir

- BrandingManager.getInstance() would fail when you have a missing
etcDir configuration which is often the case in unit tests. This
patch stops the failure and instead returns no branding information.

Change-Id: Ifc34286323c1eda114f6a8b5570274faf53b566c
Signed-off-by: Alexander Wels <[email protected]>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/branding/BrandingManager.java
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/16046/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/branding/BrandingManager.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/branding/BrandingManager.java
index d6e3bde..7b5a992 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/branding/BrandingManager.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/branding/BrandingManager.java
@@ -68,8 +68,17 @@
         /**
          * Instance of the BrandingManager.
          */
-        static final BrandingManager instance =
-                new 
BrandingManager(EngineLocalConfig.getInstance().getEtcDir());
+        static final BrandingManager instance;
+
+        static {
+            File etcDir;
+            try {
+                etcDir = EngineLocalConfig.getInstance().getEtcDir();
+            } catch (IllegalArgumentException iae) {
+                etcDir = new File(""); //Can't find etcDir, most likely unit 
tests, pretend there is no branding.
+            }
+            instance = new BrandingManager(etcDir);
+        }
     }
 
     /**


-- 
To view, visit http://gerrit.ovirt.org/16046
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc34286323c1eda114f6a8b5570274faf53b566c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to