if (containerLog.isTraceEnabled()) {
containerLog.trace(" search returned relative name: " +
result.getName());
}
NameParser parser = context.getNameParser("");
Name contextName = parser.parse(context.getNameInNamespace());
Name baseName = parser.parse(base);
// Bugzilla 32269
Name entryName =
parser.parse(new CompositeName(result.getName()).get(0));
Name name = contextName.addAll(baseName);
name = name.addAll(entryName);
return name.toString();
} else {
String absoluteName = result.getName();
if (containerLog.isTraceEnabled())
containerLog.trace(" search returned absolute name: " +
result.getName());
try {
// Normalize the name by running it through the name parser.
NameParser parser = context.getNameParser("");
URI userNameUri = new URI(absoluteName);
String pathComponent = userNameUri.getPath();
// Should not ever have an empty path component, since that is /{DN}
if (pathComponent.length() < 1 ) {
throw new InvalidNameException(
"Search returned unparseable absolute name: " +
absoluteName );
}
Name name = parser.parse(pathComponent.substring(1));
return name.toString();
} catch ( URISyntaxException e ) {
throw new InvalidNameException(
"Search returned unparseable absolute name: " +
absoluteName );
}