jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r633436 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: journal/AbstractRecord.java nodetype/compact/CompactNodeTypeDefWriter.java
Date Tue, 04 Mar 2008 11:46:29 GMT
Author: dpfister
Date: Tue Mar  4 03:46:28 2008
New Revision: 633436

URL: http://svn.apache.org/viewvc?rev=633436&view=rev
Log:
JCR-1449 - Registering nodetypes with empty namespace prefix causes a namespace exception
in sync node

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java?rev=633436&r1=633435&r2=633436&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
Tue Mar  4 03:46:28 2008
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefWriter;
 import org.apache.jackrabbit.core.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
@@ -245,7 +246,8 @@
         try {
             StringReader sr = new StringReader(readString());
 
-            CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(sr, "(internal)");
+            CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
+                    sr, "(internal)", new NamespaceMapping(nsResolver));
             List ntds = reader.getNodeTypeDefs();
             if (ntds.size() != 1) {
                 throw new JournalException("Expected one node type definition: got " + ntds.size());
@@ -270,5 +272,4 @@
         }
         return index;
     }
-
-}
+}
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java?rev=633436&r1=633435&r2=633436&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
Tue Mar  4 03:46:28 2008
@@ -306,11 +306,7 @@
         out.write("\n" + INDENT + "+ ");
 
         Name name = nd.getName();
-        if (name.equals(ItemDef.ANY_NAME)) {
-            out.write('*');
-        } else {
-            writeItemDefName(name);
-        }
+        writeItemDefName(name);
         writeRequiredTypes(nd.getRequiredPrimaryTypes());
         writeDefaultType(nd.getDefaultPrimaryType());
         out.write(ntd.getPrimaryItemName() != null && ntd.getPrimaryItemName().equals(nd.getName())
? " primary" : "");
@@ -338,7 +334,11 @@
      * @throws IOException
      */
     private void writeItemDefName(Name name) throws IOException {
-        out.write(resolve(name));
+        if (name.equals(ItemDef.ANY_NAME)) {
+            out.write('*');
+        } else {
+            out.write(resolve(name));
+        }
     }
     /**
      * write required types
@@ -378,18 +378,18 @@
         }
         try {
             String prefix = resolver.getPrefix(qname.getNamespaceURI());
-            if (prefix != null && !prefix.equals(Name.NS_EMPTY_PREFIX)) {
-                // check for writing namespaces
-                if (nsWriter != null) {
-                    if (!usedNamespaces.contains(prefix)) {
-                        usedNamespaces.add(prefix);
-                        nsWriter.write("<'");
-                        nsWriter.write(prefix);
-                        nsWriter.write("'='");
-                        nsWriter.write(escape(qname.getNamespaceURI()));
-                        nsWriter.write("'>\n");
-                    }
+            // check for writing namespaces
+            if (nsWriter != null) {
+                if (!usedNamespaces.contains(prefix)) {
+                    usedNamespaces.add(prefix);
+                    nsWriter.write("<'");
+                    nsWriter.write(prefix);
+                    nsWriter.write("'='");
+                    nsWriter.write(escape(qname.getNamespaceURI()));
+                    nsWriter.write("'>\n");
                 }
+            }
+            if (!prefix.equals(Name.NS_EMPTY_PREFIX)) {
                 prefix += ":";
             }
 



Mime
View raw message