jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r425649 - /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
Date Wed, 26 Jul 2006 07:21:25 GMT
Author: mreutegg
Date: Wed Jul 26 00:21:18 2006
New Revision: 425649

URL: http://svn.apache.org/viewvc?rev=425649&view=rev
Log:
JCR-490: TCK: ExportDocViewTest.exportValues fails on empty multivalued property

Modified:
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java?rev=425649&r1=425648&r2=425649&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
Wed Jul 26 00:21:18 2006
@@ -301,7 +301,7 @@
             throws RepositoryException, IOException {
 
         NodeIterator nodeIter = node.getNodes();
-        if (getSize(nodeIter) == 0) {
+        if (getSize(node.getNodes()) == 0) {
             assertTrue("Exported node " + node.getPath() + " has child elements " +
                     "although it has no child nodes ", 0 == countChildElems(elem));
         } else {
@@ -623,7 +623,7 @@
         long exported = countChildElems(elem);
         // child tree is exported too
         if (!noRecurse) {
-            size = getSize(iter);
+            size = getSize(node.getNodes());
             while (iter.hasNext()) {
                 Node n = iter.nextNode();
                 String name = n.getName();
@@ -654,7 +654,7 @@
             throws RepositoryException {
 
         PropertyIterator iter = node.getProperties();
-        long size = getSize(iter);
+        long size = getSize(node.getProperties());
         long exported = new AttributeSeparator(elem).getNonNsAttrs().size();
         while (iter.hasNext()) {
             Property prop = iter.nextProperty();
@@ -966,27 +966,28 @@
         Value[] vals = prop.getValues();
         // order of multi values is preserved.
         // multival with empty array is exported as empty string
-        String exportedVal = "";
+        StringBuffer exportedVal = new StringBuffer();
 
+        String space = "";
         if (isBinary) {
             for (int i = 0; i < vals.length; i++) {
+                exportedVal.append(space);
                 InputStream in = vals[i].getStream();
                 try {
-                    exportedVal += encodeBase64(in);
+                    exportedVal.append(encodeBase64(in));
                 } finally {
                     in.close();
                 }
-                exportedVal += " ";
+                space = " ";
             }
         } else {
             for (int i = 0; i < vals.length; i++) {
-                exportedVal += escapeValues(vals[i].getString());
-                exportedVal += " ";
+                exportedVal.append(space);
+                exportedVal.append(escapeValues(vals[i].getString()));
+                space = " ";
             }
         }
-        // remove the last space again
-        exportedVal = exportedVal.substring(0, exportedVal.length() - 1);
-        return exportedVal;
+        return exportedVal.toString();
     }
 
     /**



Mime
View raw message