From a2288b72422377ba20dcdaf53f5676915a05963b Mon Sep 17 00:00:00 2001 From: Jon Brisbin Date: Tue, 4 Sep 2012 10:34:14 -0500 Subject: [PATCH] DATAREST-41 Slight tweak to fix to ensure that a links property is never specified as anything other than an array on incoming JSON. --- .../rest/webmvc/json/RepositoryAwareJacksonModule.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/RepositoryAwareJacksonModule.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/RepositoryAwareJacksonModule.java index f2b92cdf2..567665a1f 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/RepositoryAwareJacksonModule.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/RepositoryAwareJacksonModule.java @@ -260,8 +260,13 @@ public class RepositoryAwareJacksonModule extends SimpleModule implements Initia } if("links".equals(name)) { - while((tok = jp.nextToken()) != JsonToken.END_ARRAY) { - // Advance past the links + if((tok = jp.nextToken()) == JsonToken.START_ARRAY) { + while((tok = jp.nextToken()) != JsonToken.END_ARRAY) { + // Advance past the links + } + } else { + throw new HttpMessageNotReadableException( + "Property 'links' is not of array type. Either eliminate this property from the document or make it an array."); } continue; }