Skip to content

Commit ca17dc0

Browse files
committed
SimpleAliasRegistry prevents NPE for alias resolved to null
Issue: SPR-13016 (cherry picked from commit e83d495)
1 parent 51c941c commit ca17dc0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -122,7 +122,7 @@ public void resolveAliases(StringValueResolver valueResolver) {
122122
String registeredName = aliasCopy.get(alias);
123123
String resolvedAlias = valueResolver.resolveStringValue(alias);
124124
String resolvedName = valueResolver.resolveStringValue(registeredName);
125-
if (resolvedAlias.equals(resolvedName)) {
125+
if (resolvedAlias == null || resolvedName == null || resolvedAlias.equals(resolvedName)) {
126126
this.aliasMap.remove(alias);
127127
}
128128
else if (!resolvedAlias.equals(alias)) {

0 commit comments

Comments
 (0)