jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1837389 - in /jackrabbit/branches/2.14: ./ jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddNodeTest.java jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Date Fri, 03 Aug 2018 17:50:14 GMT
Author: reschke
Date: Fri Aug  3 17:50:14 2018
New Revision: 1837389

URL: http://svn.apache.org/viewvc?rev=1837389&view=rev
Log:
JCR-4317: davex remoting fails for non-ASCII characters in node names (ported to 2.14)

Modified:
    jackrabbit/branches/2.14/   (props changed)
    jackrabbit/branches/2.14/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddNodeTest.java
    jackrabbit/branches/2.14/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java

Propchange: jackrabbit/branches/2.14/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug  3 17:50:14 2018
@@ -1,3 +1,3 @@
 /jackrabbit/branches/JCR-2272:1173165-1176545
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1776907,1776911-1776912,1776914,1776918,1779166,1779460,1779614,1779632,1780208,1780220,1780335-1780336,1780406,1785225,1786325,1786330,1787043,1787381,1792100,1792105,1792113,1792193,1793315,1793323,1793327,1793332,1793339,1796980,1797209,1797917,1798586,1799429,1799538,1799549,1799575,1800359,1800378,1800752,1802925,1802977,1807234,1807244,1808752,1808754,1809149,1809329,1809624,1810108,1811667,1812543,1812634,1812994,1814831,1817094,1817097-1817098,1817100,1817113,1817201,1817213,1817373,1817377,1818586,1819269,1819271,1819839,1819849,1820119,1820133,1820294,1820573,1820675,1821247,1821475,1821597,1821705,1821880,1822643,1822863,1822947,1822950,1824756,1824763-1824764,1824771,1824876,1826230,1826647,1826940,1826964,1828213,1830107,1830201,1830540,1830753,1830814,1830878,1830951,1831854,1831860,1832058,1832090,1833374,1834008
+/jackrabbit/trunk:1776907,1776911-1776912,1776914,1776918,1779166,1779460,1779614,1779632,1780208,1780220,1780335-1780336,1780406,1785225,1786325,1786330,1787043,1787381,1792100,1792105,1792113,1792193,1793315,1793323,1793327,1793332,1793339,1796980,1797209,1797917,1798586,1799429,1799538,1799549,1799575,1800359,1800378,1800752,1802925,1802977,1807234,1807244,1808752,1808754,1809149,1809329,1809624,1810108,1811667,1812543,1812634,1812994,1814831,1817094,1817097-1817098,1817100,1817113,1817201,1817213,1817373,1817377,1818586,1819269,1819271,1819839,1819849,1820119,1820133,1820294,1820573,1820675,1821247,1821475,1821597,1821705,1821880,1822643,1822863,1822947,1822950,1824756,1824763-1824764,1824771,1824876,1826230,1826647,1826940,1826964,1828213,1830107,1830201,1830540,1830753,1830814,1830878,1830951,1831854,1831860,1832058,1832090,1833374,1833835,1834008

Modified: jackrabbit/branches/2.14/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.14/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddNodeTest.java?rev=1837389&r1=1837388&r2=1837389&view=diff
==============================================================================
--- jackrabbit/branches/2.14/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddNodeTest.java
(original)
+++ jackrabbit/branches/2.14/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddNodeTest.java
Fri Aug  3 17:50:14 2018
@@ -16,26 +16,20 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.ByteArrayInputStream;
 
 import javax.jcr.Node;
-import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.lock.LockException;
 
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
 /**
  * <code>AddNodeTest</code>...
  */
 public class AddNodeTest extends AbstractJCRTest {
 
     /**
-     * logger instance
-     */
-    private static final Logger log = LoggerFactory.getLogger(AddNodeTest.class);
-
-    /**
      * Writing to a locked node must throw LockException even if the lock
      * isn't detected withing Jcr2Spi.
      *
@@ -48,7 +42,7 @@ public class AddNodeTest extends Abstrac
             Node node = s.getNode(testRootNode.getPath());
             Node n = node.addNode(nodeName1);
             n.setProperty(propertyName1, "value");
-            
+
             testRootNode.lock(true, true);
 
             s.save();
@@ -58,4 +52,26 @@ public class AddNodeTest extends Abstrac
             s.logout();
         }
     }
+
+    public void testAddNodeNonASCII() throws Exception {
+        String testName = "test - \u20ac";
+        Session s = getHelper().getSuperuserSession();
+        try {
+            Node node = s.getNode(testRootNode.getPath());
+            Node n = node.addNode(testName, "nt:file");
+            Node c = n.addNode("jcr:content", "nt:resource");
+            c.setProperty("jcr:data", s.getValueFactory().createBinary(new ByteArrayInputStream("hello
world".getBytes("UTF-8"))));
+            s.save();
+        } finally {
+            s.logout();
+        }
+
+        Session s2 = getHelper().getReadOnlySession();
+        try {
+            Node node = s2.getNode(testRootNode.getPath()).getNode(testName);
+            assertEquals(testName, node.getName());
+        } finally {
+            s2.logout();
+        }
+    }
 }
\ No newline at end of file

Modified: jackrabbit/branches/2.14/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.14/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java?rev=1837389&r1=1837388&r2=1837389&view=diff
==============================================================================
--- jackrabbit/branches/2.14/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
(original)
+++ jackrabbit/branches/2.14/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Fri Aug  3 17:50:14 2018
@@ -40,6 +40,7 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.mime.FormBodyPart;
+import org.apache.http.entity.mime.HttpMultipartMode;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.jackrabbit.JcrConstants;
@@ -615,7 +616,8 @@ public class RepositoryServiceImpl exten
             // engine has a form-size restriction (JCR-3726)
             Utils.addPart(PARAM_DIFF, buf.toString(), parts);
 
-            MultipartEntityBuilder b = MultipartEntityBuilder.create();
+            // JCR-4317: need RFC6532 mode so that values are encoded in UTF-8
+            MultipartEntityBuilder b = MultipartEntityBuilder.create().setMode(HttpMultipartMode.RFC6532);
             for (FormBodyPart p : parts) {
                 b.addPart(p.getName(), p.getBody());
             }



Mime
View raw message