From 29b31cad488fbe698999b5ab370f6c1cd3ce75ac Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 6 Nov 2019 14:21:52 +0100 Subject: [PATCH] Align implementations of StringToUUIDConverter and UUIDEditor Closes gh-23940 --- .../org/springframework/beans/propertyeditors/UUIDEditor.java | 4 ++-- .../core/convert/support/StringToUUIDConverter.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/UUIDEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/UUIDEditor.java index 6c2e9ced7c..895c6cb20f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/UUIDEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/UUIDEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2019 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. @@ -34,7 +34,7 @@ public class UUIDEditor extends PropertyEditorSupport { @Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { - setValue(UUID.fromString(text)); + setValue(UUID.fromString(text.trim())); } else { setValue(null); diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/StringToUUIDConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/StringToUUIDConverter.java index 00d48b22a8..6a3d858569 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/StringToUUIDConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/StringToUUIDConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2019 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. @@ -32,7 +32,7 @@ final class StringToUUIDConverter implements Converter { @Override public UUID convert(String source) { - return (StringUtils.hasLength(source) ? UUID.fromString(source.trim()) : null); + return (StringUtils.hasText(source) ? UUID.fromString(source.trim()) : null); } }