diff --git a/cadi/aaf/pom.xml b/cadi/aaf/pom.xml
index 5ce0529..25a2d02 100644
--- a/cadi/aaf/pom.xml
+++ b/cadi/aaf/pom.xml
@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>org.onap.aaf.authz</groupId>
 		<artifactId>cadiparent</artifactId>
-		<version>2.1.9-SNAPSHOT</version>
+		<version>2.1.10-SNAPSHOT</version>
 		<relativePath>..</relativePath>
 	</parent>
 
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
index 08ee900..30ea1c2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
@@ -47,6 +47,7 @@
 import org.onap.aaf.cadi.http.HClient;
 import org.onap.aaf.cadi.http.HX509SS;
 import org.onap.aaf.cadi.oauth.HRenewingTokenSS;
+import org.onap.aaf.cadi.util.FixURIinfo;
 import org.onap.aaf.misc.env.APIException;
 
 public class TestConnectivity {
@@ -234,11 +235,12 @@
             } else {
                 socket = new Socket();
                 try {
+                	FixURIinfo fui = new FixURIinfo(uri);
                     try {
-                        socket.connect(new InetSocketAddress(uri.getHost(),  uri.getPort()),3000);
-                        System.out.printf("Can Connect a Socket to %s %d\n",uri.getHost(),uri.getPort());
+                        socket.connect(new InetSocketAddress(fui.getHost(),  fui.getPort()),3000);
+                        System.out.printf("Can Connect a Socket to %s %d\n",fui.getHost(),fui.getPort());
                     } catch (IOException e) {
-                        System.out.printf("Cannot Connect a Socket to  %s %d: %s\n",uri.getHost(),uri.getPort(),e.getMessage());
+                        System.out.printf("Cannot Connect a Socket to  %s %d: %s\n",fui.getHost(),fui.getPort(),e.getMessage());
                     }
                 } finally {
                     try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
index 35ef999..16fdb79 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
@@ -28,6 +28,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.onap.aaf.cadi.Access;
 import org.onap.aaf.cadi.CadiException;
 import org.onap.aaf.cadi.LocatorException;
 import org.onap.aaf.cadi.SecuritySetter;
@@ -35,6 +36,7 @@
 import org.onap.aaf.cadi.config.Config;
 import org.onap.aaf.cadi.config.SecurityInfoC;
 import org.onap.aaf.cadi.http.HClient;
+import org.onap.aaf.cadi.util.FixURIinfo;
 import org.onap.aaf.cadi.util.Split;
 import org.onap.aaf.misc.env.APIException;
 import org.onap.aaf.misc.env.Data.TYPE;
@@ -61,21 +63,9 @@
         int connectTimeout = Integer.parseInt(si.access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
         try {
             String[] path = Split.split('/',locatorURI.getPath());
-            String host = locatorURI.getHost();
-            if (host==null) {
-                host = locatorURI.getAuthority(); // this happens when no port
-            }
-            if ("AAF_LOCATE_URL".equals(host)) {
-                URI uri = new URI(
-                        locatorURI.getScheme(),
-                        locatorURI.getUserInfo(),
-                        aaf_locator_uri.getHost(),
-                        aaf_locator_uri.getPort(),
-                        "/locate"+locatorURI.getPath(),
-                        null,
-                        null
-                        );
-                client = createClient(si.defSS, uri, connectTimeout);
+            FixURIinfo fui = new FixURIinfo(locatorURI);
+            if ("AAF_LOCATE_URL".equals(fui.getHost())) {
+                client = createClient(si.defSS, locatorURI, connectTimeout);
             } else if (path.length>1 && "locate".equals(path[1])) {
                 StringBuilder sb = new StringBuilder();
                 for (int i=3;i<path.length;++i) {
@@ -83,23 +73,26 @@
                     sb.append(path[i]);
                 }
                 setPathInfo(sb.toString());
-                URI uri = new URI(
-                            locatorURI.getScheme(),
-                            locatorURI.getUserInfo(),
-                            locatorURI.getHost(),
-                            locatorURI.getPort(),
-                            "/locate/"+name + ':' + version,
-                            null,
-                            null
-                            );
-                client = createClient(si.defSS, uri, connectTimeout);
+//                URI uri = new URI(
+//                            locatorURI.getScheme(),
+//                            locatorURI.getAuthority(),
+//                            locatorURI.getPath(),
+//                            null,
+//                            null
+//                            );
+                client = createClient(si.defSS, locatorURI, connectTimeout);
             } else {
                 client = new HClient(si.defSS, locatorURI, connectTimeout);
             }
             epsDF = env.newDataFactory(Endpoints.class);
-        } catch (APIException | URISyntaxException e) {
+            
+        } catch (APIException /*| URISyntaxException*/ e) {
             throw new LocatorException(e);
         }
+        
+        if(si.access.willLog(Access.Level.DEBUG)) {
+        	si.access.log(Access.Level.DEBUG, "Root URI:",client.getURI());
+        }
     }
 
     @Override
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
new file mode 100644
index 0000000..1e4e9c0
--- /dev/null
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
@@ -0,0 +1,93 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.cadi.aaf.v2_0;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.misc.env.impl.BasicTrans;
+
+/**
+ * This Locator good for using Inside Docker or K8s, where there is no real lookup, 
+ * and there is conflict between external and internal host names, due to 
+ * Service abstraction.
+ * 
+ * @author Instrumental(Jonathan)
+ *
+ */
+public class AAFSingleLocator implements Locator<URI> {
+	
+	private final URI uri;
+
+	/**
+	 * NS here is "container" ns.  AAF NS is assumed to be AAF_NS at this level of client code.
+	 * @param cont_ns
+	 * @param prefix
+	 * @param version
+	 * @throws URISyntaxException 
+	 */
+	public AAFSingleLocator(final String uri) throws URISyntaxException {
+		this.uri = new URI(uri);
+	}
+	
+	@Override
+	public URI get(Item item) throws LocatorException {
+		return uri;
+	}
+
+	@Override
+	public boolean hasItems() {
+		return true;
+	}
+
+	@Override
+	public void invalidate(Item item) throws LocatorException {
+	}
+
+	@Override
+	public Item best() throws LocatorException {
+		return new SingleItem();
+	}
+
+	@Override
+	public Item first() throws LocatorException {
+		return new SingleItem();
+	}
+
+	@Override
+	public Item next(Item item) throws LocatorException {
+		return null; // only one item
+	}
+
+	@Override
+	public boolean refresh() {
+		return false;
+	}
+
+	@Override
+	public void destroy() {
+	}
+	
+	private class SingleItem implements Item {
+	}
+}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
index 9f61713..9b630a7 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
@@ -87,12 +87,14 @@
             latitude = Double.parseDouble(lat);
             longitude = Double.parseDouble(lng);
         }
+
         if (name.startsWith(Defaults.AAF_NS)) {
             String root_ns = access.getProperty(Config.AAF_ROOT_NS, null);
-            if (root_ns!=null) {
-                name=name.replace(Defaults.AAF_NS, root_ns);
+            if(root_ns!=null) {
+            	name=name.replace(Defaults.AAF_NS, root_ns);
             }
         }
+
         if (name.startsWith("http")) { // simple URL
             this.name = name;
             this.version = access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION);
@@ -111,52 +113,7 @@
     public static void setCreator(LocatorCreator lc) {
         locatorCreator = lc; 
     }
-    
-    /*public static Locator<URI> create(String key) throws LocatorException {
-        String name = null;
-        String version = Config.AAF_DEFAULT_API_VERSION;
-        String pathInfo = null;
-        int prev = key.indexOf("/locate");
-        if (prev>0) {
-            prev = key.indexOf('/',prev+6);
-            if (prev>0) {
-                int next = key.indexOf('/',++prev);
-                if (next>0) {
-                    name = key.substring(prev, next);
-                    pathInfo=key.substring(next);
-                } else {
-                    name = key.substring(prev);
-                }
-                String[] split = Split.split(':', name);
-                switch(split.length) {
-                    case 3:
-                    case 2:
-                        version = split[1];
-                        name = split[0];
-                        break;
-                    default:
-                        break;
-                }
-            }
-        }
-
-        if (key.startsWith("http")) {
-            if (name!=null) {
-                if (locatorCreator != null) {
-                    AbsAAFLocator<?> aal = locatorCreator.create(name, version);
-                    if (pathInfo!=null) {
-                        aal.setPathInfo(pathInfo);
-                    }
-                    return aal;
-                }
-            } else {
-                return new PropertyLocator(key);
-            }
-        }
-        return null;
-    }
-    */
-    
+        
     public static Locator<URI> create(final String name, final String version) throws LocatorException {
         return locatorCreator.create(name, version);
     }
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
index 18430ef..aa4e574 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
@@ -773,6 +773,13 @@
             }
             
             app.add(Config.AAF_LOCATE_URL, propAccess, null);
+            for(Entry<Object, Object> aaf_loc_prop : propAccess.getProperties().entrySet()) {
+            	String key = aaf_loc_prop.getKey().toString();
+            	if(key.startsWith("aaf_locator")) {
+            		app.add(key, aaf_loc_prop.getValue().toString());
+            	}
+            }
+            
             app.add(Config.AAF_APPID, fqi);
             app.add(Config.AAF_URL, propAccess, Defaults.AAF_URL);
 
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
new file mode 100644
index 0000000..7e519c5
--- /dev/null
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
@@ -0,0 +1,264 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.cadi.register;
+
+import java.net.Inet4Address;
+import java.net.UnknownHostException;
+import java.util.List;
+
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.aaf.Defaults;
+import org.onap.aaf.cadi.config.Config;
+import org.onap.aaf.cadi.util.Split;
+
+import locate.v1_0.MgmtEndpoint;
+import locate.v1_0.MgmtEndpoints;
+
+public class RegistrationCreator {
+    private static final String MUST_BE_DEFINED = " must be defined\n";
+	private Access access;
+    
+    public RegistrationCreator(Access access) {
+    	this.access = access;
+    }
+    
+    public MgmtEndpoints create(final int port) throws CadiException {
+    	MgmtEndpoints me = new MgmtEndpoints();
+    	List<MgmtEndpoint> lme = me.getMgmtEndpoint();
+    	MgmtEndpoint defData = null;
+    	MgmtEndpoint locate = null;
+
+
+    	StringBuilder errs = new StringBuilder();
+    	try {
+    		String hostname = access.getProperty(Config.HOSTNAME, null);
+    		if (hostname==null) {
+    			hostname = Inet4Address.getLocalHost().getHostName();
+    		}
+    		if (hostname==null) {
+    			errs.append(Config.HOSTNAME);
+    			errs.append(MUST_BE_DEFINED);
+    		}
+
+    		Float latitude=null;
+    		String slatitude = access.getProperty(Config.CADI_LATITUDE, null);
+    		if(slatitude == null) {
+    			errs.append(Config.CADI_LATITUDE);
+    			errs.append(MUST_BE_DEFINED);
+    		} else {
+    			latitude = Float.parseFloat(slatitude);
+    		}
+
+    		Float longitude=null;
+    		String slongitude = access.getProperty(Config.CADI_LONGITUDE, null);
+    		if(slongitude == null) {
+    			errs.append(Config.CADI_LONGITUDE);
+    			errs.append(MUST_BE_DEFINED);
+    		} else {
+    			longitude = Float.parseFloat(slongitude);
+    		}
+
+    		if(errs.length()>0) {
+    			throw new CadiException(errs.toString());
+    		}
+
+    		String dot_le;
+    		String ns;
+    		String version=null;
+    		String lentries = access.getProperty(Config.AAF_LOCATOR_CONTAINER, null);
+    		if(lentries==null) {
+    			lentries="";
+    		} else {
+    			lentries=',' + lentries; // "" makes a blank default Public Entry
+    		}
+
+    		String defaultName = null;
+    		String str;
+    		int public_port = port;
+    		// Note: only one of the ports can be public...  Therefore, only the la
+    		for(String le : Split.splitTrim(',', lentries)) {
+    			dot_le = le.isEmpty()?"":"."+le;
+				str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_PORT+dot_le, null);
+				if(str!=null) { // Get Public Port
+					public_port = Integer.decode(str);
+				}
+    		}
+    		
+    		String public_hostname = hostname;
+    		for(String le : Split.splitTrim(',', lentries)) {
+    			dot_le = le.isEmpty()?"":"."+le;
+				String ph = access.getProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME+dot_le,null);
+				if( ph != null) {
+					public_hostname=ph;
+				}
+    		}
+    		
+    		String default_fqdn = access.getProperty(Config.AAF_LOCATOR_FQDN, public_hostname);
+    		
+
+    		// Now, loop through by Container
+    		for(String le : Split.splitTrim(',', lentries)) {
+    			// Add variable entries
+    			String names;
+    			if(le.length()>0) {
+    				dot_le = '.' + le;
+    				names = access.getProperty(Config.AAF_LOCATOR_NAMES+dot_le,null);
+    				if(names==null) {
+    					// Go for Default
+    					names = access.getProperty(Config.AAF_LOCATOR_NAMES,"");
+    				}
+    			} else {
+    				dot_le = "";
+    				names=access.getProperty(Config.AAF_LOCATOR_NAMES,dot_le);
+    			}
+    			
+    			for(String name : Split.splitTrim(',', names)) {
+    				if(defData==null) {
+    					defData = locate = new MgmtEndpoint();
+
+    					defaultName = name;
+    					version = access.getProperty(Config.AAF_LOCATOR_VERSION, Defaults.AAF_VERSION);
+    					locate.setProtocol(access.getProperty(Config.AAF_LOCATOR_PROTOCOL,null));
+    					List<String> ls = locate.getSubprotocol();
+    					for(String sp : Split.splitTrim(',', access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL,""))) {
+    						ls.add(sp);	
+    					}
+    					locate.setLatitude(latitude);
+    					locate.setLongitude(longitude);
+
+    				} else {
+    					locate = copy(defData);
+    				}
+    				
+    				str = access.getProperty(Config.HOSTNAME+dot_le, null);
+    				if(str==null) {
+    					str = access.getProperty(Config.HOSTNAME, hostname);
+    				}
+    				locate.setHostname(hostname);
+    				
+    				ns = access.getProperty(Config.AAF_LOCATOR_NS+dot_le,null);
+    				if(ns==null) {
+    					ns = access.getProperty(Config.AAF_LOCATOR_NS,"");
+    				}
+    				switch(ns) {
+	    				case Defaults.AAF_NS:
+	    					ns = access.getProperty(Config.AAF_ROOT_NS, "");
+	    					// Fallthrough on purpose.
+    				}
+
+    				String ns_dot;
+    				if(ns.isEmpty()) {
+    					ns_dot = ns;
+    				} else {
+    					ns_dot = ns + '.';
+    				}
+
+    				String container_id = access.getProperty(Config.AAF_LOCATOR_CONTAINER_ID+dot_le, "");
+    				if(!container_id.isEmpty()) {
+    					ns_dot = container_id + '.' + ns_dot;
+    				}
+
+    				if(!le.isEmpty()) {
+    					ns_dot = le + '.' + ns_dot;
+    				}
+
+    				if(name.isEmpty()) {
+   						locate.setName(ns_dot + defaultName);
+    				} else {
+    					locate.setName(ns_dot + name);
+    				}
+
+    				if(dot_le.isEmpty()) {
+    					locate.setHostname(access.getProperty(Config.AAF_LOCATOR_FQDN, default_fqdn));
+    				} else {
+	    				str =  access.getProperty(Config.AAF_LOCATOR_FQDN+dot_le, null);
+	    				if(str==null) {
+	    					locate.setHostname(default_fqdn);
+	    				} else {
+	        				String container_ns = access.getProperty(Config.AAF_LOCATOR_CONTAINER_NS+dot_le, "");
+	    					str = str.replace("%CNS", container_ns);
+	        				String container = access.getProperty(Config.AAF_LOCATOR_CONTAINER+dot_le, "");
+    						str = str.replace("%C", container);
+	    					str = str.replace("%NS", ns);
+	    					str = str.replace("%N", name);
+	    					str = str.replace("%DF", default_fqdn);
+	    					str = str.replace("%PH", public_hostname);
+	    					locate.setHostname(str);
+	    				}
+    				}
+    				
+    				if(le.isEmpty()) {
+    					locate.setPort(public_port);
+    				} else {
+    					locate.setPort(port);
+    				}
+
+    				String specificVersion = access.getProperty(Config.AAF_LOCATOR_VERSION + dot_le,null);
+    				if(specificVersion == null && locate == defData) {
+    					specificVersion = version;
+    				}
+    				if(specificVersion!=null) {
+    					String split[] = Split.splitTrim('.', specificVersion);
+    					locate.setPkg(split.length>3?Integer.parseInt(split[3]):0);
+    					locate.setPatch(split.length>2?Integer.parseInt(split[2]):0);
+    					locate.setMinor(split.length>1?Integer.parseInt(split[1]):0);
+    					locate.setMajor(split.length>0?Integer.parseInt(split[0]):0);
+    				}
+
+    				String protocol = access.getProperty(Config.AAF_LOCATOR_PROTOCOL + dot_le, null);
+    				if (protocol!=null) {
+    					locate.setProtocol(protocol);
+    					String subprotocols = access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL + dot_le, null);
+    					if(subprotocols!=null) {
+    						List<String> ls = locate.getSubprotocol();
+    						for (String s : Split.split(',', subprotocols)) {
+    							ls.add(s);
+    						}
+    					}
+    				}
+    				lme.add(locate);
+    			}
+    		}
+    	} catch (NumberFormatException | UnknownHostException e) {
+    		throw new CadiException("Error extracting Data from Properties for Registrar",e);
+    	}
+
+    	return me;
+    }
+	
+    private MgmtEndpoint copy(MgmtEndpoint mep) {
+		MgmtEndpoint out = new MgmtEndpoint();
+		out.setName(mep.getName());
+		out.setHostname(mep.getHostname());
+		out.setLatitude(mep.getLatitude());
+		out.setLongitude(mep.getLongitude());
+		out.setMajor(mep.getMajor());
+		out.setMinor(mep.getMinor());
+		out.setPkg(mep.getPkg());
+		out.setPatch(mep.getPatch());
+		out.setPort(mep.getPort());
+		out.setProtocol(mep.getProtocol());
+		out.getSpecialPorts().addAll(mep.getSpecialPorts());
+		out.getSubprotocol().addAll(mep.getSubprotocol());
+		return out;
+	}
+}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
index 49d40ab..883410c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
@@ -22,10 +22,8 @@
 package org.onap.aaf.cadi.register;
 
 import java.net.HttpURLConnection;
-import java.net.Inet4Address;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.UnknownHostException;
 
 import org.onap.aaf.cadi.Access;
 import org.onap.aaf.cadi.Access.Level;
@@ -39,16 +37,13 @@
 import org.onap.aaf.cadi.config.Config;
 import org.onap.aaf.cadi.locator.PropertyLocator;
 import org.onap.aaf.cadi.locator.SingleEndpointLocator;
-import org.onap.aaf.cadi.util.Split;
 import org.onap.aaf.misc.env.APIException;
 import org.onap.aaf.misc.env.impl.BasicEnv;
 import org.onap.aaf.misc.rosetta.env.RosettaDF;
 
-import locate.v1_0.MgmtEndpoint;
 import locate.v1_0.MgmtEndpoints;
 
 public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
-    private final MgmtEndpoint mep;
     private final MgmtEndpoints meps;
     private final AAFCon<HttpURLConnection> aafcon;
     private final RosettaDF<MgmtEndpoints> mgmtEndpointsDF;
@@ -56,8 +51,7 @@
     private final Access access;
     private final int timeout;
 
-    @SafeVarargs
-    public RemoteRegistrant(AAFCon<HttpURLConnection> aafcon, String name, String version, int port, RemoteRegistrant<ENV> ... others) throws CadiException, LocatorException {
+    public RemoteRegistrant(AAFCon<HttpURLConnection> aafcon, int port) throws CadiException, LocatorException {
         this.aafcon = aafcon;
         access = aafcon.access;
         try {
@@ -82,60 +76,13 @@
             }
         }
         
-        mep = new MgmtEndpoint();
-        mep.setName(name);
-        mep.setPort(port);
-
-        try {
-            String hostnameToRegister = access.getProperty(Config.AAF_REGISTER_AS, null);
-            if (hostnameToRegister==null) {
-                hostnameToRegister = access.getProperty(Config.HOSTNAME, null);
-            }
-            if (hostnameToRegister==null) {
-                hostnameToRegister = Inet4Address.getLocalHost().getHostName();
-            }
-            mep.setHostname(hostnameToRegister);
-            
-            String latitude = access.getProperty(Config.CADI_LATITUDE, null);
-            if (latitude==null) {
-                latitude = access.getProperty("AFT_LATITUDE", null);
-            }
-            String longitude = access.getProperty(Config.CADI_LONGITUDE, null);
-            if (longitude==null) {
-                longitude = access.getProperty("AFT_LONGITUDE", null);
-            }
-            if (latitude==null || longitude==null) {
-                throw new CadiException(Config.CADI_LATITUDE + " and " + Config.CADI_LONGITUDE + " is required");
-            } else {
-                mep.setLatitude(Float.parseFloat(latitude));
-                mep.setLongitude(Float.parseFloat(longitude));
-            }
-            String split[] = Split.split('.', version);
-            mep.setPkg(split.length>3?Integer.parseInt(split[3]):0);
-            mep.setPatch(split.length>2?Integer.parseInt(split[2]):0);
-            mep.setMinor(split.length>1?Integer.parseInt(split[1]):0);
-            mep.setMajor(split.length>0?Integer.parseInt(split[0]):0);
-            
-            String subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null);
-            if (subprotocols==null) {
-                mep.setProtocol("http");
-            } else {
-                mep.setProtocol("https");
-                for (String s : Split.split(',', subprotocols)) {
-                    mep.getSubprotocol().add(s);
-                }
-            }
-        } catch (NumberFormatException | UnknownHostException e) {
-            throw new CadiException("Error extracting Data from Properties for Registrar",e);
-        }
-        meps = new MgmtEndpoints();
-        meps.getMgmtEndpoint().add(mep);
-        for (RemoteRegistrant<ENV> rr : others) {
-            meps.getMgmtEndpoint().add(rr.mep);
-        }
+        RegistrationCreator rcreator = new RegistrationCreator(access);
+        meps = rcreator.create(port);
     }
     
-    @Override
+
+
+	@Override
     public Result<Void> update(ENV env) {
         try {
             Rcli<?> client = aafcon.client(locator);
diff --git a/cadi/client/pom.xml b/cadi/client/pom.xml
index 3563be7..b27d37c 100644
--- a/cadi/client/pom.xml
+++ b/cadi/client/pom.xml
@@ -22,7 +22,7 @@
 	<parent>
 		<groupId>org.onap.aaf.authz</groupId>
 		<artifactId>cadiparent</artifactId>
-		<version>2.1.9-SNAPSHOT</version>
+		<version>2.1.10-SNAPSHOT</version>
 		<relativePath>..</relativePath>
 	</parent>
 
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
index d885283..daca47d 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
@@ -40,6 +40,7 @@
 import org.onap.aaf.cadi.client.EClient;
 import org.onap.aaf.cadi.client.Future;
 import org.onap.aaf.cadi.client.Rcli;
+import org.onap.aaf.cadi.util.FixURIinfo;
 import org.onap.aaf.misc.env.APIException;
 import org.onap.aaf.misc.env.Data;
 import org.onap.aaf.misc.env.Data.TYPE;
@@ -109,24 +110,23 @@
 
     @Override
     public void send() throws APIException {
+        // Build URL from given URI plus current Settings
+        if (uri.getPath()==null) {
+            throw new APIException("Invalid URL entered for HClient");
+        }
+        StringBuilder pi=null;
+        if (pathinfo!=null) { // additional pathinfo
+            pi = new StringBuilder(uri.getPath());
+            if (!pathinfo.startsWith("/")) {
+                pi.append('/');
+            }
+            pi.append(pathinfo);
+        }
+       	URI sendURI = null;
         try {
-            // Build URL from given URI plus current Settings
-            if (uri.getPath()==null) {
-                throw new APIException("Invalid URL entered for HClient");
-            }
-            StringBuilder pi=null;
-            if (pathinfo!=null) { // additional pathinfo
-                pi = new StringBuilder(uri.getPath());
-                if (!pathinfo.startsWith("/")) {
-                    pi.append('/');
-                }
-                pi.append(pathinfo);
-            }
-            URI sendURI = new URI(
+            sendURI = new URI(
                     uri.getScheme(),
-                    uri.getUserInfo(),
-                    uri.getHost(),
-                    uri.getPort(),
+                    uri.getAuthority(),
                     pi==null?uri.getPath():pi.toString(),
                     query==null?uri.getQuery():query,
                     fragment==null?uri.getFragment():fragment
@@ -149,8 +149,14 @@
                 transfer.transfer(huc.getOutputStream());
             }
             // TODO other settings? There's a bunch here.
+        } catch (APIException e) {
+        	throw e;
         } catch (Exception e) {
-            throw new APIException(e);
+        	if(sendURI==null) {
+        		throw new APIException("Cannot connect to Root URI: " + uri.toString(),e);
+        	} else {
+        		throw new APIException("Cannot connect to " + sendURI.toString() + "(Root URI: " + uri.toString() +')',e);
+        	}
         } finally { // ensure all these are reset after sends
             meth=pathinfo=null;
             if (headers!=null) {
@@ -171,9 +177,7 @@
     protected HttpURLConnection getConnection(URI uri, StringBuilder pi) throws IOException, URISyntaxException {
         URL url = new URI(
                 uri.getScheme(), 
-                uri.getUserInfo(),
-                uri.getHost(), 
-                uri.getPort(), 
+                uri.getAuthority(),
                 pi==null?uri.getPath():pi.toString(), 
                 query,
                 fragment).toURL();
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
index 8e3138a..1e5c521 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
@@ -30,14 +30,15 @@
 import javax.net.ssl.SSLHandshakeException;
 
 import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.Access.Level;
 import org.onap.aaf.cadi.CadiException;
 import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.Locator.Item;
 import org.onap.aaf.cadi.LocatorException;
 import org.onap.aaf.cadi.SecuritySetter;
-import org.onap.aaf.cadi.Access.Level;
-import org.onap.aaf.cadi.Locator.Item;
 import org.onap.aaf.cadi.client.Rcli;
 import org.onap.aaf.cadi.client.Retryable;
+import org.onap.aaf.cadi.util.FixURIinfo;
 import org.onap.aaf.misc.env.APIException;
 
 public class HMangr {
@@ -174,7 +175,8 @@
         loc.refresh();
         for (Item li=loc.first();li!=null;li=loc.next(li)) {
             URI uri=loc.get(li);
-            if (host!=null && !host.equals(uri.getHost())) {
+            FixURIinfo fui = new FixURIinfo(uri);
+            if (host!=null && !host.equals(fui.getHost())) {
                 break;
             }
             try {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
index eb0ecf1..bccb811 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
@@ -36,6 +36,7 @@
 
 import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.util.FixURIinfo;
 import org.onap.aaf.misc.env.util.Split;
 
 public class PropertyLocator implements Locator<URI> {
@@ -181,7 +182,8 @@
             String realname;
             for (int i = 0; i < orig.length ; ++i) {
                 try {
-                    InetAddress ia[] = InetAddress.getAllByName(orig[i].getHost());
+                	FixURIinfo fui = new FixURIinfo(orig[i]);
+                    InetAddress ia[] = InetAddress.getAllByName(fui.getHost());
 
                     URI o,n;
                     for (int j=0;j<ia.length;++j) {
diff --git a/cadi/core/pom.xml b/cadi/core/pom.xml
index 51a0d09..c02d0f8 100644
--- a/cadi/core/pom.xml
+++ b/cadi/core/pom.xml
@@ -16,7 +16,7 @@
 		<groupId>org.onap.aaf.authz</groupId>
 		<artifactId>cadiparent</artifactId>
 		<relativePath>..</relativePath>
-		<version>2.1.9-SNAPSHOT</version>
+		<version>2.1.10-SNAPSHOT</version>
 	</parent>
 
 	<modelVersion>4.0.0</modelVersion>
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
index a9d671c..599bb98 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
@@ -26,6 +26,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -106,7 +108,7 @@
         // First, load related System Properties
         for (Entry<Object,Object> es : System.getProperties().entrySet()) {
             String key = es.getKey().toString();
-            for (String start : new String[] {"cadi_","aaf_","cm_"}) {
+            for (String start : new String[] {"HOSTNAME","cadi_","aaf_","cm_"}) {
                 if (key.startsWith(start)) {
                     props.put(key, es.getValue());
                 }
@@ -274,41 +276,53 @@
             sb.append("] ");
         } else {
             int idx = 0;
-            if (elements[idx] instanceof Integer) {
+            if(elements[idx]!=null  && 
+            	elements[idx] instanceof Integer) {
                 sb.append('-');
                 sb.append(elements[idx]);
                 ++idx;
             }
             sb.append("] ");
-            String s;
-            boolean first = true;
-            for (Object o : elements) {
-                if (o!=null) {
-                    s=o.toString();
-                    if (first) {
-                        first = false;
-                    } else {
-                        int l = s.length();
-                        if (l>0)    {
-                            switch(s.charAt(l-1)) {
-                                case ' ':
-                                    break;
-                                default:
-                                    sb.append(' ');
-                            }
-                        }
-                    }
-                    sb.append(s);
-                }
-            }
+            write(true,sb,elements);
         }
         return sb;
     }
+    
+    private static boolean write(boolean first, StringBuilder sb, Object[] elements) {
+    	String s;
+        for (Object o : elements) {
+            if (o!=null) {
+            	if(o.getClass().isArray()) {
+            		first = write(first,sb,(Object[])o);
+            	} else {
+	                s=o.toString();
+	                if (first) {
+	                    first = false;
+	                } else {
+	                    int l = s.length();
+	                    if (l>0)    {
+	                        switch(s.charAt(l-1)) {
+	                            case ' ':
+	                                break;
+	                            default:
+	                                sb.append(' ');
+	                        }
+	                    }
+	                }
+	                sb.append(s);
+            	}
+            }
+        }
+        return first;
+    }
 
     @Override
     public void log(Exception e, Object... elements) {
-        log(Level.ERROR,e.getMessage(),elements);
-        e.printStackTrace(System.err);
+    	StringWriter sw = new StringWriter();
+    	PrintWriter pw = new PrintWriter(sw);
+    	pw.println();
+    	e.printStackTrace(pw);
+        log(Level.ERROR,elements,sw.toString());
     }
 
     @Override
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
index 353e8e3..245b653 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
@@ -58,6 +58,7 @@
 import org.onap.aaf.cadi.taf.basic.BasicHttpTaf;
 import org.onap.aaf.cadi.taf.cert.X509Taf;
 import org.onap.aaf.cadi.taf.dos.DenialOfServiceTaf;
+import org.onap.aaf.cadi.util.FixURIinfo;
 import org.onap.aaf.cadi.util.Split;
 
 /**
@@ -158,13 +159,31 @@
     public static final String OAUTH2_TOKEN_URL = "https://AAF_LOCATE_URL/AAF_NS.token:" + AAF_DEFAULT_API_VERSION;
     public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION;
 
-    public static final String AAF_REGISTER_AS = "aaf_register_as";
+    public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
+    // AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability
+    // to set these entries manually
+    // example: adding a K8S name like "oom"
+    // this will allow Registrations to pick up 
+    // locator_ns.oom for onap's "OOM" based k8s entries, etc.
+    public static final String AAF_LOCATOR_CONTAINER="aaf_locator_container";
+    // An ID for another Container, to be used to avoid picking up the wrong internal info 
+    // for another container.
+    public static final String AAF_LOCATOR_CONTAINER_ID = "aaf_locator_container_id";
+    public static final String AAF_LOCATOR_CONTAINER_NS = "aaf_locator_container_ns";
+    public static final String AAF_LOCATOR_VERSION = "aaf_locator_version";
+    public static final String AAF_LOCATOR_PROTOCOL = "aaf_locator_protocol";
+    public static final String AAF_LOCATOR_SUBPROTOCOL = "aaf_locator_subprotocol";
+    public static final String AAF_LOCATOR_NS = "aaf_locator_ns";
+    public static final String AAF_LOCATOR_NAMES = "aaf_locator_names";
+    public static final String AAF_LOCATOR_FQDN = "aaf_locator_fqdn";
+    public static final String AAF_LOCATOR_PUBLIC_PORT = "aaf_locator_public_port";
+    public static final String AAF_LOCATOR_PUBLIC_HOSTNAME = "aaf_locator_public_hostname";
+
     public static final String AAF_APPID = "aaf_id";
     public static final String AAF_APPPASS = "aaf_password";
     public static final String AAF_LUR_CLASS = "aaf_lur_class";
     public static final String AAF_TAF_CLASS = "aaf_taf_class";
     public static final String AAF_CONNECTOR_CLASS = "aaf_connector_class";
-    public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
     public static final String AAF_CONN_TIMEOUT = "aaf_conn_timeout";
     public static final String AAF_CONN_TIMEOUT_DEF = "3000";
     public static final String AAF_CONN_IDLE_TIMEOUT = "aaf_conn_idle_timeout"; // only for Direct Jetty Access.
@@ -189,7 +208,7 @@
     public static final String AAF_HIGH_COUNT = "aaf_high_count";
     public static final String AAF_HIGH_COUNT_DEF = "1000"; // Default is 1000 entries
     public static final String AAF_PERM_MAP = "aaf_perm_map";
-    public static final String AAF_COMPONENT = "aaf_component";
+//    public static final String AAF_COMPONENT = "aaf_component";
     public static final String AAF_CERT_IDS = "aaf_cert_ids";
     public static final String AAF_DEBUG_IDS = "aaf_debug_ids"; // comma delimited
     public static final String AAF_DATA_DIR = "aaf_data_dir"; // AAF processes and Components only.
@@ -795,18 +814,39 @@
         if (_url==null) {
             access.log(Level.INIT,"No URL passed to 'loadLocator'. Disabled");
         } else {
-            String url = _url;
+            String url = _url.replace("/AAF_NS.", "/%C%CID%AAF_NS.");
+            String root_ns = access.getProperty(Config.AAF_ROOT_NS, null);
+            if(url.indexOf('%')>=0) {
+	            String str = access.getProperty(Config.AAF_LOCATOR_CONTAINER_ID, null);
+	            if(str==null) {
+	            	url = url.replace("%CID","");
+	            } else {
+	            	url = url.replace("%CID",str+'.');
+	            }
+	            str = access.getProperty(Config.AAF_LOCATOR_CONTAINER, null);
+	            if(str==null) {
+	            	url = url.replace("%C","");
+	            } else {
+	            	url = url.replace("%C",str+'.');
+	            }
+	
+	            if (root_ns==null) {
+	            	url = url.replace("%AAF_NS","");
+	            } else {
+	            	url = url.replace("%AAF_NS",root_ns);
+	            }
+            }
             String replacement;
             int idxAAFLocateUrl;
-            if ((idxAAFLocateUrl=_url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) {
+            if ((idxAAFLocateUrl=url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) {
                 StringBuilder sb = new StringBuilder(replacement);
                 if (!replacement.endsWith("/locate")) {
                     sb.append("/locate");
                 } 
-                sb.append(_url,idxAAFLocateUrl+AAF_LOCATE_URL_TAG.length(),_url.length());
+                sb.append(url,idxAAFLocateUrl+AAF_LOCATE_URL_TAG.length(),url.length());
                 url = sb.toString();
             }
-    
+            
             try {
                 Class<?> lcls = loadClass(access,AAF_LOCATOR_CLASS_DEF);
                 if (lcls==null) {
@@ -821,12 +861,13 @@
                 }
                 if (locator==null) {
                     URI locatorURI = new URI(url);
+                    FixURIinfo fui = new FixURIinfo(locatorURI);
                     Constructor<?> cnst = lcls.getConstructor(SecurityInfoC.class,URI.class);
                     locator = (Locator<URI>)cnst.newInstance(new Object[] {si,locatorURI});
-                    int port = locatorURI.getPort();
-                    String portS = port<0?"":(":"+locatorURI.getPort());
+                    int port = fui.getPort();
+                    String portS = port<0?"":(":"+port);
                     
-                    access.log(Level.INFO, "AAFLocator enabled using " + locatorURI.getScheme() +"://"+locatorURI.getHost() + portS);
+                    access.log(Level.INFO, "AAFLocator enabled using " + locatorURI.getScheme() +"://"+fui.getHost() + portS);
                 } else {
                     access.log(Level.INFO, "AAFLocator enabled using preloaded " + locator.getClass().getSimpleName());
                 }
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
index 2305eac..cd8eff4 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
@@ -139,7 +139,7 @@
     
 
     @SuppressWarnings("unchecked")
-    private void init(Get getter) throws ServletException {
+    protected void init(Get getter) throws ServletException {
        sideChain = new SideChain();
         // Start with the assumption of "Don't trust anyone".
        TrustChecker tc = TrustChecker.NOTRUST; // default position
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
index cf7c922..1805c78 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
@@ -32,7 +32,7 @@
  * A private method to query the Filter config and if not exists, return the default.  This
  * cleans up the initialization code.
  */
-class FCGet implements Get {
+public class FCGet implements Get {
     /**
      * 
      */
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
new file mode 100644
index 0000000..7e3a239
--- /dev/null
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
@@ -0,0 +1,66 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.cadi.util;
+
+import java.net.URI;
+
+/**
+ * URI and URL, if the host does not have "dots", will interpret Host:port as Authority
+ * 
+ * This is very problematic for Containers, which like single name entries.
+ * @author Instrumental(Jonathan)
+ *
+ */
+public class FixURIinfo {
+	private String auth;
+	private String host;
+	private int port;
+	
+	public FixURIinfo(URI uri) {
+		auth = uri.getAuthority();
+		host = uri.getHost();
+		if(host==null) {
+			if(auth!=null) {
+				int colon = auth.indexOf(':');
+				if(colon >= 0 ) {
+					host = auth.substring(0, colon);
+					port = Integer.parseInt(auth.substring(colon+1));
+				} else {
+					host = auth;
+					port = uri.getPort();
+				}
+				auth=null;
+			}
+		}
+	}
+	
+	public String getHost() {
+		return host;
+	}
+	
+	public int getPort() {
+		return port;
+	}
+
+	public String getUserInfo() {
+		return auth;
+	}
+}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
index 4bb1d3b..97afa65 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
@@ -31,84 +31,93 @@
  */
 
 public class Split {
-      public static String[] split(char c, String value) {
-          return split(c,value,0,value.length());
-      }
+	private static final String[] EMPTY = new String[0];
 
-      public static String[] split(char c, String value, int start, int end) {
-          if (value==null) {
-              return new String[0];
-          }
+	public static String[] split(char c, String value) {
+		if (value==null) {
+			return EMPTY;
+		}
 
-          // Count items to preallocate Array (memory alloc is more expensive than counting twice)
-          int count,idx;
-          for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
-          String[] rv = new String[count];
-          if (count==1) {
-              rv[0]=value.substring(start,end);
-          } else {
-              int last=0;
-              count=-1;
-              for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
-                  rv[++count]=value.substring(last,idx);
-                  last = ++idx;
-              }
-              rv[++count]=value.substring(last,end);
-          }
-          return rv;
-    }
+		return split(c,value,0,value.length());
+	}
 
-      public static String[] splitTrim(char c, String value, int start, int end) {
-          if (value==null) {
-              return new String[0];
-          }
+	public static String[] split(char c, String value, int start, int end) {
+		if (value==null) {
+			return EMPTY;
+		}
 
-          // Count items to preallocate Array (memory alloc is more expensive than counting twice)
-          int count,idx;
-          for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
-          String[] rv = new String[count];
-          if (count==1) {
-              rv[0]=value.substring(start,end).trim();
-          } else {
-              int last=0;
-              count=-1;
-              for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
-                  rv[++count]=value.substring(last,idx).trim();
-                  last = ++idx;
-              }
-              rv[++count]=value.substring(last,end).trim();
-          }
-          return rv;
-    }
+		// Count items to preallocate Array (memory alloc is more expensive than counting twice)
+		int count,idx;
+		for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
+		String[] rv = new String[count];
+		if (count==1) {
+			rv[0]=value.substring(start,end);
+		} else {
+			int last=0;
+			count=-1;
+			for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
+				rv[++count]=value.substring(last,idx);
+				last = ++idx;
+			}
+			rv[++count]=value.substring(last,end);
+		}
+		return rv;
+	}
 
-      public static String[] splitTrim(char c, String value) {
-          return splitTrim(c,value,0,value.length());
-      }
+	public static String[] splitTrim(char c, String value, int start, int end) {
+		if (value==null) {
+			return EMPTY;
+		}
 
-      public static String[] splitTrim(char c, String value, int size) {
-          if (value==null) {
-              return new String[0];
-          }
+		// Count items to preallocate Array (memory alloc is more expensive than counting twice)
+		int count,idx;
+		for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
+		String[] rv = new String[count];
+		if (count==1) {
+			rv[0]=value.substring(start,end).trim();
+		} else {
+			int last=0;
+			count=-1;
+			for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
+				rv[++count]=value.substring(last,idx).trim();
+				last = ++idx;
+			}
+			rv[++count]=value.substring(last,end).trim();
+		}
+		return rv;
+	}
 
-          int idx;
-          String[] rv = new String[size];
-          if (size==1) {
-              rv[0]=value.trim();
-          } else {
-              int last=0;
-              int count=-1;
-              size-=2;
-              for (idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
-                  rv[++count]=value.substring(last,idx).trim();
-                  last = ++idx;
-              }
-              if (idx>0) {
-                rv[++count]=value.substring(last,idx).trim();
-              } else {
-                rv[++count]=value.substring(last).trim();
-              }
-          }
-          return rv;
-      }
+	public static String[] splitTrim(char c, String value) {
+		if (value==null) {
+			return EMPTY;
+		}
+		return splitTrim(c,value,0,value.length());
+	}
+
+	public static String[] splitTrim(char c, String value, int size) {
+		if (value==null) {
+			return EMPTY;
+		}
+
+		int idx;
+		String[] rv = new String[size];
+		if (size==1) {
+			rv[0]=value.trim();
+		} else {
+			int last=0;
+			int count=-1;
+			size-=2;
+			for (idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
+				rv[++count]=value.substring(last,idx).trim();
+				last = ++idx;
+			}
+			if (idx>0) {
+				rv[++count]=value.substring(last,idx).trim();
+			} else {
+				rv[++count]=value.substring(last).trim();
+			}
+		}
+		return rv;
+	}
 
 }
diff --git a/cadi/oauth-enduser/pom.xml b/cadi/oauth-enduser/pom.xml
index d9d5214..d04e12b 100644
--- a/cadi/oauth-enduser/pom.xml
+++ b/cadi/oauth-enduser/pom.xml
@@ -25,7 +25,7 @@
 	<parent>
 		<groupId>org.onap.aaf.authz</groupId>
 		<artifactId>cadiparent</artifactId>
-		<version>2.1.9-SNAPSHOT</version>
+		<version>2.1.10-SNAPSHOT</version>
 		<relativePath>..</relativePath>
 	</parent>
 	
diff --git a/cadi/pom.xml b/cadi/pom.xml
index 4b02ebe..7e7458a 100644
--- a/cadi/pom.xml
+++ b/cadi/pom.xml
@@ -24,7 +24,7 @@
 	<parent>
 	    <groupId>org.onap.aaf.authz</groupId>
 	    <artifactId>parent</artifactId>
-	    <version>2.1.9-SNAPSHOT</version>
+	    <version>2.1.10-SNAPSHOT</version>
     </parent>
 	<artifactId>cadiparent</artifactId>
 	<name>AAF CADI Parent (Code, Access, Data, Identity)</name>
diff --git a/cadi/servlet-sample/pom.xml b/cadi/servlet-sample/pom.xml
index ec73e2f..ca44107 100644
--- a/cadi/servlet-sample/pom.xml
+++ b/cadi/servlet-sample/pom.xml
@@ -4,7 +4,7 @@
 		<groupId>org.onap.aaf.authz</groupId>
 		<artifactId>cadiparent</artifactId>
 		<relativePath>..</relativePath>
-		<version>2.1.9-SNAPSHOT</version>
+		<version>2.1.10-SNAPSHOT</version>
 	</parent>
 	<modelVersion>4.0.0</modelVersion>
 	<name>CADI Servlet Sample (Test Only)</name>
