Permalink
Browse files

test: make testAlternatingBindType Java 6-compatible (#1139)

  • Loading branch information...
vlsi committed Mar 11, 2018
1 parent 7a586b6 commit bcdd4273bba7ae6b3348d47d4cdeb72e941d5acc
Showing with 8 additions and 2 deletions.
  1. +8 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java
@@ -42,6 +42,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

@@ -1354,8 +1355,12 @@ public void testAlternatingBindType() throws SQLException {
assumeBinaryModeForce();
PreparedStatement ps = con.prepareStatement("SELECT /*testAlternatingBindType*/ ?");
ResultSet rs;
Logger log = Logger.getLogger("org.postgresql");
AtomicInteger numOfReParses = new AtomicInteger();
Logger log = Logger.getLogger("org.postgresql.core.v3.SimpleQuery");
Level prevLevel = log.getLevel();
if (prevLevel == null || prevLevel.intValue() > Level.FINER.intValue()) {
log.setLevel(Level.FINER);
}
final AtomicInteger numOfReParses = new AtomicInteger();
Handler handler = new Handler() {
@Override
public void publish(LogRecord record) {
@@ -1418,6 +1423,7 @@ public void close() throws SecurityException {
} finally {
TestUtil.closeQuietly(ps);
log.removeHandler(handler);
log.setLevel(prevLevel);
}
}
}

0 comments on commit bcdd427

Please sign in to comment.