jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r478958 - /jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
Date Fri, 24 Nov 2006 19:41:34 GMT
Author: jukka
Date: Fri Nov 24 11:41:33 2006
New Revision: 478958

URL: http://svn.apache.org/viewvc?view=rev&rev=478958
Log:
1.1: Merged revision 467674 (JCR-629)

Modified:
    jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java

Modified: jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java?view=diff&rev=478958&r1=478957&r2=478958
==============================================================================
--- jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
(original)
+++ jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
Fri Nov 24 11:41:33 2006
@@ -16,24 +16,25 @@
  */
 package org.apache.jackrabbit.core.nodetype.compact;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
-import org.apache.jackrabbit.core.nodetype.PropDef;
-import org.apache.jackrabbit.core.nodetype.NodeDef;
-import org.apache.jackrabbit.core.nodetype.ValueConstraint;
-import org.apache.jackrabbit.core.value.InternalValue;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 
+import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
-import javax.jcr.NamespaceException;
 import javax.jcr.version.OnParentVersionAction;
-import java.io.Writer;
-import java.io.StringWriter;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Iterator;
+
+import org.apache.jackrabbit.core.nodetype.NodeDef;
+import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
+import org.apache.jackrabbit.core.nodetype.PropDef;
+import org.apache.jackrabbit.core.nodetype.ValueConstraint;
+import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.name.QName;
 
 /**
  * Prints node type defs in a compact notation
@@ -322,15 +323,7 @@
      * @throws IOException
      */
     private void writeItemDefName(QName name) throws IOException {
-        String s = resolve(name);
-        // check for '-' and '+'
-        if (s.indexOf('-') >= 0 || s.indexOf('+') >= 0) {
-            out.write('\'');
-            out.write(s);
-            out.write('\'');
-        } else {
-            out.write(s);
-        }
+        out.write(resolve(name));
     }
     /**
      * write required types
@@ -375,16 +368,25 @@
                 if (nsWriter != null) {
                     if (!usedNamespaces.contains(prefix)) {
                         usedNamespaces.add(prefix);
-                        nsWriter.write('<');
+                        nsWriter.write("<'");
                         nsWriter.write(prefix);
-                        nsWriter.write("='");
+                        nsWriter.write("'='");
                         nsWriter.write(escape(qname.getNamespaceURI()));
                         nsWriter.write("'>\n");
                     }
                 }
                 prefix += ":";
             }
-            return prefix + qname.getLocalName();
+
+            String resolvedName = prefix + qname.getLocalName();
+
+            // check for '-' and '+'
+            if (resolvedName.indexOf('-') >= 0 || resolvedName.indexOf('+') >= 0) {
+                return "'" + resolvedName + "'";
+            } else {
+                return resolvedName;
+            }
+
         } catch (NamespaceException e) {
             return qname.toString();
         }



Mime
View raw message