From 04fbfddb13e45a729a93d88c5aee8092bff2ca9c Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 5 Feb 2022 19:12:13 +0100 Subject: [PATCH] Polish contribution See gh-28011 --- .../lookup/AbstractRoutingDataSource.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java index 50b6d61667..cc71ba2c9d 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 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. @@ -147,21 +147,21 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple * Resolve the specified data source object into a DataSource instance. *

The default implementation handles DataSource instances and data source * names (to be resolved via a {@link #setDataSourceLookup DataSourceLookup}). - * @param dataSource the data source value object as specified in the + * @param dataSourceObject the data source value object as specified in the * {@link #setTargetDataSources targetDataSources} map * @return the resolved DataSource (never {@code null}) * @throws IllegalArgumentException in case of an unsupported value type */ - protected DataSource resolveSpecifiedDataSource(Object dataSource) throws IllegalArgumentException { - if (dataSource instanceof DataSource result) { - return result; + protected DataSource resolveSpecifiedDataSource(Object dataSourceObject) throws IllegalArgumentException { + if (dataSourceObject instanceof DataSource dataSource) { + return dataSource; } - else if (dataSource instanceof String name) { - return this.dataSourceLookup.getDataSource(name); + else if (dataSourceObject instanceof String dataSourceName) { + return this.dataSourceLookup.getDataSource(dataSourceName); } else { throw new IllegalArgumentException( - "Illegal data source value - only [javax.sql.DataSource] and String supported: " + dataSource); + "Illegal data source value - only [javax.sql.DataSource] and String supported: " + dataSourceObject); } }