Title: [1953] trunk: Deserialization from file or URL keeps stream open (XSTR-685).
Revision
1953
Author
joehni
Date
2011-12-29 07:28:47 -0600 (Thu, 29 Dec 2011)

Log Message

Deserialization from file or URL keeps stream open (XSTR-685).

Modified Paths


Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/XStream.java (1952 => 1953)


--- trunk/xstream/src/java/com/thoughtworks/xstream/XStream.java	2011-12-19 09:18:33 UTC (rev 1952)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/XStream.java	2011-12-29 13:28:47 UTC (rev 1953)
@@ -931,7 +931,7 @@
      * @since 1.4
      */
     public Object fromXML(URL url) {
-        return unmarshal(hierarchicalStreamDriver.createReader(url), null);
+        return fromXML(url, null);
     }
 
     /**
@@ -944,7 +944,7 @@
      * @since 1.4
      */
     public Object fromXML(File file) {
-        return unmarshal(hierarchicalStreamDriver.createReader(file), null);
+        return fromXML(file, null);
     }
 
     /**
@@ -1000,7 +1000,12 @@
      * @since 1.4
      */
     public Object fromXML(File file, Object root) {
-        return unmarshal(hierarchicalStreamDriver.createReader(file), root);
+        HierarchicalStreamReader reader = hierarchicalStreamDriver.createReader(file);
+        try {
+            return unmarshal(reader, root);
+        } finally {
+            reader.close();
+        }
     }
 
     /**

Modified: trunk/xstream-distribution/src/content/changes.html (1952 => 1953)


--- trunk/xstream-distribution/src/content/changes.html	2011-12-19 09:18:33 UTC (rev 1952)
+++ trunk/xstream-distribution/src/content/changes.html	2011-12-29 13:28:47 UTC (rev 1953)
@@ -35,7 +35,8 @@
     <h2>Minor changes</h2>
     
     <ul>
-    	<li>JIRA.XSTR-684: XML 1.0 character validation fails for characters from 0x10 to 0x1f.</li>
+    	<li>JIRA:XSTR-685: Deserialization from file or URL keeps stream open.</li>
+    	<li>JIRA:XSTR-684: XML 1.0 character validation fails for characters from 0x10 to 0x1f.</li>
     </ul>
 
     <h1 id="1.4.2">1.4.2</h1>
@@ -47,7 +48,7 @@
     <ul>
     	<li>XStream libraries can be used now directly in Android, therefore support of Java 1.4.2 has been stopped with the delivery.
     	Anyone who needs a version for Java 1.4.2 can build it easily from source, this build is still supported and part of CI.</li>
-    	<li>JIRA.XSTR-675: New extended HierarchicalStreamReader interface with peekNextChild method. All XStream
+    	<li>JIRA:XSTR-675: New extended HierarchicalStreamReader interface with peekNextChild method. All XStream
     	readers implement the new interface (by Nikita Levyankov).</li>
     	<li>JIRA:XSTR-673: Collections.EMPTY_LIST, Collections.EMPTY_SET and Collections.EMPTY_MAP supported with own
     	alias and defined as immutable.</li>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to