aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java5
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java5
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java15
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java29
5 files changed, 25 insertions, 35 deletions
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 9fe2d4c786..46cfbf1bb8 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 class MsoHeatUtils extends MsoCommonUtils {
}
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 be36d67e0b..714684aba6 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 class MsoKeystoneUtils extends MsoTenantUtils {
}
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 50a594663e..c65a715b66 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 class MsoNeutronUtils extends MsoCommonUtils
}
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 ad76a15b8e..79ac76ff04 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 @@ public class MsoRequest {
}
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 564fd5a019..e42f734a64 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 class MavenLikeVersioning implements Serializable {
*
*/
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;
}
/**