X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=BRMSGateway%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2FbrmsInterface%2FBRMSPush.java;h=c923c3c34f87b67047473e8268ac27dbd9105bb2;hb=dc35b06ecbff453135aa9c1a557e55995f3e9020;hp=f6f7c12149d6059f313524d40af631066546a8da;hpb=6f2b3f2dd0e80895acd0f77aa5784e717be33696;p=policy%2Fengine.git diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java index f6f7c1214..c923c3c34 100644 --- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java +++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java @@ -137,6 +137,9 @@ public class BRMSPush { private boolean syncFlag = false; public BRMSPush(String propertiesFile, BackUpHandler handler) throws PolicyException { + if(propertiesFile==null || handler==null){ + throw new PolicyException("Error no propertiesFile or handler"); + } Properties config = new Properties(); Path file = Paths.get(propertiesFile); if (Files.notExists(file)) { @@ -185,7 +188,9 @@ public class BRMSPush { } catch (Exception e) { LOGGER.error("Error starting BackUpMonitor: " + e); } - config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceBRMS.xml"); + if(!config.containsKey(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML)){ + config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceBRMS.xml"); + } EntityManagerFactory emf = Persistence.createEntityManagerFactory("BRMSGW", config); em = emf.createEntityManager(); defaultName = config.getProperty("defaultName"); @@ -626,6 +631,9 @@ public class BRMSPush { // Additional Check due to Limitations from Nexus API to check if the artifact is the latest. private NexusArtifact additionalNexusLatestCheck(String selectedName, NexusArtifact result) { + if(result==null){ + return result; + } String nextVersion = incrementVersion(result.getVersion()); List artifact = getArtifactFromNexus(selectedName, nextVersion); return artifact.isEmpty() ? result : additionalNexusLatestCheck(selectedName, artifact.get(0)); @@ -1011,6 +1019,10 @@ public class BRMSPush { private void readGroups(Properties config) throws PolicyException { String[] groupNames = null; + if (!config.containsKey("groupNames") || config.getProperty("groupNames")==null){ + throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + + "groupNames property is missing or empty from the property file "); + } if (config.getProperty("groupNames").contains(",")) { groupNames = config.getProperty("groupNames").replaceAll(" ", "").split(","); } else {