Skip to content

Commit e5475d6

Browse files
stsypanovsbrannen
authored andcommitted
Iterate over Map's entrySet() instead of keySet() in PropertyEditorRegistrySupport
Closes gh-27591
1 parent b728b46 commit e5475d6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -422,10 +422,13 @@ private PropertyEditor getCustomEditor(@Nullable Class<?> requiredType) {
422422
}
423423
if (editor == null) {
424424
// Find editor for superclass or interface.
425-
for (Iterator<Class<?>> it = this.customEditors.keySet().iterator(); it.hasNext() && editor == null;) {
426-
Class<?> key = it.next();
425+
for (Map.Entry<Class<?>, PropertyEditor> entry : this.customEditors.entrySet()) {
426+
if (editor != null) {
427+
break;
428+
}
429+
Class<?> key = entry.getKey();
427430
if (key.isAssignableFrom(requiredType)) {
428-
editor = this.customEditors.get(key);
431+
editor = entry.getValue();
429432
// Cache editor for search type, to avoid the overhead
430433
// of repeated assignable-from checks.
431434
if (this.customEditorCache == null) {

0 commit comments

Comments
 (0)