Simplify if statements where it makes sense

Change-Id: Id04ede6b8aa8fa3ca8c02b8c32ad5f4745ef47f4
Issue-ID: SO-437
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index 20535e9..da526ae 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -1106,11 +1106,8 @@
         }
 
         public boolean isExpired () {
-            if (expires == null) {
-                return true;
-            }
+            return expires == null || System.currentTimeMillis() > expires.getTimeInMillis();
 
-            return System.currentTimeMillis() > expires.getTimeInMillis();
         }
     }
 
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
index be36d67..714684a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
@@ -567,11 +567,8 @@
         }
 
         public boolean isExpired () {
-            if (expires == null) {
-                return true;
-            }
+            return expires == null || System.currentTimeMillis() > expires.getTimeInMillis();
 
-            return System.currentTimeMillis() > expires.getTimeInMillis();
         }
     }
 
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
index 50a5946..c65a715 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
@@ -559,11 +559,7 @@
 		}
 
 		public boolean isExpired() {
-			if (expires == null) {
-                return true;
-            }
-
-            return System.currentTimeMillis() > expires.getTimeInMillis();
+			return expires == null || System.currentTimeMillis() > expires.getTimeInMillis();
 		}
 	}
 
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index 27c3c2b..7d45c4b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -252,15 +252,12 @@
         }
 
         RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
-        if(this.reqVersion >= 3){
-	        if(requestParameters!=null){
-	        	this.aLaCarteFlag = sir.getRequestDetails().getRequestParameters().isaLaCarte();
-	        }else{
-	        	this.aLaCarteFlag = false;
-	        }
-        }else{
-        	this.aLaCarteFlag = true;
-        }
+		if (this.reqVersion >= 3) {
+			this.aLaCarteFlag =
+				requestParameters != null && sir.getRequestDetails().getRequestParameters().isaLaCarte();
+		} else {
+			this.aLaCarteFlag = true;
+		}
 
 		if(requestParameters != null && (reqVersion < 3) && requestParameters.getAutoBuildVfModules()){
     		throw new ValidationException("AutoBuildVfModule", version);
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java
index 564fd5a..e42f734 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java
@@ -51,29 +51,32 @@
 	 *
 	 */
 	public boolean isMoreRecentThan (String versionToCompare) {
-		if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null || this.version.trim().equals("")) {
+		if (versionToCompare == null || versionToCompare.trim().isEmpty() || this.version == null || this.version.trim().isEmpty()) {
 			return false;
 		}
-		String [] currentVersionArray = this.version.split("\\.");
-		String [] specifiedVersionArray = versionToCompare.split("\\.");
+		String[] currentVersionArray = this.version.split("\\.");
+		String[] specifiedVersionArray = versionToCompare.split("\\.");
 
-        int smalestStringLength = Math.min(currentVersionArray.length, specifiedVersionArray.length);
+		int smalestStringLength = Math.min(currentVersionArray.length, specifiedVersionArray.length);
 
-		for (int currentVersionIndex=0;currentVersionIndex < smalestStringLength;++currentVersionIndex) {
+		for (int currentVersionIndex = 0; currentVersionIndex < smalestStringLength; ++currentVersionIndex) {
 
-			if (Integer.parseInt(currentVersionArray[currentVersionIndex]) < Integer.parseInt(specifiedVersionArray[currentVersionIndex])) {
+			if (Integer.parseInt(currentVersionArray[currentVersionIndex]) < Integer
+				.parseInt(specifiedVersionArray[currentVersionIndex])) {
 				return false;
-			} else if (Integer.parseInt(currentVersionArray[currentVersionIndex]) > Integer.parseInt(specifiedVersionArray[currentVersionIndex])) {
+			} else if (Integer.parseInt(currentVersionArray[currentVersionIndex]) > Integer
+				.parseInt(specifiedVersionArray[currentVersionIndex])) {
 				return true;
 			}
 		}
-
-		// Even if versionToCompare has more digits, it means versionToCompare is more recent
-		if (Integer.parseInt(currentVersionArray[smalestStringLength-1]) == Integer.parseInt(specifiedVersionArray[smalestStringLength-1])) {
-		    return currentVersionArray.length > specifiedVersionArray.length;
+		try {
+			// Even if versionToCompare has more digits, it means versionToCompare is more recent
+			return Integer.parseInt(currentVersionArray[smalestStringLength - 1]) != Integer
+				.parseInt(specifiedVersionArray[smalestStringLength - 1])
+				|| currentVersionArray.length > specifiedVersionArray.length;
+		} catch (NumberFormatException e) {
+			return false;
 		}
-
-		return true;
 	}
 
 	/**