jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r682313 - in /jackrabbit/branches/1.4/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
Date Mon, 04 Aug 2008 10:20:22 GMT
Author: jukka
Date: Mon Aug  4 03:20:21 2008
New Revision: 682313

URL: http://svn.apache.org/viewvc?rev=682313&view=rev
Log:
1.4: Merged revision 680135 (JCR-1644)

Modified:
    jackrabbit/branches/1.4/jackrabbit-core/   (props changed)
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java

Propchange: jackrabbit/branches/1.4/jackrabbit-core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug  4 03:20:21 2008
@@ -1 +1 @@
-/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,679389
+/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,679389,680135

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java?rev=682313&r1=682312&r2=682313&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
Mon Aug  4 03:20:21 2008
@@ -90,14 +90,15 @@
      * @throws NamespaceException if the prefix is not mapped
      */
     public String getURI(String prefix) throws NamespaceException {
-        String uri = (String) prefixToURI.get(prefix);
-        if (uri != null) {
-            return uri;
-        } else if (parent != null) {
-            return parent.getURI(prefix);
-        } else {
-            throw new NamespaceException("Unknown prefix: " + prefix);
+        NamespaceContext current = this;
+        while (current != null) {
+            String uri = (String) current.prefixToURI.get(prefix);
+            if (uri != null) {
+                return uri;
+            }
+            current = current.parent;
         }
+        throw new NamespaceException("Unknown prefix: " + prefix);
     }
 
     /**
@@ -108,13 +109,14 @@
      * @throws NamespaceException if the URI is not mapped
      */
     public String getPrefix(String uri) throws NamespaceException {
-        String prefix = (String) uriToPrefix.get(uri);
-        if (prefix != null) {
-            return prefix;
-        } else if (parent != null) {
-            return parent.getPrefix(uri);
-        } else {
-            throw new NamespaceException("Unknown URI: " + uri);
+        NamespaceContext current = this;
+        while (current != null) {
+            String prefix = (String) current.uriToPrefix.get(uri);
+            if (prefix != null) {
+                return prefix;
+            }
+            current = current.parent;
         }
+        throw new NamespaceException("Unknown URI: " + uri);
     }
 }



Mime
View raw message