cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r993465 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
Date Tue, 07 Sep 2010 18:44:18 GMT
Author: dkulp
Date: Tue Sep  7 18:44:17 2010
New Revision: 993465

URL: http://svn.apache.org/viewvc?rev=993465&view=rev
Log:
Merged revisions 992631 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r992631 | bimargulies | 2010-09-04 12:05:43 -0400 (Sat, 04 Sep 2010) | 1 line
  
  Fill in missing required behaviors of MapNamespaceContext.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java?rev=993465&r1=993464&r2=993465&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
Tue Sep  7 18:44:17 2010
@@ -21,7 +21,9 @@ package org.apache.cxf.helpers;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import javax.xml.XMLConstants;
 import javax.xml.namespace.NamespaceContext;
+
 import org.w3c.dom.Node;
 
 public  final class MapNamespaceContext implements NamespaceContext {
@@ -56,7 +58,13 @@ public  final class MapNamespaceContext 
 
     public String getNamespaceURI(String prefix) {
         if (null == prefix) {
-            throw new IllegalArgumentException("Null prefix to getNamespacePrefix");
+            throw new IllegalArgumentException("Null prefix to getNamespaceURI");
+        }
+        if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
+            return XMLConstants.XML_NS_URI;
+        }
+        if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
+            return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
         }
         // if we have a target node, facts-on-the-ground in its parent tree take precedence.
         if (targetNode != null) {
@@ -70,6 +78,16 @@ public  final class MapNamespaceContext 
     }
 
     public String getPrefix(String namespaceURI) {
+        if (namespaceURI == null) {
+            throw new IllegalArgumentException("Null namespace to getPrefix");
+        }
+        if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
+            return XMLConstants.XML_NS_PREFIX;
+        }
+        if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+            return XMLConstants.XMLNS_ATTRIBUTE;
+        }
+
         for (Map.Entry<String, String> e : namespaces.entrySet()) {
             if (e.getValue().equals(namespaceURI)) {
                 return e.getKey();



Mime
View raw message