cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r725839 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
Date Thu, 11 Dec 2008 22:18:58 GMT
Author: dkulp
Date: Thu Dec 11 14:18:58 2008
New Revision: 725839

URL: http://svn.apache.org/viewvc?rev=725839&view=rev
Log:
Don't NPE if type is null

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java?rev=725839&r1=725838&r2=725839&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
Thu Dec 11 14:18:58 2008
@@ -53,40 +53,41 @@
     }
 
     public Object read(QName name, XMLStreamReader input, Class type) {
-        if (SAXSource.class.isAssignableFrom(type)) {
-            try {
-                CachedOutputStream out = new CachedOutputStream();
+        if (type != null) {
+            if (SAXSource.class.isAssignableFrom(type)) {
                 try {
-                    XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
-                    StaxUtils.copy(input, xsw);
-                    xsw.close();
-                    return new SAXSource(new InputSource(out.getInputStream()));
-                } finally {
-                    out.close();
+                    CachedOutputStream out = new CachedOutputStream();
+                    try {
+                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
+                        StaxUtils.copy(input, xsw);
+                        xsw.close();
+                        return new SAXSource(new InputSource(out.getInputStream()));
+                    } finally {
+                        out.close();
+                    }
+                } catch (IOException e) {
+                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+                } catch (XMLStreamException e) {
+                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                 }
-            } catch (IOException e) {
-                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
-            } catch (XMLStreamException e) {
-                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
-            }
-        } else if (StreamSource.class.isAssignableFrom(type)) {
-            try {
-                CachedOutputStream out = new CachedOutputStream();
+            } else if (StreamSource.class.isAssignableFrom(type)) {
                 try {
-                    XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
-                    StaxUtils.copy(input, xsw);
-                    xsw.close();
-                    return new StreamSource(out.getInputStream());
-                } finally {
-                    out.close();
+                    CachedOutputStream out = new CachedOutputStream();
+                    try {
+                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
+                        StaxUtils.copy(input, xsw);
+                        xsw.close();
+                        return new StreamSource(out.getInputStream());
+                    } finally {
+                        out.close();
+                    }
+                } catch (IOException e) {
+                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+                } catch (XMLStreamException e) {
+                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                 }
-            } catch (IOException e) {
-                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
-            } catch (XMLStreamException e) {
-                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
-            }
-        } 
-        
+            } 
+        }
         return read(input);
     }
 



Mime
View raw message