cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: Don't use the unmarshall method that takes an InputStream as it's very slow due to creation of parsers. Also make sure the streams are closed
Date Tue, 01 Jul 2014 15:56:30 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 73b6eee99 -> 34c814b64


Don't use the unmarshall method that takes an InputStream as it's very slow due to creation
of parsers.
Also make sure the streams are closed


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/34c814b6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/34c814b6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/34c814b6

Branch: refs/heads/master
Commit: 34c814b641c482864d121452ac7d8fa7ed0a545a
Parents: 73b6eee
Author: Daniel Kulp <dkulp@apache.org>
Authored: Tue Jul 1 11:23:32 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Tue Jul 1 11:26:59 2014 -0400

----------------------------------------------------------------------
 .../apache/cxf/ws/rm/persistence/PersistenceUtils.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/34c814b6/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
index 079ec00..c4e8e7a 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
@@ -24,9 +24,11 @@ import java.io.InputStream;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement;
 
 /**
@@ -52,14 +54,22 @@ public final class PersistenceUtils {
     
     public SequenceAcknowledgement deserialiseAcknowledgment(InputStream is) {
         Object obj = null;
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
         try {
-            obj = getContext().createUnmarshaller().unmarshal(is);
+            obj = getContext().createUnmarshaller().unmarshal(reader);
             if (obj instanceof JAXBElement<?>) {
                 JAXBElement<?> el = (JAXBElement<?>)obj;
                 obj = el.getValue();
             }
         } catch (JAXBException ex) {
             throw new RMStoreException(ex);
+        } finally {
+            try {
+                StaxUtils.close(reader);
+                is.close();
+            } catch (Throwable t) {
+                //ignore, just cleaning up
+            }
         }
         return (SequenceAcknowledgement)obj;
     }


Mime
View raw message