Skip to content

Commit

Permalink
Fix for Bug#26819691, SETTING PACKETDEBUGBUFFERSIZE=0 RESULTS IN CONN…
Browse files Browse the repository at this point in the history
…ECTION FAILURE.
  • Loading branch information
fjssilva committed Feb 1, 2018
1 parent 40bf621 commit e42ce76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Version 5.1.46

- Fix for Bug#26819691, SETTING PACKETDEBUGBUFFERSIZE=0 RESULTS IN CONNECTION FAILURE.

- WL#11200, Add caching_sha2_password support.

- Fix for Bug#88227 (27029657), Connector/J 5.1.44 cannot be used against MySQL 5.7.20 without warnings.
Expand Down
4 changes: 2 additions & 2 deletions src/com/mysql/jdbc/ConnectionPropertiesImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -980,7 +980,7 @@ protected static DriverPropertyInfo[] exposeAsDriverPropertyInfo(Properties info
private BooleanConnectionProperty nullNamePatternMatchesAll = new BooleanConnectionProperty("nullNamePatternMatchesAll", true,
Messages.getString("ConnectionProperties.nullNamePatternMatchesAll"), "3.1.8", MISC_CATEGORY, Integer.MIN_VALUE);

private IntegerConnectionProperty packetDebugBufferSize = new IntegerConnectionProperty("packetDebugBufferSize", 20, 0, Integer.MAX_VALUE,
private IntegerConnectionProperty packetDebugBufferSize = new IntegerConnectionProperty("packetDebugBufferSize", 20, 1, Integer.MAX_VALUE,
Messages.getString("ConnectionProperties.packetDebugBufferSize"), "3.1.3", DEBUGING_PROFILING_CATEGORY, 7);

private BooleanConnectionProperty padCharsWithSpace = new BooleanConnectionProperty("padCharsWithSpace", false,
Expand Down
20 changes: 18 additions & 2 deletions src/testsuite/regression/ConnectionRegressionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3105,8 +3105,8 @@ public void testBug56429() throws Exception {

assert (endConnCount > 0);

if (endConnCount - startConnCount >= 20) { // this may be bogus if run on a real system, we should probably look to see they're coming from this
// testsuite?
if (endConnCount - startConnCount >= 20) {
// this may be bogus if run on a real system, we should probably look to see they're coming from this testsuite?
fail("We're leaking connections even when not failed over");
}
} finally {
Expand Down Expand Up @@ -10766,4 +10766,20 @@ public ResultSetInternalMethods postProcess(String sql, com.mysql.jdbc.Statement
public void destroy() {
}
}

/**
* Tests fix for Bug#26819691, SETTING PACKETDEBUGBUFFERSIZE=0 RESULTS IN CONNECTION FAILURE.
*/
public void testBug26819691() throws Exception {
assertThrows(SQLException.class, "The connection property 'packetDebugBufferSize' only accepts integer values in the range of 1 - 2147483647, "
+ "the value '0' exceeds this range\\.", new Callable<Void>() {
@SuppressWarnings("synthetic-access")
public Void call() throws Exception {
getConnectionWithProps("packetDebugBufferSize=0,enablePacketDebug=true");
return null;
}
});

getConnectionWithProps("packetDebugBufferSize=1,enablePacketDebug=true").close();
}
}

0 comments on commit e42ce76

Please sign in to comment.