|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2012 the original author or authors. |
| 2 | + * Copyright 2002-2013 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
23 | 23 | import java.sql.ResultSet;
|
24 | 24 | import java.sql.SQLException;
|
25 | 25 | import java.sql.SQLXML;
|
26 |
| - |
27 | 26 | import javax.xml.transform.Result;
|
28 | 27 | import javax.xml.transform.Source;
|
29 | 28 | import javax.xml.transform.dom.DOMResult;
|
30 | 29 | import javax.xml.transform.dom.DOMSource;
|
31 | 30 |
|
32 |
| -import org.springframework.dao.DataAccessResourceFailureException; |
33 | 31 | import org.w3c.dom.Document;
|
34 | 32 |
|
| 33 | +import org.springframework.dao.DataAccessResourceFailureException; |
| 34 | + |
35 | 35 | /**
|
36 | 36 | * Default implementation of the {@link SqlXmlHandler} interface.
|
37 | 37 | * Provides database-specific implementations for storing and
|
@@ -83,12 +83,14 @@ public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLE
|
83 | 83 |
|
84 | 84 | @Override
|
85 | 85 | public Source getXmlAsSource(ResultSet rs, String columnName, Class<? extends Source> sourceClass) throws SQLException {
|
86 |
| - return rs.getSQLXML(columnName).getSource(sourceClass != null ? sourceClass : DOMSource.class); |
| 86 | + SQLXML xmlObject = rs.getSQLXML(columnName); |
| 87 | + return (sourceClass != null ? xmlObject.getSource(sourceClass) : xmlObject.getSource(DOMSource.class)); |
87 | 88 | }
|
88 | 89 |
|
89 | 90 | @Override
|
90 | 91 | public Source getXmlAsSource(ResultSet rs, int columnIndex, Class<? extends Source> sourceClass) throws SQLException {
|
91 |
| - return rs.getSQLXML(columnIndex).getSource(sourceClass != null ? sourceClass : DOMSource.class); |
| 92 | + SQLXML xmlObject = rs.getSQLXML(columnIndex); |
| 93 | + return (sourceClass != null ? xmlObject.getSource(sourceClass) : xmlObject.getSource(DOMSource.class)); |
92 | 94 | }
|
93 | 95 |
|
94 | 96 |
|
|
0 commit comments