jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1868243 - in /jackrabbit/branches/2.18: ./ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
Date Thu, 10 Oct 2019 12:16:30 GMT
Author: reschke
Date: Thu Oct 10 12:16:30 2019
New Revision: 1868243

URL: http://svn.apache.org/viewvc?rev=1868243&view=rev
Log:
JCR-4484: jcr-tests: SerializationTest needs to cleanup after parse failures in import tests
(merged r1867133 into 2.18)

Modified:
    jackrabbit/branches/2.18/   (props changed)
    jackrabbit/branches/2.18/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java

Propchange: jackrabbit/branches/2.18/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 10 12:16:30 2019
@@ -1,3 +1,3 @@
 /jackrabbit/branches/JCR-2272:1173165-1176545
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1850224,1851360,1851369,1851372,1851380,1851384,1851904,1851946,1851953,1851961,1852417,1853927,1854018,1856855,1856969,1857631,1857721,1858564,1858566,1859534,1859563,1859633,1860118,1860123,1860645,1861773,1861777-1861778,1861781,1861786,1862283,1862783,1862805,1863196,1863222,1863384,1865525,1865748,1865991,1866234,1866280,1866448,1866728,1867128,1867130
+/jackrabbit/trunk:1850224,1851360,1851369,1851372,1851380,1851384,1851904,1851946,1851953,1851961,1852417,1853927,1854018,1856855,1856969,1857631,1857721,1858564,1858566,1859534,1859563,1859633,1860118,1860123,1860645,1861773,1861777-1861778,1861781,1861786,1862283,1862783,1862805,1863196,1863222,1863384,1865525,1865748,1865991,1866234,1866280,1866448,1866728,1867128,1867130,1867133

Modified: jackrabbit/branches/2.18/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.18/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java?rev=1868243&r1=1868242&r2=1868243&view=diff
==============================================================================
--- jackrabbit/branches/2.18/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
(original)
+++ jackrabbit/branches/2.18/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
Thu Oct 10 12:16:30 2019
@@ -249,18 +249,32 @@ public class SerializationTest extends A
         try {
             ih = session.getImportContentHandler(treeComparator.targetFolder,
                     ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
+            helpTestSaxException(ih, in, "session");
         } catch (RepositoryException e) {
             fail("ImportHandler not created: " + e);
+        } finally {
+            closeContentHandler(ih);
         }
-        helpTestSaxException(ih, in, "session");
 
         in = new StringReader("<this is not a <valid> <xml> file/>");
         try {
             ih = workspace.getImportContentHandler(treeComparator.targetFolder, 0);
+            helpTestSaxException(ih, in, "workspace");
         } catch (RepositoryException e) {
             fail("ImportHandler not created: " + e);
+        } finally {
+            closeContentHandler(ih);
+        }
+    }
+
+    private static void closeContentHandler(ContentHandler ch) {
+        if (ch != null) {
+            try {
+                ch.endDocument();
+            } catch (SAXException e) {
+                // best effort
+            }
         }
-        helpTestSaxException(ih, in, "workspace");
     }
 
     /**
@@ -583,11 +597,19 @@ public class SerializationTest extends A
         if (useHandler) {
             if (useWorkspace) {
                 ContentHandler ih = workspace.getImportContentHandler(absPath, 0);
-                createXMLReader(ih).parse(new InputSource(in));
+                try {
+                    createXMLReader(ih).parse(new InputSource(in));
+                } finally {
+                    ih.endDocument();
+                }
             } else {
                 ContentHandler ih = session.getImportContentHandler(absPath, 0);
-                createXMLReader(ih).parse(new InputSource(in));
-                session.save();
+                try {
+                    createXMLReader(ih).parse(new InputSource(in));
+                    session.save();
+                } finally {
+                    ih.endDocument();
+                }
             }
         } else {
             if (useWorkspace) {



Mime
View raw message