From e83d495cbba0796b1f2269b9ad7a02ffac1ca5a8 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 12 May 2015 22:04:44 +0200 Subject: [PATCH] SimpleAliasRegistry prevents NPE for alias resolved to null Issue: SPR-13016 --- .../java/org/springframework/core/SimpleAliasRegistry.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java b/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java index 82fe66159b..1dfe2db56d 100644 --- a/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java +++ b/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -122,7 +122,7 @@ public class SimpleAliasRegistry implements AliasRegistry { String registeredName = aliasCopy.get(alias); String resolvedAlias = valueResolver.resolveStringValue(alias); String resolvedName = valueResolver.resolveStringValue(registeredName); - if (resolvedAlias.equals(resolvedName)) { + if (resolvedAlias == null || resolvedName == null || resolvedAlias.equals(resolvedName)) { this.aliasMap.remove(alias); } else if (!resolvedAlias.equals(alias)) {