Skip to content

Commit a86b735

Browse files
dependabot[bot]injectives
authored andcommitted
build(deps): Bump org.neo4j:cypher-v5-antlr-parser from 5.26.6 to 5.26.7 (#977)
Bumps org.neo4j:cypher-v5-antlr-parser from 5.26.6 to 5.26.7. --- updated-dependencies: - dependency-name: org.neo4j:cypher-v5-antlr-parser dependency-version: 5.26.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent acb0f7e commit a86b735

File tree

7 files changed

+74
-151
lines changed

7 files changed

+74
-151
lines changed

neo4j-jdbc/src/main/java/module-info.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626

2727
// start::shaded-dependencies
2828
requires io.github.cdimascio.dotenv.java;
29-
requires io.netty.buffer;
30-
requires io.netty.codec;
31-
requires io.netty.common;
32-
requires io.netty.handler;
33-
requires io.netty.resolver;
34-
requires io.netty.transport;
3529
requires org.neo4j.bolt.connection;
3630
requires org.neo4j.bolt.connection.netty;
3731
requires org.neo4j.jdbc.translator.spi;

neo4j-jdbc/src/main/java/org/neo4j/jdbc/DriverThread.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

neo4j-jdbc/src/main/java/org/neo4j/jdbc/DriverThreadFactory.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDriver.java

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.lang.reflect.InvocationTargetException;
2323
import java.net.URI;
24+
import java.net.URISyntaxException;
2425
import java.net.URLDecoder;
2526
import java.net.URLEncoder;
2627
import java.nio.charset.StandardCharsets;
@@ -30,7 +31,6 @@
3031
import java.sql.DriverManager;
3132
import java.sql.DriverPropertyInfo;
3233
import java.sql.SQLException;
33-
import java.time.Clock;
3434
import java.util.ArrayList;
3535
import java.util.Arrays;
3636
import java.util.Collection;
@@ -46,30 +46,23 @@
4646
import java.util.ServiceLoader;
4747
import java.util.Set;
4848
import java.util.TreeMap;
49-
import java.util.concurrent.CompletableFuture;
5049
import java.util.concurrent.ConcurrentHashMap;
5150
import java.util.function.Supplier;
5251
import java.util.logging.Level;
5352
import java.util.logging.Logger;
5453
import java.util.regex.Pattern;
5554

5655
import io.github.cdimascio.dotenv.Dotenv;
57-
import io.netty.channel.EventLoopGroup;
58-
import io.netty.channel.nio.NioEventLoopGroup;
59-
import org.neo4j.bolt.connection.AccessMode;
6056
import org.neo4j.bolt.connection.AuthToken;
6157
import org.neo4j.bolt.connection.AuthTokens;
6258
import org.neo4j.bolt.connection.BoltConnection;
6359
import org.neo4j.bolt.connection.BoltConnectionProvider;
6460
import org.neo4j.bolt.connection.BoltProtocolVersion;
65-
import org.neo4j.bolt.connection.BoltServerAddress;
66-
import org.neo4j.bolt.connection.DatabaseNameUtil;
67-
import org.neo4j.bolt.connection.DefaultDomainNameResolver;
6861
import org.neo4j.bolt.connection.NotificationConfig;
6962
import org.neo4j.bolt.connection.RoutingContext;
7063
import org.neo4j.bolt.connection.SecurityPlan;
7164
import org.neo4j.bolt.connection.SecurityPlans;
72-
import org.neo4j.bolt.connection.netty.NettyBoltConnectionProvider;
65+
import org.neo4j.bolt.connection.netty.NettyBoltConnectionProviderFactory;
7366
import org.neo4j.jdbc.Neo4jException.GQLError;
7467
import org.neo4j.jdbc.events.ConnectionListener;
7568
import org.neo4j.jdbc.events.DriverListener;
@@ -228,12 +221,11 @@ public final class Neo4jDriver implements Neo4jDriverExtensions {
228221
*/
229222
public static final String PROPERTY_SSL_MODE = "sslMode";
230223

231-
private static final EventLoopGroup DEFAULT_EVENT_LOOP_GROUP = new NioEventLoopGroup(new DriverThreadFactory());
232-
233224
private static final String URL_REGEX = "^jdbc:neo4j(?:\\+(?<transport>s(?:sc)?)?)?://(?<host>[^:/?]+):?(?<port>\\d+)?/?(?<database>[^?]+)?\\??(?<urlParams>\\S+)?$";
234225

235226
/**
236227
* The URL pattern that this driver supports.
228+
*
237229
* @since 6.2.0
238230
*/
239231
public static final Pattern URL_PATTERN = Pattern.compile(URL_REGEX);
@@ -344,9 +336,8 @@ public static Optional<Connection> fromEnv(Path directory, String filename) thro
344336
* machinery for JDBC.
345337
*/
346338
public Neo4jDriver() {
347-
this(new NettyBoltConnectionProvider(DEFAULT_EVENT_LOOP_GROUP, Clock.systemUTC(),
348-
DefaultDomainNameResolver.getInstance(), null, BoltAdapters.newLoggingProvider(),
349-
BoltAdapters.getValueFactory(), null));
339+
this(new NettyBoltConnectionProviderFactory().create(BoltAdapters.newLoggingProvider(),
340+
BoltAdapters.getValueFactory(), null, Map.of("eventLoopThreadNamePrefix", "Neo4jJDBCDriverIO")));
350341
}
351342

352343
Neo4jDriver(BoltConnectionProvider boltConnectionProvider) {
@@ -358,8 +349,6 @@ public Neo4jDriver() {
358349
public Connection connect(String url, Properties info) throws SQLException {
359350
var driverConfig = DriverConfig.of(url, info);
360351

361-
var address = new BoltServerAddress(driverConfig.host, driverConfig.port);
362-
363352
var securityPlan = parseSSLParams(driverConfig.sslProperties);
364353

365354
var databaseName = driverConfig.database;
@@ -392,9 +381,9 @@ public Connection connect(String url, Properties info) throws SQLException {
392381
}
393382

394383
var targetUrl = driverConfig.toUrl();
384+
var boltUrl = createBoltUri(driverConfig);
395385
var connection = new ConnectionImpl(targetUrl,
396-
() -> establishBoltConnection(address, userAgent, connectTimeoutMillis, securityPlan, databaseName,
397-
authToken),
386+
() -> establishBoltConnection(boltUrl, userAgent, connectTimeoutMillis, securityPlan, authToken),
398387
getSqlTranslatorSupplier(enableSqlTranslation, driverConfig.rawConfig(), translatorFactoriesSupplier),
399388
enableSqlTranslation, enableTranslationCaching, rewriteBatchedStatements, rewritePlaceholders,
400389
bookmarkManager, this.transactionMetadata, driverConfig.relationshipSampleSize(), databaseName,
@@ -417,18 +406,26 @@ public Connection connect(String url, Properties info) throws SQLException {
417406
return connection;
418407
}
419408

420-
private BoltConnection establishBoltConnection(BoltServerAddress address, String userAgent,
421-
int connectTimeoutMillis, SecurityPlan securityPlan, String databaseName, AuthToken authToken) {
409+
private BoltConnection establishBoltConnection(URI uri, String userAgent, int connectTimeoutMillis,
410+
SecurityPlan securityPlan, AuthToken authToken) {
422411
return this.boltConnectionProvider
423-
.connect(address, RoutingContext.EMPTY, BoltAdapters.newAgent(ProductVersion.getValue()), userAgent,
424-
connectTimeoutMillis, securityPlan, DatabaseNameUtil.database(databaseName),
425-
() -> CompletableFuture.completedStage(authToken), AccessMode.WRITE, Collections.emptySet(), null,
426-
MIN_BOLT_VERSION, NotificationConfig.defaultConfig(), ignored -> {
427-
}, Collections.emptyMap())
412+
.connect(uri, RoutingContext.EMPTY, BoltAdapters.newAgent(ProductVersion.getValue()), userAgent,
413+
connectTimeoutMillis, securityPlan, authToken, MIN_BOLT_VERSION, NotificationConfig.defaultConfig())
428414
.toCompletableFuture()
429415
.join();
430416
}
431417

418+
private static URI createBoltUri(DriverConfig driverConfig) throws Neo4jException {
419+
URI uri;
420+
try {
421+
uri = new URI("bolt", null, driverConfig.host, driverConfig.port, null, null, null);
422+
}
423+
catch (URISyntaxException ignored) {
424+
throw new Neo4jException(GQLError.$22000.withMessage("Failed to create Bolt URI"));
425+
}
426+
return uri;
427+
}
428+
432429
static String getDefaultUserAgent() {
433430
return "neo4j-jdbc/%s".formatted(ProductVersion.getValue());
434431
}
@@ -589,7 +586,7 @@ private static SecurityPlan parseSSLParams(SSLProperties sslProperties) throws S
589586
throw new Neo4jException(withInternal(ex));
590587
}
591588
}
592-
case DISABLE -> SecurityPlans.unencrypted();
589+
case DISABLE -> null;
593590
};
594591
}
595592

neo4j-jdbc/src/test/java/org/neo4j/jdbc/DatabaseMetadataImplTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ void beforeEach() {
5353
CompletableFuture<BoltConnection> boltConnectionCompletableFuture = mock();
5454
given(boltConnectionCompletableFuture.join()).willReturn(mock());
5555
given(mockedFuture.toCompletableFuture()).willReturn(boltConnectionCompletableFuture);
56-
given(this.boltConnectionProvider.connect(any(), any(), any(), any(), anyInt(), any(), any(), any(), any(),
57-
any(), any(), any(), any(), any(), any()))
56+
given(this.boltConnectionProvider.connect(any(), any(), any(), any(), anyInt(), any(), any(), any(), any()))
5857
.willReturn(mockedFuture);
5958
}
6059

0 commit comments

Comments
 (0)