Skip to content

Commit

Permalink
Mark SqlRowSet accessor methods as nullable (for alignment with JDBC)
Browse files Browse the repository at this point in the history
Closes gh-24042
  • Loading branch information
jhoeller committed Nov 20, 2019
1 parent 83f0397 commit aee33d8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,6 +29,7 @@
import java.util.Map;

import org.springframework.jdbc.InvalidResultSetAccessException;
import org.springframework.lang.Nullable;

/**
* The default implementation of Spring's {@link SqlRowSet} interface, wrapping a
Expand Down Expand Up @@ -160,6 +161,7 @@ public int findColumn(String columnLabel) throws InvalidResultSetAccessException
* @see java.sql.ResultSet#getBigDecimal(int)
*/
@Override
@Nullable
public BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getBigDecimal(columnIndex);
Expand All @@ -173,6 +175,7 @@ public BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessEx
* @see java.sql.ResultSet#getBigDecimal(String)
*/
@Override
@Nullable
public BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException {
return getBigDecimal(findColumn(columnLabel));
}
Expand Down Expand Up @@ -223,6 +226,7 @@ public byte getByte(String columnLabel) throws InvalidResultSetAccessException {
* @see java.sql.ResultSet#getDate(int)
*/
@Override
@Nullable
public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getDate(columnIndex);
Expand All @@ -236,6 +240,7 @@ public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
* @see java.sql.ResultSet#getDate(String)
*/
@Override
@Nullable
public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
return getDate(findColumn(columnLabel));
}
Expand All @@ -244,6 +249,7 @@ public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
* @see java.sql.ResultSet#getDate(int, Calendar)
*/
@Override
@Nullable
public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
return this.resultSet.getDate(columnIndex, cal);
Expand All @@ -257,6 +263,7 @@ public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccess
* @see java.sql.ResultSet#getDate(String, Calendar)
*/
@Override
@Nullable
public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getDate(findColumn(columnLabel), cal);
}
Expand Down Expand Up @@ -349,6 +356,7 @@ public long getLong(String columnLabel) throws InvalidResultSetAccessException {
* @see java.sql.ResultSet#getNString(int)
*/
@Override
@Nullable
public String getNString(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getNString(columnIndex);
Expand All @@ -362,6 +370,7 @@ public String getNString(int columnIndex) throws InvalidResultSetAccessException
* @see java.sql.ResultSet#getNString(String)
*/
@Override
@Nullable
public String getNString(String columnLabel) throws InvalidResultSetAccessException {
return getNString(findColumn(columnLabel));
}
Expand All @@ -370,6 +379,7 @@ public String getNString(String columnLabel) throws InvalidResultSetAccessExcept
* @see java.sql.ResultSet#getObject(int)
*/
@Override
@Nullable
public Object getObject(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getObject(columnIndex);
Expand All @@ -383,6 +393,7 @@ public Object getObject(int columnIndex) throws InvalidResultSetAccessException
* @see java.sql.ResultSet#getObject(String)
*/
@Override
@Nullable
public Object getObject(String columnLabel) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel));
}
Expand All @@ -391,6 +402,7 @@ public Object getObject(String columnLabel) throws InvalidResultSetAccessExcepti
* @see java.sql.ResultSet#getObject(int, Map)
*/
@Override
@Nullable
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
try {
return this.resultSet.getObject(columnIndex, map);
Expand All @@ -404,6 +416,7 @@ public Object getObject(int columnIndex, Map<String, Class<?>> map) throws Inval
* @see java.sql.ResultSet#getObject(String, Map)
*/
@Override
@Nullable
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel), map);
}
Expand All @@ -412,6 +425,7 @@ public Object getObject(String columnLabel, Map<String, Class<?>> map) throws In
* @see java.sql.ResultSet#getObject(int, Class)
*/
@Override
@Nullable
public <T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException {
try {
return this.resultSet.getObject(columnIndex, type);
Expand All @@ -425,6 +439,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAc
* @see java.sql.ResultSet#getObject(String, Class)
*/
@Override
@Nullable
public <T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel), type);
}
Expand Down Expand Up @@ -454,6 +469,7 @@ public short getShort(String columnLabel) throws InvalidResultSetAccessException
* @see java.sql.ResultSet#getString(int)
*/
@Override
@Nullable
public String getString(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getString(columnIndex);
Expand All @@ -467,6 +483,7 @@ public String getString(int columnIndex) throws InvalidResultSetAccessException
* @see java.sql.ResultSet#getString(String)
*/
@Override
@Nullable
public String getString(String columnLabel) throws InvalidResultSetAccessException {
return getString(findColumn(columnLabel));
}
Expand All @@ -475,6 +492,7 @@ public String getString(String columnLabel) throws InvalidResultSetAccessExcepti
* @see java.sql.ResultSet#getTime(int)
*/
@Override
@Nullable
public Time getTime(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getTime(columnIndex);
Expand All @@ -488,6 +506,7 @@ public Time getTime(int columnIndex) throws InvalidResultSetAccessException {
* @see java.sql.ResultSet#getTime(String)
*/
@Override
@Nullable
public Time getTime(String columnLabel) throws InvalidResultSetAccessException {
return getTime(findColumn(columnLabel));
}
Expand All @@ -496,6 +515,7 @@ public Time getTime(String columnLabel) throws InvalidResultSetAccessException {
* @see java.sql.ResultSet#getTime(int, Calendar)
*/
@Override
@Nullable
public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
return this.resultSet.getTime(columnIndex, cal);
Expand All @@ -509,6 +529,7 @@ public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccess
* @see java.sql.ResultSet#getTime(String, Calendar)
*/
@Override
@Nullable
public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getTime(findColumn(columnLabel), cal);
}
Expand All @@ -517,6 +538,7 @@ public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAcc
* @see java.sql.ResultSet#getTimestamp(int)
*/
@Override
@Nullable
public Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getTimestamp(columnIndex);
Expand All @@ -530,6 +552,7 @@ public Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessExce
* @see java.sql.ResultSet#getTimestamp(String)
*/
@Override
@Nullable
public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel));
}
Expand All @@ -538,6 +561,7 @@ public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessE
* @see java.sql.ResultSet#getTimestamp(int, Calendar)
*/
@Override
@Nullable
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
return this.resultSet.getTimestamp(columnIndex, cal);
Expand All @@ -551,6 +575,7 @@ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResul
* @see java.sql.ResultSet#getTimestamp(String, Calendar)
*/
@Override
@Nullable
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel), cal);
}
Expand Down

0 comments on commit aee33d8

Please sign in to comment.