Skip to content

Commit 1e6f2e7

Browse files
committed
Adapted getXmlAsSource implementation to avoid compilation failure in IntelliJ IDEA
1 parent 1ee816b commit 1e6f2e7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,15 +23,15 @@
2323
import java.sql.ResultSet;
2424
import java.sql.SQLException;
2525
import java.sql.SQLXML;
26-
2726
import javax.xml.transform.Result;
2827
import javax.xml.transform.Source;
2928
import javax.xml.transform.dom.DOMResult;
3029
import javax.xml.transform.dom.DOMSource;
3130

32-
import org.springframework.dao.DataAccessResourceFailureException;
3331
import org.w3c.dom.Document;
3432

33+
import org.springframework.dao.DataAccessResourceFailureException;
34+
3535
/**
3636
* Default implementation of the {@link SqlXmlHandler} interface.
3737
* Provides database-specific implementations for storing and
@@ -83,12 +83,14 @@ public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLE
8383

8484
@Override
8585
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));
8788
}
8889

8990
@Override
9091
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));
9294
}
9395

9496

0 commit comments

Comments
 (0)