Fix all bugs reported by Sonar in policy/engine 45/36245/2
authoreramkve <ram.krishna.verma@ericsson.com>
Fri, 16 Mar 2018 15:44:07 +0000 (15:44 +0000)
committereramkve <ram.krishna.verma@ericsson.com>
Tue, 20 Mar 2018 15:28:04 +0000 (15:28 +0000)
Code fixes for 27 bugs reported by Sonar in policy/engine

Change-Id: I96da96b38a2e2954ec549e5cdf6ed3ad1d76722c
Issue-ID: POLICY-662
Signed-off-by: eramkve <ram.krishna.verma@ericsson.com>
15 files changed:
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/Policy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/getDictionaryTest.java
ONAP-PDP/src/main/java/org/onap/policy/xacml/action/FindAction.java
ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java

index 8e9c4b6..7c05a31 100644 (file)
@@ -70,27 +70,16 @@ public class ClosedLoopPolicy extends Policy {
        
        //save configuration of the policy based on the policyname
        private void saveConfigurations(String policyName, String jsonBody) {
-               try {
+           
+               if(policyName.endsWith(".xml")){
+                   policyName = policyName.replace(".xml", "");
+               }
+               try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+ policyName +".json")){
                        String body = jsonBody;
-                       try {
-                               try{
-                                       //Remove the trapMaxAge in Verification Signature
-                                       body = body.replace(",\"trapMaxAge\":null", "");
-                               }catch(Exception e){
-                                       LOGGER.debug("No Trap Max Age in JSON body", e);
-                               }
-                               this.policyAdapter.setJsonBody(body);
-                       } catch (Exception e) {
-                               LOGGER.error("Exception Occured"+e);
-                       }
-
-                       if(policyName.endsWith(".xml")){
-                               policyName = policyName.replace(".xml", "");
-                       }
-                       PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+ policyName +".json");
+                       //Remove the trapMaxAge in Verification Signature
+                       body = body.replace(",\"trapMaxAge\":null", "");
+                       this.policyAdapter.setJsonBody(body);
                        out.println(body);
-                       out.close();
-
                } catch (Exception e) {
                        LOGGER.error("Exception Occured while writing Configuration Data"+e);
                } 
index adcffe9..48eb784 100644 (file)
@@ -80,17 +80,24 @@ public class ConfigPolicy extends Policy {
        
        // Saving the Configurations file at server location for config policy.
        protected void saveConfigurations(String policyName) {
+               BufferedWriter bw = null;
                try {
                        String fileName = getConfigFile(policyName);
-                       FileWriter fw = new FileWriter(CONFIG_HOME + File.separator + fileName);
-                       BufferedWriter bw = new BufferedWriter(fw);
+                       bw = new BufferedWriter(new FileWriter(CONFIG_HOME + File.separator + fileName));
                        bw.write(configBodyData);
-                       bw.close();
                        if (LOGGER.isDebugEnabled()) {
-                               LOGGER.debug("Configuration is succesfully saved");
+                           LOGGER.debug("Configuration is succesfully saved");
                        }
                } catch (IOException e) {
                        LOGGER.error("Exception Occured while writing Configuration Data"+e);
+               } finally {
+                   if(bw != null){
+                    try {
+                        bw.close();
+                    } catch (Exception e) {
+                        LOGGER.error("Exception Occured while closing the BufferedWriter"+e);
+                    }
+               }
                }
        }
 
index a6240e0..0bac0e0 100644 (file)
@@ -72,15 +72,13 @@ public class CreateBrmsRawPolicy extends Policy {
 
        // Saving the Configurations file at server location for CreateBrmsRawPolicy policy.
        protected void saveConfigurations(String policyName, String jsonBody) {         
-               try {
-                       if (policyName.endsWith(".xml")) {
-                               policyName = policyName.substring(0,
-                                               policyName.lastIndexOf(".xml"));
-                       }
-                       PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt");
+           
+               if (policyName.endsWith(".xml")) {
+                   policyName = policyName.substring(0,
+                               policyName.lastIndexOf(".xml"));
+               }
+               try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")){
                        out.println(jsonBody);
-                       out.close();
-
                } catch (Exception e) {
                        PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file");
                }
index 68cc9ef..456924a 100644 (file)
@@ -67,23 +67,15 @@ public class CreateClosedLoopPerformanceMetrics extends Policy {
        }
 
        //save configuration of the policy based on the policyname
-       private void saveConfigurations(String policyName, String jsonBody) {
-               try {
-                       String body = null;
-                       try {
-                               body = jsonBody;
-                       } catch (Exception e) {
-                               LOGGER.error("Exception Occured"+e);
-                       }
-                       if(policyName.endsWith(".xml")){
-                               policyName       = policyName.substring(0, policyName.lastIndexOf(".xml"));     
-                       }
-                       PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + "."+ policyName +".json");
-                       out.println(body);
-                       policyAdapter.setJsonBody(body);
-                       policyAdapter.setConfigBodyData(body);
-                       out.close();
-
+       private void saveConfigurations(String policyName, final String jsonBody) {
+           
+               if(policyName.endsWith(".xml")){
+                   policyName   = policyName.substring(0, policyName.lastIndexOf(".xml"));
+               }
+               try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + "."+ policyName +".json")){
+                       out.println(jsonBody);
+                       policyAdapter.setJsonBody(jsonBody);
+                       policyAdapter.setConfigBodyData(jsonBody);
                } catch (Exception e) {
                        LOGGER.error("Exception Occured"+e);
                }
index 6e46ab1..e747edb 100644 (file)
@@ -1265,16 +1265,11 @@ public class FirewallConfigPolicy extends Policy {
        }
 
        private JsonObject stringToJson(String jsonString) {
-               JsonObject json = null;
-               if (jsonString != null) {
-                       //Read jsonBody to JsonObject
-                       StringReader in = null;
-                       in = new StringReader(jsonString);
-
-                       JsonReader jsonReader = Json.createReader(in);
-                       json = jsonReader.readObject();
-                       jsonReader.close();
-               }
+               //Read jsonBody to JsonObject
+               StringReader in = new StringReader(jsonString);
+               JsonReader jsonReader = Json.createReader(in);
+               JsonObject json = jsonReader.readObject();
+               jsonReader.close();
                return json;
        }
 
index b0e48a7..e021211 100644 (file)
@@ -88,13 +88,11 @@ public class MicroServiceConfigPolicy extends Policy {
 
        //save configuration of the policy based on the policyname
        private void saveConfigurations(String policyName, String jsonBody) {
-               try {
-                       if(policyName.endsWith(".xml")){
-                               policyName = policyName.replace(".xml", "");
-                       }
-                       PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json");
+               if(policyName.endsWith(".xml")){
+                   policyName = policyName.replace(".xml", "");
+               }
+               try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json")){
                        out.println(jsonBody);
-                       out.close();
                } catch (Exception e) {
                        LOGGER.error("Exception Occured While writing Configuration data"+e);
                } 
index 20c76f3..2196209 100644 (file)
@@ -108,7 +108,6 @@ public abstract class Policy {
        public static final String URI_DATATYPE = "http://www.w3.org/2001/XMLSchema#anyURI";
        public static final String RULE_VARIABLE = "var:";
        public static final String EMPTY_STRING = "";
-       private static final String String = null;
 
        protected static String CONFIG_HOME = null;
        protected static String ACTION_HOME = null;
index 71eb115..9ac8582 100644 (file)
@@ -479,11 +479,14 @@ public class PolicyDBDao {
                        HttpURLConnection connection = null;
                        UUID requestID = UUID.randomUUID();
                        URL url;
+                       String papUrl;
                        try {
-                               String papUrl = getPapUrlUserPass()[0];
-                               if(papUrl == null){
-                                       papUrl = "undefined";
-                               }
+                               String[] papUrlUserPass = getPapUrlUserPass();
+                               if(papUrlUserPass == null ){
+                                   papUrl = "undefined";
+                               } else {
+                                   papUrl = papUrlUserPass[0];
+                               }
                                logger.debug("We are going to try to notify "+o);
                                //is this our own url?
                                String ourUrl = o;
@@ -1315,8 +1318,7 @@ public class PolicyDBDao {
        private String[] getNameScopeAndVersionFromPdpPolicy(String fileName){
                String[] splitByDots = fileName.split("\\.");
                if(splitByDots.length < 3){
-                       //should we throw something
-                       return null;
+                       return null;
                }
                String policyName = splitByDots[splitByDots.length-3];
                String version = splitByDots[splitByDots.length-2];
@@ -1365,10 +1367,7 @@ public class PolicyDBDao {
         */
        private static boolean isNullOrEmpty(String... strings){
                for(String s : strings){
-                       if(!(s instanceof String)){
-                               return true;
-                       }
-                       if("".equals(s)){
+                       if(s == null || "".equals(s)){
                                return true;
                        }
                }
@@ -1532,7 +1531,7 @@ public class PolicyDBDao {
                                        }
                                }
                        }
-                       if(transactionTimer instanceof Thread){
+                       if(transactionTimer != null){
                                transactionTimer.interrupt();
                        }
                }
@@ -1563,7 +1562,7 @@ public class PolicyDBDao {
                                }
 
                        }
-                       if(transactionTimer instanceof Thread){
+                       if(transactionTimer != null){
                                transactionTimer.interrupt();
                        }
                }
@@ -2042,7 +2041,7 @@ public class PolicyDBDao {
                                        }
                                        em.close();
                                }
-                               if(transactionTimer instanceof Thread){
+                               if(transactionTimer != null){
                                        transactionTimer.interrupt();
                                }
                        }
@@ -2544,7 +2543,10 @@ public class PolicyDBDao {
                                                                
                                //we need to convert the form of the policy id that is used groups into the form that is used 
                                //for the database. (com.Config_mypol.1.xml) to (Config_mypol.xml)
-                               String[] policyNameScopeAndVersion = getNameScopeAndVersionFromPdpPolicy(policyID);                     
+                               String[] policyNameScopeAndVersion = getNameScopeAndVersionFromPdpPolicy(policyID);
+                               if(policyNameScopeAndVersion == null) {
+                                   throw new IllegalArgumentException("Invalid input - policyID must contain name, scope and version");
+                               }
                                Query policyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName=:policyName AND p.scope=:scope AND p.deleted=:deleted");
                                policyQuery.setParameter("policyName", policyNameScopeAndVersion[0]);
                                policyQuery.setParameter(scope, policyNameScopeAndVersion[1]);                  
index 1079835..397904f 100644 (file)
@@ -161,10 +161,8 @@ public class PushPolicyController {
                        return;
                }
                File temp = new File(policyName);
-               try {
-                       BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
+               try (BufferedWriter bw = new BufferedWriter(new FileWriter(temp))){
                        bw.write(policyEntity.getPolicyData());
-                       bw.close();
                        URI selectedURI = temp.toURI();
                        // Create the policy Object
                        selectedPolicy = new StdPDPPolicy(policyName, true, policyID, selectedURI);
index 5de0921..dcabefc 100644 (file)
@@ -115,6 +115,7 @@ public class ElasticSearchPolicyUpdate {
            
                Connection conn = null;
                Statement stmt = null;
+               ResultSet result = null;
                
                List<Index> listIndex = new ArrayList<>();
                
@@ -124,7 +125,7 @@ public class ElasticSearchPolicyUpdate {
                        stmt = conn.createStatement();
                        
                        String policyEntityQuery = "Select * from PolicyEntity";
-                       ResultSet result = stmt.executeQuery(policyEntityQuery);
+                       result = stmt.executeQuery(policyEntityQuery);
                        
                        while(result.next()){
                                StringBuilder policyDataString = new StringBuilder("{");
@@ -171,36 +172,10 @@ public class ElasticSearchPolicyUpdate {
                                
                                if(!"decision".equals(_type)){
                                        if(configurationdataid != null){
-                                               String configEntityQuery = "Select * from ConfigurationDataEntity where configurationDataId = ?";
-                                               PreparedStatement pstmt = null;
-                                               pstmt = conn.prepareStatement(configEntityQuery);
-                                           pstmt.setString(1, configurationdataid);
-                                               ResultSet configResult = pstmt.executeQuery();
-                                               while(configResult.next()){
-                                                       String configBody = configResult.getString("configbody");
-                                                       String configType = configResult.getString("configtype");
-                                                       if(configBody!=null){
-                                                               configBody = configBody.replace("null", "\"\"");
-                                                               configBody= configBody.replace("\"", "\\\"");
-                                                               policyDataString.append("\"jsonBodyData\":\""+configBody+"\",\"configType\":\""+configType+"\",");
-                                                       }
-                                               }
-                                               configResult.close();
+                                           updateConfigData(conn, configurationdataid, policyDataString);
                                        }
-                                       
                                        if(actionbodyid != null){
-                                               String actionEntityQuery = "Select * from ActionBodyEntity where actionBodyId = ?";
-                                               PreparedStatement pstmt = null;
-                                               pstmt = conn.prepareStatement(actionEntityQuery);
-                                           pstmt.setString(1, actionbodyid);
-                                               ResultSet actionResult = pstmt.executeQuery();
-                                               while(actionResult.next()){
-                                                       String actionBody = actionResult.getString("actionbody");
-                                                       actionBody = actionBody.replace("null", "\"\"");
-                                                       actionBody = actionBody.replace("\"", "\\\"");
-                                                       policyDataString.append("\"jsonBodyData\":\""+actionBody+"\",");
-                                               }
-                                               actionResult.close();
+                                           updateActionData(conn, actionbodyid, policyDataString);
                                        }       
                                }
                                
@@ -245,6 +220,20 @@ public class ElasticSearchPolicyUpdate {
                } catch (Exception e) {
                        LOGGER.error("Exception Occured while performing database Operation for Elastic Search Policy Upgrade"+e);
                }finally{
+                       if(result != null){
+                           try {
+                               result.close();
+                           } catch (Exception e) {
+                               LOGGER.error("Exception Occured while closing the resultset"+e);
+                           }
+                       }
+                       if(stmt != null){
+                           try {
+                               stmt.close();
+                           } catch (Exception e) {
+                               LOGGER.error("Exception Occured while closing the statement"+e);
+                           }
+                       }
                        if(conn != null){
                                try {
                                        conn.close();
@@ -315,4 +304,79 @@ public class ElasticSearchPolicyUpdate {
                return policyDataString.toString();
        }
        
+       private static void updateConfigData(Connection conn, String configurationdataid, StringBuilder policyDataString) throws Exception {
+
+               PreparedStatement pstmt = null;
+               ResultSet configResult = null;
+               try {
+                   String configEntityQuery = "Select * from ConfigurationDataEntity where configurationDataId = ?";
+                   pstmt = null;
+                   pstmt = conn.prepareStatement(configEntityQuery);
+                   pstmt.setString(1, configurationdataid);
+                   configResult = pstmt.executeQuery();
+                   while(configResult.next()){
+                       String configBody = configResult.getString("configbody");
+                       String configType = configResult.getString("configtype");
+                       if(configBody!=null){
+                           configBody = configBody.replace("null", "\"\"");
+                           configBody= configBody.replace("\"", "\\\"");
+                           policyDataString.append("\"jsonBodyData\":\""+configBody+"\",\"configType\":\""+configType+"\",");
+                       }
+                   }
+               } catch(Exception e) {
+                   LOGGER.error("Exception Occured while updating configData"+e);
+                   throw(e);
+               } finally {
+                   if(configResult != null){
+                       try {
+                           configResult.close();
+                       } catch (Exception e) {
+                           LOGGER.error("Exception Occured while closing the ResultSet"+e);
+                       }
+                   }
+                   if(pstmt != null){
+                       try {
+                           pstmt.close();
+                       } catch (Exception e) {
+                           LOGGER.error("Exception Occured while closing the PreparedStatement"+e);
+                       }
+                   }
+              }
+       }
+       
+       private static void updateActionData(Connection conn, String actionbodyid, StringBuilder policyDataString) throws Exception {
+
+            PreparedStatement pstmt = null;
+            ResultSet actionResult = null;
+            try {
+                String actionEntityQuery = "Select * from ActionBodyEntity where actionBodyId = ?";
+                pstmt = conn.prepareStatement(actionEntityQuery);
+                pstmt.setString(1, actionbodyid);
+                actionResult = pstmt.executeQuery();
+                while(actionResult.next()){
+                    String actionBody = actionResult.getString("actionbody");
+                    actionBody = actionBody.replace("null", "\"\"");
+                    actionBody = actionBody.replace("\"", "\\\"");
+                    policyDataString.append("\"jsonBodyData\":\""+actionBody+"\",");
+                }
+            } catch(Exception e) {
+                LOGGER.error("Exception Occured while updating actionData"+e);
+                throw(e);
+            } finally {
+                if(actionResult != null){
+                    try {
+                        actionResult.close();
+                    } catch (Exception e) {
+                        LOGGER.error("Exception Occured while closing the ResultSet"+e);
+                    }
+                }
+                if(pstmt != null){
+                    try {
+                        pstmt.close();
+                    } catch (Exception e) {
+                        LOGGER.error("Exception Occured while closing the PreparedStatement"+e);
+                    }
+                }
+           }
+       }
 }
\ No newline at end of file
index d3628f3..9b86204 100644 (file)
@@ -247,7 +247,7 @@ public class GetDictionaryService {
             jsonString = jsonString.replace("microServiceDictionaryDatas", "DictionaryDatas");
             break;
         default:
-            return null;
+            break;
         }
         return jsonString;
     }
index 8258aba..af7112e 100644 (file)
@@ -341,12 +341,13 @@ public class PDPServices {
             pdpConfigLocation = pdpConfigLocation.replace("/", File.separator);
         }
         InputStream inputStream = null;
+        JsonReader jsonReader = null;
         try {
             inputStream = new FileInputStream(new File(pdpConfigLocation));
             try {
                 if (pdpConfigLocation.endsWith("json")) {
                     pdpResponse.setType(PolicyType.JSON);
-                    JsonReader jsonReader = Json.createReader(inputStream);
+                    jsonReader = Json.createReader(inputStream);
                     pdpResponse.setConfig(jsonReader.readObject().toString());
                     jsonReader.close();
                 } else if (pdpConfigLocation.endsWith("xml")) {
@@ -400,6 +401,14 @@ public class PDPServices {
                 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
                 throw new PDPException(XACMLErrorConstants.ERROR_PROCESS_FLOW +
                         "Cannot open a connection to the configURL", e);
+            } finally {
+                if(jsonReader != null) {
+                    try {
+                        jsonReader.close();
+                    } catch (Exception e) {
+                        LOGGER.error("Exception Occured while closing the JsonReader"+e);
+                    }
+                }
             }
         } catch (FileNotFoundException e) {
             LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
index e18f8bb..38dafee 100644 (file)
@@ -41,7 +41,7 @@ public class getDictionaryTest {
                dp.setDictionary("test");
                GetDictionaryService gds = new GetDictionaryService(dp, null);
                String result = (String) formatDictionary.invoke(gds, input);
-               assertNull(result);
+               assertNotNull(result);
                //
                dp.setDictionary("OnapName");
                gds = new GetDictionaryService(dp, null);
index c6a8898..5fde0ad 100644 (file)
@@ -240,6 +240,7 @@ public class FindAction {
                Pattern pattern = Pattern.compile("\\$([a-zA-Z0-9.:]*)");
                Matcher match = pattern.matcher(configURL);
                StringBuffer sb = new StringBuffer();
+               JsonReader jsonReader = null;
                while (match.find()) {
                        LOGGER.info("Found Macro : " + match.group(1));
                        String replaceValue = matchValues.get(match.group(1));
@@ -292,7 +293,7 @@ public class FindAction {
                                connection = configURL.openConnection();
                                // InputStream in = connection.getInputStrem();
                                // LOGGER.info("The Body Content is : " + IOUtils.toString(in));
-                               JsonReader jsonReader = Json.createReader(connection.getInputStream());
+                               jsonReader = Json.createReader(connection.getInputStream());
                                StringEntity input = new StringEntity(jsonReader.readObject().toString());
                                input.setContentType("application/json");
                                postRequest.setEntity(input);
@@ -312,6 +313,13 @@ public class FindAction {
                                LOGGER.error(e.getMessage() +e);
                                response = e.getMessage();
                        } finally {
+                               if(jsonReader != null) {
+                                   try {
+                                       jsonReader.close();
+                                   } catch (Exception e) {
+                                       LOGGER.error("Exception Occured while closing the JsonReader"+e);
+                                   }
+                               }
                                httpClient.getConnectionManager().shutdown();
                        }
                } else if(matchValues.get("method").equalsIgnoreCase("PUT")) {
@@ -330,7 +338,7 @@ public class FindAction {
                                connection = configURL.openConnection();
                                //InputStream in = connection.getInputStream();
                                //LOGGER.info("The Body Content is : " + IOUtils.toString(in));
-                               JsonReader jsonReader = Json.createReader(connection.getInputStream());
+                               jsonReader = Json.createReader(connection.getInputStream());
                                StringEntity input = new StringEntity(jsonReader.readObject().toString());
                                input.setContentType("application/json");
                                putRequest.setEntity(input);
@@ -349,6 +357,13 @@ public class FindAction {
                                LOGGER.error(e.getMessage() +e);
                                response = e.getMessage();
                        }finally {
+                               if(jsonReader != null) {
+                                   try {
+                                       jsonReader.close();
+                                   } catch (Exception e) {
+                                       LOGGER.error("Exception Occured while closing the JsonReader"+e);
+                                   }
+                               }
                                httpClient.getConnectionManager().shutdown();
                        }
                }
index ca2271a..d3dc7ae 100644 (file)
@@ -180,18 +180,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                // We don't have the default group, create it
                //
                String defaultId = properties.getProperty(PROP_PAP_GROUPS_DEFAULT, PROP_PAP_GROUPS_DEFAULT_NAME);
-               if(defaultId == null){
-                       defaultId = PROP_PAP_GROUPS_DEFAULT_NAME;
-               }
-               if("".equals(defaultId)){
-                       defaultId = PROP_PAP_GROUPS_DEFAULT_NAME;
-               }
-               //we're going to check one more time in case the PROP_PAP_GROUPS_DEFAULT_NAME doesn't exist
-               if(defaultId == null){
-                       defaultId = "default";
-               }
                if("".equals(defaultId)){
-                       defaultId = "default";
+                  defaultId = PROP_PAP_GROUPS_DEFAULT_NAME;
                }
                logger.warn("Default group does NOT exist, creating " + defaultId);
                Path defaultPath = Paths.get(this.repository.toString(), defaultId);