If client cannot be augmented due to error, we shall return the un-augmented client entity.

Signed-off-by: Patrick Jennings <pajennin@redhat.com>
This commit is contained in:
Patrick Jennings 2024-03-29 11:02:29 -04:00 committed by Marek Posolda
parent 42202ae45e
commit c0f5dab209

View file

@ -96,7 +96,7 @@ public class DefaultClientTypeManager implements ClientTypeManager {
ClientTypesRepresentation clientTypes = getClientTypes(realm);
ClientTypeRepresentation clientType = getClientTypeByName(clientTypes, typeName);
if (clientType == null) {
logger.errorf("Referenced client type '%s' not found");
logger.errorf("Referenced client type '%s' not found", typeName);
throw new ClientTypeException("Client type not found");
}
@ -109,8 +109,14 @@ public class DefaultClientTypeManager implements ClientTypeManager {
if (client.getType() == null) {
return client;
} else {
ClientType clientType = getClientType(client.getRealm(), client.getType());
return new TypeAwareClientModelDelegate(clientType, () -> client);
try {
ClientType clientType = getClientType(client.getRealm(), client.getType());
return new TypeAwareClientModelDelegate(clientType, () -> client);
} catch(ClientTypeException cte) {
logger.errorf("Could not augment client, %s, due to client type exception: %s",
client, cte);
return client;
}
}
}