[KEYCLOAK-4769] - Better error message when resource has no or invalid uri

This commit is contained in:
Pedro Igor 2017-04-20 12:29:02 -03:00
parent 80a80512ea
commit 70a3dd1e4a

View file

@ -220,7 +220,14 @@ public class PolicyEnforcer {
pathConfig.setId(resourceDescription.getId()); pathConfig.setId(resourceDescription.getId());
pathConfig.setName(resourceDescription.getName()); pathConfig.setName(resourceDescription.getName());
pathConfig.setPath(resourceDescription.getUri());
String uri = resourceDescription.getUri();
if (uri == null || "".equals(uri.trim())) {
throw new RuntimeException("Failed to configure paths. Resource [" + resourceDescription.getName() + "] has an invalid or empty URI [" + uri + "].");
}
pathConfig.setPath(uri);
List<String> scopeNames = new ArrayList<>(); List<String> scopeNames = new ArrayList<>();