Refine aafcli for Tests
[aaf/authz.git] / cadi / core / src / main / java / org / onap / aaf / cadi / config / Config.java
index d7c7526..7c897e3 100644 (file)
@@ -532,7 +532,11 @@ public class Config {
                                        access.log(Level.INIT,"AAF/OAuth LUR plugin is not available.");
                                }
                        } catch (NoSuchMethodException| SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-                               access.log(e,"AAF/OAuth LUR could not be constructed with given Constructors.");
+                               String msg = e.getMessage();
+                               if(msg==null && e.getCause()!=null) {
+                                       msg = e.getCause().getMessage();
+                               }
+                               access.log(Level.INIT,"AAF/OAuth LUR is not instantiated.",msg);
                        } 
                } else {
                        access.log(Level.INIT, "OAuth2 Lur disabled");
@@ -716,7 +720,12 @@ public class Config {
                        String url = _url, replacement;
                        int idxAAF_LOCATE_URL;
                        if((idxAAF_LOCATE_URL=_url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) {
-                               url = replacement + "/locate" + _url.substring(idxAAF_LOCATE_URL+AAF_LOCATE_URL_TAG.length());
+                               StringBuilder sb = new StringBuilder(replacement);
+                               if(!replacement.endsWith("/locate")) {
+                                       sb.append("/locate");
+                               } 
+                               sb.append(_url,idxAAF_LOCATE_URL+AAF_LOCATE_URL_TAG.length(),_url.length());
+                               url = sb.toString();
                        }
        
                        try {