From 28bb6abfea039ca256559500612d6e5fabae08e6 Mon Sep 17 00:00:00 2001 From: Simmo Saan Date: Thu, 12 Oct 2017 15:40:19 +0300 Subject: [PATCH] DATAREST-1148 - Fix eager toString() call on domain object in ResourceStatus. Originl pull request: #282. --- .../springframework/data/rest/webmvc/ResourceStatus.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceStatus.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceStatus.java index 5027f6b24..e5d401342 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceStatus.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceStatus.java @@ -61,8 +61,10 @@ class ResourceStatus { Assert.notNull(requestHeaders, "Request headers must not be null!"); Assert.notNull(domainObject, "Domain object must not be null!"); Assert.notNull(entity, "PersistentEntity must not be null!"); - Assert.isTrue(entity.getType().isInstance(domainObject), - String.format(INVALID_DOMAIN_OBJECT, domainObject, entity.getType())); + + if (!entity.getType().isInstance(domainObject)) { + throw new IllegalArgumentException(String.format(INVALID_DOMAIN_OBJECT, domainObject, entity.getType())); + } // Check ETag for If-Non-Match