From 9ac79514b7d85eb060fa07cd59f0e97ea18d8d8d Mon Sep 17 00:00:00 2001 From: Jon Brisbin Date: Tue, 5 Mar 2013 07:58:27 -0600 Subject: [PATCH] Fix for DATAREST-70. Added a null check before constructing a `RepositoryEntityLinks.PersistentEntityLinkBuilder` --- .../data/rest/repository/support/RepositoryEntityLinks.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/support/RepositoryEntityLinks.java b/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/support/RepositoryEntityLinks.java index e295a5370..c6b56d982 100644 --- a/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/support/RepositoryEntityLinks.java +++ b/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/support/RepositoryEntityLinks.java @@ -41,6 +41,9 @@ public class RepositoryEntityLinks extends AbstractEntityLinks { @Override public LinkBuilder linkFor(Class type) { RepositoryInformation repoInfo = repositories.getRepositoryInformationFor(type); + if(null == repoInfo) { + throw new IllegalArgumentException(type + " is not managed by any repository."); + } PersistentEntity persistentEntity = repositories.getPersistentEntity(type); if(null == persistentEntity) { throw new IllegalArgumentException(type + " is not managed by any repository.");