Skip to content

Commit 4a1762b

Browse files
committed
SWS-521 - UnsupportedOperationException During Validation After Upgrade From 1.5.6 to 1.5.7
1 parent 1a20f5b commit 4a1762b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

xml/src/main/java/org/springframework/xml/namespace/SimpleNamespaceContext.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ public void bindNamespaceUri(String prefix, String namespaceUri) {
102102
Assert.notNull(namespaceUri, "No namespaceUri given");
103103
if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
104104
defaultNamespaceUri = namespaceUri;
105+
} else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
106+
Assert.isTrue(XMLConstants.XML_NS_URI.equals(namespaceUri), "Prefix \"" + prefix +
107+
"\" bound to namespace \"" + namespaceUri + "\" (should be \"" + XMLConstants.XML_NS_URI + "\")");
108+
} else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
109+
Assert.isTrue(XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceUri), "Prefix \"" + prefix +
110+
"\" bound to namespace \"" + namespaceUri + "\" (should be \"" +
111+
XMLConstants.XMLNS_ATTRIBUTE_NS_URI + "\")");
105112
}
106113
else {
107114
prefixToNamespaceUri.put(prefix, namespaceUri);
@@ -112,6 +119,7 @@ public void bindNamespaceUri(String prefix, String namespaceUri) {
112119
/** Removes all declared prefixes. */
113120
public void clear() {
114121
prefixToNamespaceUri.clear();
122+
namespaceUriToPrefixes.clear();
115123
}
116124

117125
/**

0 commit comments

Comments
 (0)