Fix overridden methods nullability

Issue: SPR-15869
This commit is contained in:
Sebastien Deleuze
2017-08-17 14:30:14 +02:00
parent 6b6c1d3e53
commit 73cf07e9a4
488 changed files with 1016 additions and 34 deletions

View File

@@ -147,6 +147,7 @@ public interface JdbcOperations {
* @throws DataAccessException if there is any problem executing the query
* @see #queryForObject(String, Object[], RowMapper)
*/
@Nullable
<T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException;
/**
@@ -531,6 +532,7 @@ public interface JdbcOperations {
* return exactly one row
* @throws DataAccessException if the query fails
*/
@Nullable
<T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
throws DataAccessException;
@@ -549,6 +551,7 @@ public interface JdbcOperations {
* return exactly one row
* @throws DataAccessException if the query fails
*/
@Nullable
<T> T queryForObject(String sql, Object[] args, RowMapper<T> rowMapper) throws DataAccessException;
/**
@@ -566,6 +569,7 @@ public interface JdbcOperations {
* return exactly one row
* @throws DataAccessException if the query fails
*/
@Nullable
<T> T queryForObject(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws DataAccessException;
/**

View File

@@ -316,6 +316,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
//-------------------------------------------------------------------------
@Override
@Nullable
public <T> T execute(ConnectionCallback<T> action) throws DataAccessException {
Assert.notNull(action, "Callback object must not be null");
@@ -361,6 +362,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
//-------------------------------------------------------------------------
@Override
@Nullable
public <T> T execute(StatementCallback<T> action) throws DataAccessException {
Assert.notNull(action, "Callback object must not be null");
@@ -395,6 +397,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
class ExecuteStatementCallback implements StatementCallback<Object>, SqlProvider {
@Override
@Nullable
public Object doInStatement(Statement stmt) throws SQLException {
stmt.execute(sql);
return null;
@@ -408,6 +411,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T query(final String sql, final ResultSetExtractor<T> rse) throws DataAccessException {
Assert.notNull(sql, "SQL must not be null");
Assert.notNull(rse, "ResultSetExtractor must not be null");
@@ -416,6 +420,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
class QueryStatementCallback implements StatementCallback<T>, SqlProvider {
@Override
@Nullable
public T doInStatement(Statement stmt) throws SQLException {
ResultSet rs = null;
try {
@@ -452,12 +457,14 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
List<T> results = query(sql, rowMapper);
return DataAccessUtils.requiredSingleResult(results);
}
@Override
@Nullable
public <T> T queryForObject(String sql, Class<T> requiredType) throws DataAccessException {
return queryForObject(sql, getSingleColumnRowMapper(requiredType));
}
@@ -561,6 +568,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public String getSql() {
return this.currSql;
}
@@ -577,6 +585,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
//-------------------------------------------------------------------------
@Override
@Nullable
public <T> T execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action)
throws DataAccessException {
@@ -619,6 +628,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T execute(String sql, PreparedStatementCallback<T> action) throws DataAccessException {
return execute(new SimplePreparedStatementCreator(sql), action);
}
@@ -645,6 +655,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return execute(psc, new PreparedStatementCallback<T>() {
@Override
@Nullable
public T doInPreparedStatement(PreparedStatement ps) throws SQLException {
ResultSet rs = null;
try {
@@ -665,26 +676,31 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse) throws DataAccessException {
return query(psc, null, rse);
}
@Override
@Nullable
public <T> T query(String sql, @Nullable PreparedStatementSetter pss, ResultSetExtractor<T> rse) throws DataAccessException {
return query(new SimplePreparedStatementCreator(sql), pss, rse);
}
@Override
@Nullable
public <T> T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor<T> rse) throws DataAccessException {
return query(sql, newArgTypePreparedStatementSetter(args, argTypes), rse);
}
@Override
@Nullable
public <T> T query(String sql, @Nullable Object[] args, ResultSetExtractor<T> rse) throws DataAccessException {
return query(sql, newArgPreparedStatementSetter(args), rse);
}
@Override
@Nullable
public <T> T query(String sql, ResultSetExtractor<T> rse, @Nullable Object... args) throws DataAccessException {
return query(sql, newArgPreparedStatementSetter(args), rse);
}
@@ -740,6 +756,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
throws DataAccessException {
@@ -748,18 +765,21 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T queryForObject(String sql, @Nullable Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
List<T> results = query(sql, args, new RowMapperResultSetExtractor<>(rowMapper, 1));
return DataAccessUtils.requiredSingleResult(results);
}
@Override
@Nullable
public <T> T queryForObject(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws DataAccessException {
List<T> results = query(sql, args, new RowMapperResultSetExtractor<>(rowMapper, 1));
return DataAccessUtils.requiredSingleResult(results);
}
@Override
@Nullable
public <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType)
throws DataAccessException {
@@ -1010,6 +1030,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
//-------------------------------------------------------------------------
@Override
@Nullable
public <T> T execute(CallableStatementCreator csc, CallableStatementCallback<T> action)
throws DataAccessException {
@@ -1052,6 +1073,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public <T> T execute(String callString, CallableStatementCallback<T> action) throws DataAccessException {
return execute(new SimpleCallableStatementCreator(callString), action);
}
@@ -1523,6 +1545,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@Nullable
public Object extractData(ResultSet rs) throws SQLException {
while (rs.next()) {
this.rch.processRow(rs);

View File

@@ -20,8 +20,6 @@ import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;
import org.springframework.lang.Nullable;
/**
* Implement this interface when parameters need to be customized based
* on the connection. We might need to do this to make use of proprietary
@@ -45,7 +43,6 @@ public interface ParameterMapper {
* parameter values (that is, there's no need to catch SQLException)
* @return Map of input parameters, keyed by name (never {@code null})
*/
@Nullable
Map<String, ?> createMap(Connection con) throws SQLException;
}

View File

@@ -86,6 +86,7 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
*/
@Override
@SuppressWarnings("unchecked")
@Nullable
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
// Validate column count.
ResultSetMetaData rsmd = rs.getMetaData();

View File

@@ -65,6 +65,7 @@ public class Db2CallMetaDataProvider extends GenericCallMetaDataProvider {
}
@Override
@Nullable
public String metaDataSchemaNameToUse(@Nullable String schemaName) {
if (schemaName != null) {
return super.metaDataSchemaNameToUse(schemaName);

View File

@@ -36,6 +36,7 @@ public class DerbyCallMetaDataProvider extends GenericCallMetaDataProvider {
}
@Override
@Nullable
public String metaDataSchemaNameToUse(@Nullable String schemaName) {
if (schemaName != null) {
return super.metaDataSchemaNameToUse(schemaName);

View File

@@ -119,6 +119,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
@Override
@Nullable
public String procedureNameToUse(@Nullable String procedureName) {
if (procedureName == null) {
return null;
@@ -135,6 +136,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
@Override
@Nullable
public String catalogNameToUse(@Nullable String catalogName) {
if (catalogName == null) {
return null;
@@ -151,6 +153,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
@Override
@Nullable
public String schemaNameToUse(@Nullable String schemaName) {
if (schemaName == null) {
return null;
@@ -167,6 +170,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
@Override
@Nullable
public String metaDataCatalogNameToUse(@Nullable String catalogName) {
if (isSupportsCatalogsInProcedureCalls()) {
return catalogNameToUse(catalogName);
@@ -177,6 +181,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
@Override
@Nullable
public String metaDataSchemaNameToUse(@Nullable String schemaName) {
if (isSupportsSchemasInProcedureCalls()) {
return schemaNameToUse(schemaName);
@@ -187,6 +192,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
@Override
@Nullable
public String parameterNameToUse(@Nullable String parameterName) {
if (parameterName == null) {
return null;

View File

@@ -124,6 +124,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
@Override
@Nullable
public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName) {
return null;
}
@@ -222,6 +223,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
@Override
@Nullable
public String tableNameToUse(@Nullable String tableName) {
if (tableName == null) {
return null;
@@ -238,6 +240,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
@Override
@Nullable
public String catalogNameToUse(@Nullable String catalogName) {
if (catalogName == null) {
return null;
@@ -254,6 +257,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
@Override
@Nullable
public String schemaNameToUse(@Nullable String schemaName) {
if (schemaName == null) {
return null;
@@ -270,11 +274,13 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
@Override
@Nullable
public String metaDataCatalogNameToUse(@Nullable String catalogName) {
return catalogNameToUse(catalogName);
}
@Override
@Nullable
public String metaDataSchemaNameToUse(@Nullable String schemaName) {
if (schemaName == null) {
return schemaNameToUse(getDefaultSchema());

View File

@@ -58,12 +58,14 @@ public class OracleCallMetaDataProvider extends GenericCallMetaDataProvider {
}
@Override
@Nullable
public String metaDataCatalogNameToUse(@Nullable String catalogName) {
// Oracle uses catalog name for package name or an empty string if no package
return (catalogName == null ? "" : catalogNameToUse(catalogName));
}
@Override
@Nullable
public String metaDataSchemaNameToUse(@Nullable String schemaName) {
// Use current user schema if no schema specified
return (schemaName == null ? getUserName() : super.metaDataSchemaNameToUse(schemaName));

View File

@@ -95,6 +95,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
}
@Override
@Nullable
protected String getDefaultSchema() {
if (this.defaultSchema != null) {
return defaultSchema;

View File

@@ -58,6 +58,7 @@ public class PostgresCallMetaDataProvider extends GenericCallMetaDataProvider {
}
@Override
@Nullable
public String metaDataSchemaNameToUse(@Nullable String schemaName) {
// Use public schema if no schema specified
return (schemaName == null ? "public" : super.metaDataSchemaNameToUse(schemaName));

View File

@@ -41,6 +41,7 @@ public class SqlServerCallMetaDataProvider extends GenericCallMetaDataProvider {
@Override
@Nullable
public String parameterNameToUse(@Nullable String parameterName) {
if (parameterName == null) {
return null;

View File

@@ -41,6 +41,7 @@ public class SybaseCallMetaDataProvider extends GenericCallMetaDataProvider {
@Override
@Nullable
public String parameterNameToUse(@Nullable String parameterName) {
if (parameterName == null) {
return null;

View File

@@ -19,6 +19,7 @@ package org.springframework.jdbc.core.namedparam;
import java.util.HashMap;
import java.util.Map;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -74,6 +75,7 @@ public abstract class AbstractSqlParameterSource implements SqlParameterSource {
* or {@code null} if not registered
*/
@Override
@Nullable
public String getTypeName(String paramName) {
Assert.notNull(paramName, "Parameter name must not be null");
return this.typeNames.get(paramName);

View File

@@ -63,6 +63,7 @@ public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource {
}
@Override
@Nullable
public Object getValue(String paramName) throws IllegalArgumentException {
try {
return this.beanWrapper.getPropertyValue(paramName);

View File

@@ -16,6 +16,8 @@
package org.springframework.jdbc.core.namedparam;
import org.springframework.lang.Nullable;
/**
* A simple empty implementation of the {@link SqlParameterSource} interface.
*
@@ -36,6 +38,7 @@ public class EmptySqlParameterSource implements SqlParameterSource {
}
@Override
@Nullable
public Object getValue(String paramName) throws IllegalArgumentException {
throw new IllegalArgumentException("This SqlParameterSource is empty");
}
@@ -46,6 +49,7 @@ public class EmptySqlParameterSource implements SqlParameterSource {
}
@Override
@Nullable
public String getTypeName(String paramName) {
return null;
}

View File

@@ -155,6 +155,7 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource {
}
@Override
@Nullable
public Object getValue(String paramName) {
if (!hasValue(paramName)) {
throw new IllegalArgumentException("No value registered for key '" + paramName + "'");

View File

@@ -239,6 +239,7 @@ public interface NamedParameterJdbcOperations {
* one column in that row
* @throws org.springframework.dao.DataAccessException if the query fails
*/
@Nullable
<T> T queryForObject(String sql, SqlParameterSource paramSource, RowMapper<T> rowMapper)
throws DataAccessException;
@@ -256,6 +257,7 @@ public interface NamedParameterJdbcOperations {
* one column in that row
* @throws org.springframework.dao.DataAccessException if the query fails
*/
@Nullable
<T> T queryForObject(String sql, Map<String, ?> paramMap, RowMapper<T> rowMapper)
throws DataAccessException;

View File

@@ -130,6 +130,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
@Override
@Nullable
public <T> T execute(String sql, SqlParameterSource paramSource, PreparedStatementCallback<T> action)
throws DataAccessException {
@@ -137,6 +138,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T execute(String sql, Map<String, ?> paramMap, PreparedStatementCallback<T> action)
throws DataAccessException {
@@ -144,11 +146,13 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T execute(String sql, PreparedStatementCallback<T> action) throws DataAccessException {
return execute(sql, EmptySqlParameterSource.INSTANCE, action);
}
@Override
@Nullable
public <T> T query(String sql, SqlParameterSource paramSource, ResultSetExtractor<T> rse)
throws DataAccessException {
@@ -156,6 +160,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T query(String sql, Map<String, ?> paramMap, ResultSetExtractor<T> rse)
throws DataAccessException {
@@ -163,6 +168,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T query(String sql, ResultSetExtractor<T> rse) throws DataAccessException {
return query(sql, EmptySqlParameterSource.INSTANCE, rse);
}
@@ -206,6 +212,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T queryForObject(String sql, SqlParameterSource paramSource, RowMapper<T> rowMapper)
throws DataAccessException {
@@ -214,6 +221,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T queryForObject(String sql, Map<String, ?> paramMap, RowMapper<T>rowMapper)
throws DataAccessException {
@@ -221,6 +229,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T queryForObject(String sql, SqlParameterSource paramSource, Class<T> requiredType)
throws DataAccessException {
@@ -228,6 +237,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
}
@Override
@Nullable
public <T> T queryForObject(String sql, Map<String, ?> paramMap, Class<T> requiredType)
throws DataAccessException {

View File

@@ -25,6 +25,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.LobRetrievalFailureException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.lang.Nullable;
/**
* Abstract ResultSetExtractor implementation that assumes streaming of LOB data.
@@ -65,6 +66,7 @@ public abstract class AbstractLobStreamingResultSetExtractor<T> implements Resul
* @see org.springframework.jdbc.LobRetrievalFailureException
*/
@Override
@Nullable
public final T extractData(ResultSet rs) throws SQLException, DataAccessException {
if (!rs.next()) {
handleNoRowFound();

View File

@@ -66,6 +66,7 @@ public class EmbeddedDatabaseFactoryBean extends EmbeddedDatabaseFactory
@Override
@Nullable
public DataSource getObject() {
return getDataSource();
}

View File

@@ -17,6 +17,7 @@
package org.springframework.jdbc.datasource.lookup;
import org.springframework.core.Constants;
import org.springframework.lang.Nullable;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.transaction.support.TransactionSynchronizationManager;
@@ -119,6 +120,7 @@ public class IsolationLevelDataSourceRouter extends AbstractRoutingDataSource {
}
@Override
@Nullable
protected Object determineCurrentLookupKey() {
return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
}

View File

@@ -61,6 +61,7 @@ public abstract class MappingSqlQuery<T> extends MappingSqlQueryWithParameters<T
* @see #mapRow(ResultSet, int)
*/
@Override
@Nullable
protected final T mapRow(ResultSet rs, int rowNum, @Nullable Object[] parameters, @Nullable Map<?, ?> context)
throws SQLException {

View File

@@ -117,6 +117,7 @@ public abstract class MappingSqlQueryWithParameters<T> extends SqlQuery<T> {
}
@Override
@Nullable
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
return MappingSqlQueryWithParameters.this.mapRow(rs, rowNum, this.params, this.context);
}

View File

@@ -127,6 +127,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
* of rows returned, this is treated as an error.
*/
@Override
@Nullable
protected T mapRow(ResultSet rs, int rowNum) throws SQLException {
return this.rowMapper.mapRow(rs, rowNum);
}

View File

@@ -64,6 +64,7 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
* {@link #getFallbackTranslator() fallback translator} if necessary.
*/
@Override
@Nullable
public DataAccessException translate(@Nullable String task, @Nullable String sql, SQLException ex) {
Assert.notNull(ex, "Cannot translate a null SQLException");
if (task == null) {

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.lang.Nullable;
/**
* Default implementation of the {@link KeyHolder} interface, to be used for
@@ -58,6 +59,7 @@ public class GeneratedKeyHolder implements KeyHolder {
@Override
@Nullable
public Number getKey() throws InvalidDataAccessApiUsageException, DataRetrievalFailureException {
if (this.keyList.size() == 0) {
return null;
@@ -85,6 +87,7 @@ public class GeneratedKeyHolder implements KeyHolder {
}
@Override
@Nullable
public Map<String, Object> getKeys() throws InvalidDataAccessApiUsageException {
if (this.keyList.size() == 0) {
return null;

View File

@@ -168,6 +168,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@Override
@Nullable
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
SQLException sqlEx = ex;
if (sqlEx instanceof BatchUpdateException && sqlEx.getNextException() != null) {

View File

@@ -88,6 +88,7 @@ public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLException
@Override
@Nullable
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
// First, the getSQLState check...
String sqlState = getSqlState(ex);

View File

@@ -21,6 +21,8 @@ import java.io.Reader;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.lang.Nullable;
/**
* Abstract base class for {@link LobHandler} implementations.
*
@@ -34,21 +36,25 @@ import java.sql.SQLException;
public abstract class AbstractLobHandler implements LobHandler {
@Override
@Nullable
public byte[] getBlobAsBytes(ResultSet rs, String columnName) throws SQLException {
return getBlobAsBytes(rs, rs.findColumn(columnName));
}
@Override
@Nullable
public InputStream getBlobAsBinaryStream(ResultSet rs, String columnName) throws SQLException {
return getBlobAsBinaryStream(rs, rs.findColumn(columnName));
}
@Override
@Nullable
public String getClobAsString(ResultSet rs, String columnName) throws SQLException {
return getClobAsString(rs, rs.findColumn(columnName));
}
@Override
@Nullable
public InputStream getClobAsAsciiStream(ResultSet rs, String columnName) throws SQLException {
return getClobAsAsciiStream(rs, rs.findColumn(columnName));
}

View File

@@ -148,6 +148,7 @@ public class DefaultLobHandler extends AbstractLobHandler {
@Override
@Nullable
public byte[] getBlobAsBytes(ResultSet rs, int columnIndex) throws SQLException {
logger.debug("Returning BLOB as bytes");
if (this.wrapAsLob) {
@@ -160,6 +161,7 @@ public class DefaultLobHandler extends AbstractLobHandler {
}
@Override
@Nullable
public InputStream getBlobAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException {
logger.debug("Returning BLOB as binary stream");
if (this.wrapAsLob) {
@@ -172,6 +174,7 @@ public class DefaultLobHandler extends AbstractLobHandler {
}
@Override
@Nullable
public String getClobAsString(ResultSet rs, int columnIndex) throws SQLException {
logger.debug("Returning CLOB as string");
if (this.wrapAsLob) {

View File

@@ -53,42 +53,49 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
//-------------------------------------------------------------------------
@Override
@Nullable
public String getXmlAsString(ResultSet rs, String columnName) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnName);
return (xmlObject != null ? xmlObject.getString() : null);
}
@Override
@Nullable
public String getXmlAsString(ResultSet rs, int columnIndex) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnIndex);
return (xmlObject != null ? xmlObject.getString() : null);
}
@Override
@Nullable
public InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnName);
return (xmlObject != null ? xmlObject.getBinaryStream() : null);
}
@Override
@Nullable
public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnIndex);
return (xmlObject != null ? xmlObject.getBinaryStream() : null);
}
@Override
@Nullable
public Reader getXmlAsCharacterStream(ResultSet rs, String columnName) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnName);
return (xmlObject != null ? xmlObject.getCharacterStream() : null);
}
@Override
@Nullable
public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnIndex);
return (xmlObject != null ? xmlObject.getCharacterStream() : null);
}
@Override
@Nullable
public Source getXmlAsSource(ResultSet rs, String columnName, @Nullable Class<? extends Source> sourceClass)
throws SQLException {
@@ -100,6 +107,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
}
@Override
@Nullable
public Source getXmlAsSource(ResultSet rs, int columnIndex, @Nullable Class<? extends Source> sourceClass)
throws SQLException {