Ivan Zlenko created IGNITE-24423: ------------------------------------ Summary: Potential NullPointerException if we failed to retrieve primary replica Key: IGNITE-24423 URL: https://issues.apache.org/jira/browse/IGNITE-24423 Project: Ignite Issue Type: Bug Reporter: Ivan Zlenko Assignee: Ivan Zlenko
In case we received empty response with no exception while for primary replica in InternalTableImpl class we will fail with NullPoinerException: {code:java} protected CompletableFuture<ClusterNode> evaluateReadOnlyRecipientNode(int partId, @Nullable HybridTimestamp readTimestamp) { TablePartitionId tablePartitionId = new TablePartitionId(tableId, partId); return awaitPrimaryReplica(tablePartitionId, readTimestamp) .handle((res, e) -> { if (e != null) { throw withCause(TransactionException::new, REPLICA_UNAVAILABLE_ERR, e); } else { if (res == null) { throw withCause(TransactionException::new, REPLICA_UNAVAILABLE_ERR, e); } else { return getClusterNode(res); } } }); } {code} {code:java} public static <T extends Exception> T withCause(IgniteTriFunction<UUID, Integer, Throwable, T> supplier, int defaultCode, Throwable t) { return withCauseInternal((traceId, code, message, cause) -> supplier.apply(traceId, code, t), defaultCode, t); } private static <T extends Exception> T withCauseInternal( IgniteQuadFunction<UUID, Integer, String, Throwable, T> supplier, int defaultCode, Throwable t ) { Throwable unwrapped = unwrapCause(t); if (unwrapped instanceof TraceableException) { TraceableException traceable = (TraceableException) unwrapped; return supplier.apply(traceable.traceId(), traceable.code(), unwrapped.getMessage(), t); } return supplier.apply(UUID.randomUUID(), defaultCode, t.getMessage(), t); } {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)