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) {