Updates for DirectLocator
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / aaf / v2_0 / AbsAAFLocator.java
index 2405962..e43250a 100644 (file)
@@ -74,7 +74,12 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
                }
         try {
                aaf_locator_host = rph.replacements(getClass().getSimpleName(),"https://"+Config.AAF_LOCATE_URL_TAG,null,null);
-            aaf_locator_uri = new URI(aaf_locator_host);
+               if(aaf_locator_host.endsWith("/locate")) {
+                aaf_locator_uri = new URI(aaf_locator_host);
+               } else {
+                       aaf_locator_uri = new URI(aaf_locator_host+"/locate");
+               }
+               
             access.printf(Level.INFO, "AbsAAFLocator AAF URI is %s",aaf_locator_uri);
         } catch (URISyntaxException e) {
             throw new LocatorException(e);
@@ -117,6 +122,9 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
     }
         
     public static Locator<URI> create(final String name, final String version) throws LocatorException {
+       if(locatorCreator==null) {
+               throw new LocatorException("LocatorCreator is not set");
+       }
         return locatorCreator.create(name, version);
     }
 
@@ -229,7 +237,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
     @Override
     public Item best() throws LocatorException {
         if (!hasItems()) {
-            throw new LocatorException("No Entries found for '" + aaf_locator_uri.toString() + "/locate/" + name + ':' + version + '\'');
+            throw new LocatorException("No Entries found for '" + aaf_locator_uri.toString() + '/' + name + ':' + version + '\'');
         }
         List<EP> lep = new ArrayList<>();
         EP first = null;