diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/DuplicatePostProcessingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/DuplicatePostProcessingTests.java index d31b609434..bb7d2f6407 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/DuplicatePostProcessingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/DuplicatePostProcessingTests.java @@ -18,7 +18,6 @@ package org.springframework.context.annotation.configuration; import org.junit.Test; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.FactoryBean; @@ -67,7 +66,7 @@ public class DuplicatePostProcessingTests { private final ExampleBean exampleBean = new ExampleBean(); @Override - public ExampleBean getObject() throws Exception { + public ExampleBean getObject() { return this.exampleBean; } @@ -87,14 +86,13 @@ public class DuplicatePostProcessingTests { private ApplicationContext applicationContext; - @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + public Object postProcessBeforeInitialization(Object bean, String beanName) { return bean; } @Override - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof ExampleBean) { this.applicationContext.publishEvent(new ExampleApplicationEvent(this)); } @@ -102,12 +100,13 @@ public class DuplicatePostProcessingTests { } @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } } + @SuppressWarnings("serial") static class ExampleApplicationEvent extends ApplicationEvent { public ExampleApplicationEvent(Object source) { @@ -126,7 +125,7 @@ public class DuplicatePostProcessingTests { } @Override - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + public void setBeanFactory(BeanFactory beanFactory) { this.beanFactory = beanFactory; } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ColumnMapRowMapper.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ColumnMapRowMapper.java index 1a0ac8277f..32788402d0 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ColumnMapRowMapper.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ColumnMapRowMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -51,13 +51,12 @@ public class ColumnMapRowMapper implements RowMapper> { public Map mapRow(ResultSet rs, int rowNum) throws SQLException { ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); - Map mapOfColValues = createColumnMap(columnCount); + Map mapOfColumnValues = createColumnMap(columnCount); for (int i = 1; i <= columnCount; i++) { - String key = getColumnKey(JdbcUtils.lookupColumnName(rsmd, i)); - Object obj = getColumnValue(rs, i); - mapOfColValues.put(key, obj); + String column = JdbcUtils.lookupColumnName(rsmd, i); + mapOfColumnValues.put(getColumnKey(column), getColumnValue(rs, i)); } - return mapOfColValues; + return mapOfColumnValues; } /** diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java index 501122df75..57c7f13258 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java @@ -38,6 +38,7 @@ import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.lang.UsesJava7; import org.springframework.util.ClassUtils; import org.springframework.util.NumberUtils; +import org.springframework.util.StringUtils; /** * Generic utility methods for working with JDBC. Mainly for internal use @@ -335,7 +336,7 @@ public abstract class JdbcUtils { return action.processMetaData(metaData); } catch (CannotGetJdbcConnectionException ex) { - throw new MetaDataAccessException("Could not get Connection for extracting meta data", ex); + throw new MetaDataAccessException("Could not get Connection for extracting meta-data", ex); } catch (SQLException ex) { throw new MetaDataAccessException("Error while extracting DatabaseMetaData", ex); @@ -458,13 +459,13 @@ public abstract class JdbcUtils { *

columnLabel - the label for the column specified with the SQL AS clause. * If the SQL AS clause was not specified, then the label is the name of the column. * @return the column name to use - * @param resultSetMetaData the current meta data to use + * @param resultSetMetaData the current meta-data to use * @param columnIndex the index of the column for the look up * @throws SQLException in case of lookup failure */ public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException { String name = resultSetMetaData.getColumnLabel(columnIndex); - if (name == null || name.length() < 1) { + if (!StringUtils.hasLength(name)) { name = resultSetMetaData.getColumnName(columnIndex); } return name; diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java index 089274d096..0fc841a3a7 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -98,15 +98,15 @@ public class DefaultPersistenceUnitManager * Default location of the {@code persistence.xml} file: * "classpath*:META-INF/persistence.xml". */ - public final static String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF/" + PERSISTENCE_XML_FILENAME; + public static final String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF/" + PERSISTENCE_XML_FILENAME; /** * Default location for the persistence unit root URL: * "classpath:", indicating the root of the classpath. */ - public final static String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION = "classpath:"; + public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION = "classpath:"; - public final static String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_NAME = "default"; + public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_NAME = "default"; private static final Set entityTypeFilters;