Arik Hadas has uploaded a new change for review.

Change subject: core: cleanup: inline local fields
......................................................................

core: cleanup: inline local fields

Inline local fields in VdsHandler#handleVdsResult and
VdsHandler#getOvirtHostOsVersion methods to make them more readable.

Change-Id: I8c2fe8b2cdea39f5a12c4079b1ea9f3dc511947f
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
1 file changed, 5 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/16831/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
index 3be4348..c081cd6 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
@@ -81,9 +81,8 @@
      * @return a version class of the oVirt OS version, or null if failed to 
parse.
      */
     static public RpmVersion getOvirtHostOsVersion(VDS vds) {
-        RpmVersion vdsOsVersion = null;
         try {
-            vdsOsVersion = new RpmVersion(vds.getHostOs(), "RHEV Hypervisor 
-", true);
+            return new RpmVersion(vds.getHostOs(), "RHEV Hypervisor -", true);
         } catch (RuntimeException e) {
             log.errorFormat("Failed to parse version of Host {0},{1} and Host 
OS '{2}' with error {3}",
                     vds.getId(),
@@ -91,7 +90,7 @@
                     vds.getHostOs(),
                     ExceptionUtils.getMessage(e));
         }
-        return vdsOsVersion;
+        return null;
     }
 
     /**
@@ -120,13 +119,9 @@
      */
     public static VDSReturnValue handleVdsResult(VDSReturnValue result) {
         if (StringUtils.isNotEmpty(result.getExceptionString())) {
-            VdcBLLException exp;
-            if (result.getVdsError() != null) {
-                exp = new VdcBLLException(result.getVdsError().getCode(), 
result.getExceptionString());
-            } else {
-                exp = new VdcBLLException(VdcBllErrors.ENGINE, 
result.getExceptionString());
-            }
-            throw exp;
+            throw new VdcBLLException(
+                    result.getVdsError() != null ? 
result.getVdsError().getCode() : VdcBllErrors.ENGINE,
+                    result.getExceptionString());
         }
         return result;
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c2fe8b2cdea39f5a12c4079b1ea9f3dc511947f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to