You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/02/22 22:05:45 UTC

svn commit: r915062 - in /cxf/branches/2.2.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java

Author: dkulp
Date: Mon Feb 22 21:05:44 2010
New Revision: 915062

URL: http://svn.apache.org/viewvc?rev=915062&view=rev
Log:
Merged revisions 915058 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r915058 | dkulp | 2010-02-22 15:58:28 -0500 (Mon, 22 Feb 2010) | 1 line
  
  Use original streamreader when possible in JAXB
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?rev=915062&r1=915061&r2=915062&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java (original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Mon Feb 22 21:05:44 2010
@@ -69,6 +69,7 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 import org.apache.ws.commons.schema.XmlSchemaElement;
@@ -744,8 +745,16 @@
             }
             if (source instanceof Node) {
                 obj = unmarshalWithClass ? u.unmarshal((Node)source, clazz) : u.unmarshal((Node)source);
+            } else if (source instanceof DepthXMLStreamReader) {
+                // JAXB optimizes a ton of stuff depending on the StreamReader impl. Thus,
+                // we REALLY want to pass the original reader in.   This is OK with JAXB
+                // as it doesn't read beyond the end so the DepthXMLStreamReader state
+                // would be OK when it returns.   The main winner is FastInfoset where parsing
+                // a testcase I have goes from about 300/sec to well over 1000.
+                DepthXMLStreamReader dr = (DepthXMLStreamReader)source;
+                obj = unmarshalWithClass ? u.unmarshal(dr.getReader(), clazz) : u
+                    .unmarshal(dr.getReader());
             } else if (source instanceof XMLStreamReader) {
-
                 obj = unmarshalWithClass ? u.unmarshal((XMLStreamReader)source, clazz) : u
                     .unmarshal((XMLStreamReader)source);
             } else if (source instanceof XMLEventReader) {