File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
main/java/io/vertx/sqlclient
test/java/io/vertx/sqlclient/tck Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public class SqlConnectOptions extends NetClientOptions {
37
37
private boolean cachePreparedStatements = DEFAULT_CACHE_PREPARED_STATEMENTS ;
38
38
private int preparedStatementCacheMaxSize = DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE ;
39
39
private int preparedStatementCacheSqlLimit = DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT ;
40
- private Map <String , String > properties ;
40
+ private Map <String , String > properties = new HashMap <>( 4 ) ;
41
41
42
42
public SqlConnectOptions () {
43
43
super ();
@@ -60,7 +60,9 @@ public SqlConnectOptions(SqlConnectOptions other) {
60
60
this .cachePreparedStatements = other .cachePreparedStatements ;
61
61
this .preparedStatementCacheMaxSize = other .preparedStatementCacheMaxSize ;
62
62
this .preparedStatementCacheSqlLimit = other .preparedStatementCacheSqlLimit ;
63
- this .properties = new HashMap <>(other .properties );
63
+ if (other .properties != null ) {
64
+ this .properties = new HashMap <>(other .properties );
65
+ }
64
66
}
65
67
66
68
/**
Original file line number Diff line number Diff line change @@ -107,6 +107,22 @@ public void testCreatePool04(TestContext ctx) {
107
107
}));
108
108
}
109
109
110
+ @ Test
111
+ public void testCreatePool05 (TestContext ctx ) {
112
+ // The default options will be an instanceof the driver-specific class, so manually copy
113
+ // each option over onto a fresh generic options object to force the generic constructor path
114
+ SqlConnectOptions defaults = defaultOptions ();
115
+ SqlConnectOptions opts = new SqlConnectOptions ()
116
+ .setHost (defaults .getHost ())
117
+ .setPort (defaults .getPort ())
118
+ .setDatabase (defaults .getDatabase ())
119
+ .setUser (defaults .getUser ())
120
+ .setPassword (defaults .getPassword ());
121
+ Pool .pool (opts ).getConnection (ctx .asyncAssertSuccess (ar -> {
122
+ ar .close ();
123
+ }));
124
+ }
125
+
110
126
@ Test (expected = ServiceConfigurationError .class )
111
127
public void testRejectCreatePool01 (TestContext ctx ) {
112
128
Pool .pool (new BogusOptions ());
You can’t perform that action at this time.
0 commit comments