Skip to content

Commit c04c8a2

Browse files
committed
Polishing
1 parent f39adcf commit c04c8a2

File tree

7 files changed

+71
-165
lines changed

7 files changed

+71
-165
lines changed

spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -151,6 +151,7 @@ public V get(Object key) {
151151
}
152152

153153
@Override
154+
@Nullable
154155
public V getOrDefault(Object key, V defaultValue) {
155156
if (key instanceof String) {
156157
String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key));
@@ -162,6 +163,7 @@ public V getOrDefault(Object key, V defaultValue) {
162163
}
163164

164165
@Override
166+
@Nullable
165167
public V put(String key, @Nullable V value) {
166168
String oldKey = this.caseInsensitiveKeys.put(convertKey(key), key);
167169
if (oldKey != null && !oldKey.equals(key)) {

spring-jdbc/src/main/java/org/springframework/jdbc/core/ColumnMapRowMapper.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -52,13 +52,12 @@ public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
5252
public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
5353
ResultSetMetaData rsmd = rs.getMetaData();
5454
int columnCount = rsmd.getColumnCount();
55-
Map<String, Object> mapOfColValues = createColumnMap(columnCount);
55+
Map<String, Object> mapOfColumnValues = createColumnMap(columnCount);
5656
for (int i = 1; i <= columnCount; i++) {
57-
String key = getColumnKey(JdbcUtils.lookupColumnName(rsmd, i));
58-
Object obj = getColumnValue(rs, i);
59-
mapOfColValues.put(key, obj);
57+
String column = JdbcUtils.lookupColumnName(rsmd, i);
58+
mapOfColumnValues.put(getColumnKey(column), getColumnValue(rs, i));
6059
}
61-
return mapOfColValues;
60+
return mapOfColumnValues;
6261
}
6362

6463
/**

spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ public List<Object> matchInParameterValuesWithInsertColumns(Map<String, ?> inPar
253253
for (Map.Entry<String, ?> entry : inParameters.entrySet()) {
254254
if (column.equalsIgnoreCase(entry.getKey())) {
255255
value = entry.getValue();
256-
// TODO: break;
257256
}
258257
}
259258
}

spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.springframework.jdbc.datasource.DataSourceUtils;
3838
import org.springframework.lang.Nullable;
3939
import org.springframework.util.NumberUtils;
40+
import org.springframework.util.StringUtils;
4041

4142
/**
4243
* Generic utility methods for working with JDBC. Mainly for internal use
@@ -452,7 +453,7 @@ public static boolean isNumeric(int sqlType) {
452453
*/
453454
public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException {
454455
String name = resultSetMetaData.getColumnLabel(columnIndex);
455-
if (name == null || name.length() < 1) {
456+
if (!StringUtils.hasLength(name)) {
456457
name = resultSetMetaData.getColumnName(columnIndex);
457458
}
458459
return name;

0 commit comments

Comments
 (0)