jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1346370 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
Date Tue, 05 Jun 2012 12:30:36 GMT
Author: reschke
Date: Tue Jun  5 12:30:35 2012
New Revision: 1346370

URL: http://svn.apache.org/viewvc?rev=1346370&view=rev
Log:
JCR-3328: close importXML file after reading (so that the subsequent delete() works)

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java?rev=1346370&r1=1346369&r2=1346370&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
Tue Jun  5 12:30:35 2012
@@ -268,22 +268,27 @@ abstract class AbstractImportXmlTest ext
         serialize(document);
         BufferedInputStream bin = new BufferedInputStream(new FileInputStream(file));
 
-        ContentHandler handler;
-        if (withWorkspace) {
-            handler = workspace.getImportContentHandler(absPath, uuidBehaviour);
-        } else {
-            handler = session.getImportContentHandler(absPath, uuidBehaviour);
-        }
-
-        XMLReader reader = XMLReaderFactory.createXMLReader();
-        reader.setFeature("http://xml.org/sax/features/namespaces", true);
-        reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+        try {
+            ContentHandler handler;
+            if (withWorkspace) {
+                handler = workspace.getImportContentHandler(absPath, uuidBehaviour);
+            } else {
+                handler = session.getImportContentHandler(absPath, uuidBehaviour);
+            }
 
-        reader.setContentHandler(handler);
-        reader.parse(new InputSource(bin));
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            reader.setFeature("http://xml.org/sax/features/namespaces", true);
+            reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+            
+            reader.setContentHandler(handler);
+            reader.parse(new InputSource(bin));
 
-        if (!withWorkspace) {
-            session.save();
+            if (!withWorkspace) {
+                session.save();
+            }
+        }
+        finally {
+            bin.close();
         }
     }
 



Mime
View raw message