Skip to content

Commit a07a8da

Browse files
committed
RESOLVED - BATCH-1856: ExtendedConnectionDataSourceProxy compilation
error in JDK 7 fix Java 5 compilation regression
1 parent fd00ae6 commit a07a8da

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxy.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.lang.reflect.Proxy;
2424
import java.sql.Connection;
2525
import java.sql.SQLException;
26-
import java.sql.SQLFeatureNotSupportedException;
2726
import java.util.logging.Logger;
2827

2928
import javax.sql.DataSource;
@@ -323,8 +322,13 @@ public void afterPropertiesSet() throws Exception {
323322
Assert.notNull(dataSource);
324323
}
325324

326-
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
327-
throw new SQLFeatureNotSupportedException();
325+
/**
326+
* Added due to JDK 7 compatibility, sadly a proper implementation
327+
* that would throw SqlFeatureNotSupportedException is not possible
328+
* in Java 5 (the class was added in Java 6).
329+
*/
330+
public Logger getParentLogger() {
331+
throw new UnsupportedOperationException();
328332
}
329333

330334
}

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package org.springframework.batch.item.database;
22

3-
import static org.easymock.EasyMock.*;
4-
import static org.junit.Assert.*;
3+
import static org.easymock.EasyMock.createMock;
4+
import static org.easymock.EasyMock.expect;
5+
import static org.easymock.EasyMock.replay;
6+
import static org.easymock.EasyMock.verify;
7+
import static org.junit.Assert.assertEquals;
8+
import static org.junit.Assert.assertFalse;
9+
import static org.junit.Assert.assertNotSame;
10+
import static org.junit.Assert.assertSame;
11+
import static org.junit.Assert.assertTrue;
12+
import static org.junit.Assert.fail;
513

614
import java.io.PrintWriter;
715
import java.sql.Connection;
816
import java.sql.ResultSet;
917
import java.sql.SQLException;
10-
import java.sql.SQLFeatureNotSupportedException;
1118
import java.sql.Statement;
1219
import java.util.logging.Logger;
1320

@@ -333,8 +340,13 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
333340
throw new SQLException(UNWRAP_ERROR_MESSAGE);
334341
}
335342

336-
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
337-
throw new SQLFeatureNotSupportedException();
343+
/**
344+
* Added due to JDK 7 compatibility, sadly a proper implementation
345+
* that would throw SqlFeatureNotSupportedException is not possible
346+
* in Java 5 (the class was added in Java 6).
347+
*/
348+
public Logger getParentLogger() {
349+
throw new UnsupportedOperationException();
338350
}
339351

340352
}

0 commit comments

Comments
 (0)