- String prefix = prefixNamespace.getKey() + PREFIX_SEPARATOR;
- Preconditions.checkState(serviceName.startsWith(prefix),
- "Service %s not correctly prefixed, expected %s, but was %s", XmlNetconfConstants.TYPE_KEY, prefix,
- serviceName);
- serviceName = serviceName.substring(prefix.length());
- return serviceName;
+ if(prefixNamespace.getKey().isEmpty()) {
+ return serviceName;
+ } else {
+ String prefix = prefixNamespace.getKey() + PREFIX_SEPARATOR;
+ Preconditions.checkState(serviceName.startsWith(prefix),
+ "Service %s not correctly prefixed, expected %s, but was %s", XmlNetconfConstants.TYPE_KEY, prefix,
+ serviceName);
+ serviceName = serviceName.substring(prefix.length());
+ return serviceName;
+ }