diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxy.java index f870b161a..b6cabd21c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxy.java @@ -23,7 +23,6 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.sql.Connection; import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; import java.util.logging.Logger; import javax.sql.DataSource; @@ -323,8 +322,13 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi Assert.notNull(dataSource); } - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - throw new SQLFeatureNotSupportedException(); + /** + * Added due to JDK 7 compatibility, sadly a proper implementation + * that would throw SqlFeatureNotSupportedException is not possible + * in Java 5 (the class was added in Java 6). + */ + public Logger getParentLogger() { + throw new UnsupportedOperationException(); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java index 18cbfc4b7..94fc066c7 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java @@ -1,13 +1,20 @@ package org.springframework.batch.item.database; -import static org.easymock.EasyMock.*; -import static org.junit.Assert.*; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.PrintWriter; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; import java.sql.Statement; import java.util.logging.Logger; @@ -333,8 +340,13 @@ public class ExtendedConnectionDataSourceProxyTests { throw new SQLException(UNWRAP_ERROR_MESSAGE); } - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - throw new SQLFeatureNotSupportedException(); + /** + * Added due to JDK 7 compatibility, sadly a proper implementation + * that would throw SqlFeatureNotSupportedException is not possible + * in Java 5 (the class was added in Java 6). + */ + public Logger getParentLogger() { + throw new UnsupportedOperationException(); } }