diff --git a/driver/src/main/java/org/neo4j/driver/AuthTokens.java b/driver/src/main/java/org/neo4j/driver/AuthTokens.java
index 475c233aca..2459c776dd 100644
--- a/driver/src/main/java/org/neo4j/driver/AuthTokens.java
+++ b/driver/src/main/java/org/neo4j/driver/AuthTokens.java
@@ -116,7 +116,7 @@ public static AuthToken kerberos(String base64EncodedTicket) {
* A custom authentication token used for doing custom authentication on the server side.
* @param principal this used to identify who this token represents
* @param credentials this is credentials authenticating the principal
- * @param realm this is the "realm:, specifying the authentication provider.
+ * @param realm this is the "realm:", specifying the authentication provider.
* @param scheme this it the authentication scheme, specifying what kind of authentication that should be used
* @return an authentication token that can be used to connect to Neo4j
* @see GraphDatabase#driver(String, AuthToken)
@@ -130,7 +130,7 @@ public static AuthToken custom(String principal, String credentials, String real
* A custom authentication token used for doing custom authentication on the server side.
* @param principal this used to identify who this token represents
* @param credentials this is credentials authenticating the principal
- * @param realm this is the "realm:, specifying the authentication provider.
+ * @param realm this is the "realm:", specifying the authentication provider.
* @param scheme this it the authentication scheme, specifying what kind of authentication that should be used
* @param parameters extra parameters to be sent along the authentication provider.
* @return an authentication token that can be used to connect to Neo4j
diff --git a/driver/src/main/java/org/neo4j/driver/Bookmark.java b/driver/src/main/java/org/neo4j/driver/Bookmark.java
index 1cffb1f14a..1cd445ead5 100644
--- a/driver/src/main/java/org/neo4j/driver/Bookmark.java
+++ b/driver/src/main/java/org/neo4j/driver/Bookmark.java
@@ -29,7 +29,7 @@
* the database is as up-to-date as the latest transaction referenced by the supplied bookmarks.
*
* Within a session, bookmark propagation is carried out automatically.
- * Thus all transactions in a session (both managed and unmanaged) are guaranteed to be carried out one after another.
+ * Thus, all transactions in a session (both managed and unmanaged) are guaranteed to be carried out one after another.
*
* To opt out of this mechanism for unrelated units of work, applications can use multiple sessions.
*/
diff --git a/driver/src/main/java/org/neo4j/driver/Driver.java b/driver/src/main/java/org/neo4j/driver/Driver.java
index f89ddd53fd..09ec97631f 100644
--- a/driver/src/main/java/org/neo4j/driver/Driver.java
+++ b/driver/src/main/java/org/neo4j/driver/Driver.java
@@ -35,7 +35,7 @@
* and authentication settings are held immutably by the Driver. Should
* different settings be required, a new Driver instance should be created.
*
- * A driver maintains a connection pool for each remote Neo4j server. Therefore
+ * A driver maintains a connection pool for each remote Neo4j server. Therefore,
* the most efficient way to make use of a Driver is to use the same instance
* across the application.
*
@@ -83,7 +83,7 @@ public interface Driver extends AutoCloseable {
BookmarkManager executableQueryBookmarkManager();
/**
- * Return a flag to indicate whether or not encryption is used for this driver.
+ * Return a flag to indicate whether encryption is used for this driver.
*
* @return true if the driver requires encryption, false otherwise
*/
diff --git a/driver/src/main/java/org/neo4j/driver/Logger.java b/driver/src/main/java/org/neo4j/driver/Logger.java
index e22ee5facb..4a66504d31 100644
--- a/driver/src/main/java/org/neo4j/driver/Logger.java
+++ b/driver/src/main/java/org/neo4j/driver/Logger.java
@@ -23,7 +23,7 @@
*
* Some methods in this interface take a message template together with a list of parameters. These methods are expected to construct the final
* message only if the needed logging level is enabled. Driver expects formatting to be done using {@link String#format(String, Object...)} method.
- * Thus all supplied message templates will contain "%s" as parameter placeholders. This is different from all SLF4J-compatible logging frameworks
+ * Thus, all supplied message templates will contain "%s" as parameter placeholders. This is different from all SLF4J-compatible logging frameworks
* where parameter placeholder is "{}". Implementations of this interface should adapt placeholders from "%s" to "{}", if required.
*/
public interface Logger {
diff --git a/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java b/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
index 05a0d107b7..2b0a41e207 100644
--- a/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
+++ b/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
@@ -31,7 +31,6 @@
import java.time.Clock;
import java.util.function.Supplier;
import org.neo4j.driver.AuthTokenManager;
-import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.Config;
import org.neo4j.driver.Driver;
import org.neo4j.driver.Logging;
@@ -57,7 +56,6 @@
import org.neo4j.driver.internal.retry.RetryLogic;
import org.neo4j.driver.internal.security.SecurityPlan;
import org.neo4j.driver.internal.security.SecurityPlans;
-import org.neo4j.driver.internal.security.StaticAuthTokenManager;
import org.neo4j.driver.internal.spi.ConnectionPool;
import org.neo4j.driver.internal.spi.ConnectionProvider;
import org.neo4j.driver.internal.util.DriverInfoUtil;
@@ -96,8 +94,6 @@ public final Driver newInstance(
securityPlan = SecurityPlans.createSecurityPlan(settings, uri.getScheme());
}
- authTokenManager = authTokenManager == null ? new StaticAuthTokenManager(AuthTokens.none()) : authTokenManager;
-
var address = new BoltServerAddress(uri);
var routingSettings = new RoutingSettings(config.routingTablePurgeDelayMillis(), new RoutingContext(uri));
diff --git a/driver/src/test/java/org/neo4j/driver/integration/SessionIT.java b/driver/src/test/java/org/neo4j/driver/integration/SessionIT.java
index a26f09fb2b..78ff3bf163 100644
--- a/driver/src/test/java/org/neo4j/driver/integration/SessionIT.java
+++ b/driver/src/test/java/org/neo4j/driver/integration/SessionIT.java
@@ -1360,6 +1360,7 @@ private static Result updateNodeId(QueryRunner queryRunner, int currentId, int n
"MATCH (n {id: $currentId}) SET n.id = $newId", parameters("currentId", currentId, "newId", newId));
}
+ @SuppressWarnings("ConstantValue")
private static boolean assertOneOfTwoFuturesFailWithDeadlock(Future future1, Future future2)
throws Exception {
var firstFailed = false;
diff --git a/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveSessionIT.java b/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveSessionIT.java
index 9d07b9cbd8..8b88842017 100644
--- a/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveSessionIT.java
+++ b/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveSessionIT.java
@@ -56,6 +56,7 @@
import org.reactivestreams.Subscription;
import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.Flux;
+import reactor.util.annotation.NonNull;
@EnabledOnNeo4jWith(BOLT_V4)
@ParallelizableIT
@@ -161,7 +162,7 @@ void shouldRollbackResultOnSubscriptionCancellation() {
flowPublisherToFlux(session.run("CREATE ({id: $id})", Map.of("id", nodeId)))
.subscribe(new BaseSubscriber<>() {
@Override
- protected void hookOnSubscribe(Subscription subscription) {
+ protected void hookOnSubscribe(@NonNull Subscription subscription) {
subscription.cancel();
cancellationFuture.complete(null);
}
diff --git a/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveStreamsSessionIT.java b/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveStreamsSessionIT.java
index 354f8090ec..51ffdb6b40 100644
--- a/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveStreamsSessionIT.java
+++ b/driver/src/test/java/org/neo4j/driver/integration/reactive/ReactiveStreamsSessionIT.java
@@ -54,6 +54,7 @@
import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import reactor.util.annotation.NonNull;
@EnabledOnNeo4jWith(BOLT_V4)
@ParallelizableIT
@@ -97,14 +98,14 @@ void shouldReleaseResultsOnSubscriptionCancellation(boolean request) throws Inte
.run("UNWIND range (0,10000) AS x RETURN x")
.subscribe(new BaseSubscriber<>() {
@Override
- protected void hookOnSubscribe(Subscription subscription) {
+ protected void hookOnSubscribe(@NonNull Subscription subscription) {
// use subscription from another thread to avoid immediate cancellation
// within the subscribe method
subscriptionFuture.complete(subscription);
}
@Override
- protected void hookOnNext(ReactiveResult result) {
+ protected void hookOnNext(@NonNull ReactiveResult result) {
Mono.fromDirect(result.consume()).subscribe();
}
});
@@ -150,7 +151,7 @@ void shouldRollbackResultOnSubscriptionCancellation() {
session.run("CREATE ({id: $id})", Map.of("id", nodeId)).subscribe(new BaseSubscriber<>() {
@Override
- protected void hookOnSubscribe(Subscription subscription) {
+ protected void hookOnSubscribe(@NonNull Subscription subscription) {
subscription.cancel();
cancellationFuture.complete(null);
}
diff --git a/driver/src/test/java/org/neo4j/driver/internal/InternalPathTest.java b/driver/src/test/java/org/neo4j/driver/internal/InternalPathTest.java
index 8bf451c2eb..367dee34d5 100644
--- a/driver/src/test/java/org/neo4j/driver/internal/InternalPathTest.java
+++ b/driver/src/test/java/org/neo4j/driver/internal/InternalPathTest.java
@@ -128,8 +128,7 @@ void shouldNotBeAbleToCreatePathWithEvenNumberOfEntities() {
@Test
void shouldNotBeAbleToCreatePathWithNullEntities() {
- InternalNode nullNode = null;
- assertThrows(IllegalArgumentException.class, () -> new InternalPath(nullNode));
+ assertThrows(IllegalArgumentException.class, () -> new InternalPath((InternalNode) null));
}
@Test
diff --git a/driver/src/test/java/org/neo4j/driver/internal/SecuritySettingsTest.java b/driver/src/test/java/org/neo4j/driver/internal/SecuritySettingsTest.java
index e5f87cbe2b..0d9e1797fd 100644
--- a/driver/src/test/java/org/neo4j/driver/internal/SecuritySettingsTest.java
+++ b/driver/src/test/java/org/neo4j/driver/internal/SecuritySettingsTest.java
@@ -73,7 +73,7 @@ void shouldReadBackChangedEncryption() throws IOException, ClassNotFoundExceptio
var verify = TestUtil.serializeAndReadBack(securitySettings, SecuritySettings.class);
assertTrue(isCustomized(verify));
- assertTrue(securitySettings.encrypted());
+ assertTrue(verify.encrypted());
}
@Test
@@ -94,10 +94,10 @@ void shouldReadBackChangedStrategey() throws IOException, ClassNotFoundException
var verify = TestUtil.serializeAndReadBack(securitySettings, SecuritySettings.class);
assertTrue(isCustomized(verify));
- assertFalse(securitySettings.encrypted());
+ assertFalse(verify.encrypted());
assertEquals(
Config.TrustStrategy.trustAllCertificates().strategy(),
- securitySettings.trustStrategy().strategy());
+ verify.trustStrategy().strategy());
}
@Test
@@ -119,11 +119,11 @@ void shouldReadBackChangedCertFile() throws IOException, ClassNotFoundException
var verify = TestUtil.serializeAndReadBack(securitySettings, SecuritySettings.class);
assertTrue(isCustomized(verify));
- assertFalse(securitySettings.encrypted());
+ assertFalse(verify.encrypted());
assertEquals(
Config.TrustStrategy.trustCustomCertificateSignedBy(new File("some.cert"))
.strategy(),
- securitySettings.trustStrategy().strategy());
+ verify.trustStrategy().strategy());
}
}
}
diff --git a/driver/src/test/java/org/neo4j/driver/internal/reactive/RxUtilsTest.java b/driver/src/test/java/org/neo4j/driver/internal/reactive/RxUtilsTest.java
index 8f45ceb460..5aa653b0b6 100644
--- a/driver/src/test/java/org/neo4j/driver/internal/reactive/RxUtilsTest.java
+++ b/driver/src/test/java/org/neo4j/driver/internal/reactive/RxUtilsTest.java
@@ -35,6 +35,7 @@
import org.reactivestreams.Subscription;
import reactor.core.publisher.BaseSubscriber;
import reactor.test.StepVerifier;
+import reactor.util.annotation.NonNull;
class RxUtilsTest {
@Test
@@ -94,7 +95,7 @@ void singleItemPublisherShouldHandleCancellationAfterRequestProcessingBegins() {
// WHEN
publisher.subscribe(new BaseSubscriber<>() {
@Override
- protected void hookOnSubscribe(Subscription subscription) {
+ protected void hookOnSubscribe(@NonNull Subscription subscription) {
subscription.request(1);
supplierInvokedFuture.thenAccept(ignored -> {
subscription.cancel();
diff --git a/driver/src/test/java/org/neo4j/driver/internal/util/IterablesTest.java b/driver/src/test/java/org/neo4j/driver/internal/util/IterablesTest.java
index 6868d2e4fd..6dfbbdf32f 100644
--- a/driver/src/test/java/org/neo4j/driver/internal/util/IterablesTest.java
+++ b/driver/src/test/java/org/neo4j/driver/internal/util/IterablesTest.java
@@ -49,6 +49,7 @@ void shouldThrowWhenNegativeLinkedHashMapSizeGiven() {
}
@Test
+ @SuppressWarnings("ConstantValue")
void shouldReturnEmptyQueue() {
var queue = Iterables.emptyQueue();
assertEquals(0, queue.size());
diff --git a/testkit-backend/src/main/java/neo4j/org/testkit/backend/RxBufferedSubscriber.java b/testkit-backend/src/main/java/neo4j/org/testkit/backend/RxBufferedSubscriber.java
index 6ff8c7ce4e..58226fb9c3 100644
--- a/testkit-backend/src/main/java/neo4j/org/testkit/backend/RxBufferedSubscriber.java
+++ b/testkit-backend/src/main/java/neo4j/org/testkit/backend/RxBufferedSubscriber.java
@@ -29,6 +29,7 @@
import reactor.core.publisher.FluxSink;
import reactor.core.publisher.Mono;
import reactor.core.publisher.MonoSink;
+import reactor.util.annotation.NonNull;
/**
* Buffered subscriber for testing purposes.
@@ -87,12 +88,12 @@ public Mono next() {
}
@Override
- protected void hookOnSubscribe(Subscription subscription) {
+ protected void hookOnSubscribe(@NonNull Subscription subscription) {
subscriptionFuture.complete(subscription);
}
@Override
- protected void hookOnNext(T value) {
+ protected void hookOnNext(@NonNull T value) {
executeWithLock(lock, () -> pendingItems--);
itemsSink.next(value);
}
@@ -103,7 +104,7 @@ protected void hookOnComplete() {
}
@Override
- protected void hookOnError(Throwable throwable) {
+ protected void hookOnError(@NonNull Throwable throwable) {
itemsSink.error(throwable);
}
@@ -163,12 +164,12 @@ public void requestNext(MonoSink sink) {
}
@Override
- protected void hookOnSubscribe(Subscription subscription) {
+ protected void hookOnSubscribe(@NonNull Subscription subscription) {
// left empty to prevent requesting signals immediately
}
@Override
- protected void hookOnNext(T value) {
+ protected void hookOnNext(@NonNull T value) {
var sink = executeWithLock(lock, () -> {
emitted = true;
return this.sink;
@@ -188,7 +189,7 @@ protected void hookOnComplete() {
}
@Override
- protected void hookOnError(Throwable throwable) {
+ protected void hookOnError(@NonNull Throwable throwable) {
var sink = executeWithLock(lock, () -> {
completionFuture.completeExceptionally(throwable);
return !emitted ? this.sink : null;