From 980f971236eb496008a6f8f9c657180c0974d47b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 16 Jul 2014 15:11:19 +0200 Subject: [PATCH] SelectedValueComparator defensively handles null values in exhaustiveCompare Issue: SPR-12001 --- .../web/servlet/tags/form/SelectedValueComparator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java index 5942705f12..3561112373 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -148,7 +148,7 @@ abstract class SelectedValueComparator { PropertyEditor editor, Map convertedValueCache) { String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false); - if (boundValue.getClass().isEnum()) { + if (boundValue != null && boundValue.getClass().isEnum()) { Enum boundEnum = (Enum) boundValue; String enumCodeAsString = ObjectUtils.getDisplayString(boundEnum.name()); if (enumCodeAsString.equals(candidateDisplayString)) {