Skip to content

Commit 965f3c6

Browse files
committed
Polishing
1 parent 6df7ba2 commit 965f3c6

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

spring-context/src/test/java/org/springframework/context/annotation/configuration/DuplicatePostProcessingTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import org.junit.Test;
2020

21-
import org.springframework.beans.BeansException;
2221
import org.springframework.beans.factory.BeanFactory;
2322
import org.springframework.beans.factory.BeanFactoryAware;
2423
import org.springframework.beans.factory.FactoryBean;
@@ -67,7 +66,7 @@ static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
6766
private final ExampleBean exampleBean = new ExampleBean();
6867

6968
@Override
70-
public ExampleBean getObject() throws Exception {
69+
public ExampleBean getObject() {
7170
return this.exampleBean;
7271
}
7372

@@ -87,27 +86,27 @@ static class ExampleBeanPostProcessor implements BeanPostProcessor, ApplicationC
8786

8887
private ApplicationContext applicationContext;
8988

90-
9189
@Override
92-
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
90+
public Object postProcessBeforeInitialization(Object bean, String beanName) {
9391
return bean;
9492
}
9593

9694
@Override
97-
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
95+
public Object postProcessAfterInitialization(Object bean, String beanName) {
9896
if (bean instanceof ExampleBean) {
9997
this.applicationContext.publishEvent(new ExampleApplicationEvent(this));
10098
}
10199
return bean;
102100
}
103101

104102
@Override
105-
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
103+
public void setApplicationContext(ApplicationContext applicationContext) {
106104
this.applicationContext = applicationContext;
107105
}
108106
}
109107

110108

109+
@SuppressWarnings("serial")
111110
static class ExampleApplicationEvent extends ApplicationEvent {
112111

113112
public ExampleApplicationEvent(Object source) {
@@ -126,7 +125,7 @@ public void onApplicationEvent(ExampleApplicationEvent event) {
126125
}
127126

128127
@Override
129-
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
128+
public void setBeanFactory(BeanFactory beanFactory) {
130129
this.beanFactory = beanFactory;
131130
}
132131
}

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-2012 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.
@@ -51,13 +51,12 @@ public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
5151
public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
5252
ResultSetMetaData rsmd = rs.getMetaData();
5353
int columnCount = rsmd.getColumnCount();
54-
Map<String, Object> mapOfColValues = createColumnMap(columnCount);
54+
Map<String, Object> mapOfColumnValues = createColumnMap(columnCount);
5555
for (int i = 1; i <= columnCount; i++) {
56-
String key = getColumnKey(JdbcUtils.lookupColumnName(rsmd, i));
57-
Object obj = getColumnValue(rs, i);
58-
mapOfColValues.put(key, obj);
56+
String column = JdbcUtils.lookupColumnName(rsmd, i);
57+
mapOfColumnValues.put(getColumnKey(column), getColumnValue(rs, i));
5958
}
60-
return mapOfColValues;
59+
return mapOfColumnValues;
6160
}
6261

6362
/**

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.springframework.lang.UsesJava7;
3939
import org.springframework.util.ClassUtils;
4040
import org.springframework.util.NumberUtils;
41+
import org.springframework.util.StringUtils;
4142

4243
/**
4344
* Generic utility methods for working with JDBC. Mainly for internal use
@@ -335,7 +336,7 @@ public static Object extractDatabaseMetaData(DataSource dataSource, DatabaseMeta
335336
return action.processMetaData(metaData);
336337
}
337338
catch (CannotGetJdbcConnectionException ex) {
338-
throw new MetaDataAccessException("Could not get Connection for extracting meta data", ex);
339+
throw new MetaDataAccessException("Could not get Connection for extracting meta-data", ex);
339340
}
340341
catch (SQLException ex) {
341342
throw new MetaDataAccessException("Error while extracting DatabaseMetaData", ex);
@@ -458,13 +459,13 @@ public static boolean isNumeric(int sqlType) {
458459
* <p><i>columnLabel - the label for the column specified with the SQL AS clause.
459460
* If the SQL AS clause was not specified, then the label is the name of the column</i>.
460461
* @return the column name to use
461-
* @param resultSetMetaData the current meta data to use
462+
* @param resultSetMetaData the current meta-data to use
462463
* @param columnIndex the index of the column for the look up
463464
* @throws SQLException in case of lookup failure
464465
*/
465466
public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException {
466467
String name = resultSetMetaData.getColumnLabel(columnIndex);
467-
if (name == null || name.length() < 1) {
468+
if (!StringUtils.hasLength(name)) {
468469
name = resultSetMetaData.getColumnName(columnIndex);
469470
}
470471
return name;

spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 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.
@@ -98,15 +98,15 @@ public class DefaultPersistenceUnitManager
9898
* Default location of the {@code persistence.xml} file:
9999
* "classpath*:META-INF/persistence.xml".
100100
*/
101-
public final static String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF/" + PERSISTENCE_XML_FILENAME;
101+
public static final String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF/" + PERSISTENCE_XML_FILENAME;
102102

103103
/**
104104
* Default location for the persistence unit root URL:
105105
* "classpath:", indicating the root of the classpath.
106106
*/
107-
public final static String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION = "classpath:";
107+
public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION = "classpath:";
108108

109-
public final static String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_NAME = "default";
109+
public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_NAME = "default";
110110

111111

112112
private static final Set<TypeFilter> entityTypeFilters;

0 commit comments

Comments
 (0)