From 88b4625905ff45f6319ebcb72c07f382999349de Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Fri, 7 Dec 2012 10:39:01 +0000 Subject: [PATCH] SWS-819 - SimpleNamespaceContext.removeBinding() does not clean up all references --- .../xml/namespace/SimpleNamespaceContext.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xml/src/main/java/org/springframework/xml/namespace/SimpleNamespaceContext.java b/xml/src/main/java/org/springframework/xml/namespace/SimpleNamespaceContext.java index 6e0ec943..1f15e3d0 100644 --- a/xml/src/main/java/org/springframework/xml/namespace/SimpleNamespaceContext.java +++ b/xml/src/main/java/org/springframework/xml/namespace/SimpleNamespaceContext.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2005-2012 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -151,9 +151,11 @@ public class SimpleNamespaceContext implements NamespaceContext { * @param prefix the prefix to be removed */ public void removeBinding(String prefix) { - String namespaceUri = prefixToNamespaceUri.get(prefix); - Set prefixes = getPrefixesInternal(namespaceUri); - prefixes.remove(prefix); + String namespaceUri = prefixToNamespaceUri.remove(prefix); + if (namespaceUri != null) { + Set prefixes = getPrefixesInternal(namespaceUri); + prefixes.remove(prefix); + } } public boolean hasBinding(String prefix) {