Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions vertx-core/src/main/java/io/vertx/core/Completable.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
*/
package io.vertx.core;

import io.vertx.core.impl.NoStackTraceThrowable;

/**
* A view of something that can be completed with a success or failure.
*
Expand Down Expand Up @@ -57,7 +55,7 @@ default void fail(Throwable failure) {
* @throws IllegalStateException when this instance is already completed or failed
*/
default void fail(String message) {
complete(null, new NoStackTraceThrowable(message));
complete(null, VertxException.noStackTrace(message));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions vertx-core/src/main/java/io/vertx/core/Promise.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.vertx.codegen.annotations.CacheReturn;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.impl.NoStackTraceThrowable;
import io.vertx.core.impl.future.PromiseImpl;


Expand Down Expand Up @@ -144,7 +143,7 @@ default boolean tryComplete() {
* @return false when the future is already completed
*/
default boolean tryFail(String message) {
return tryFail(new NoStackTraceThrowable(message));
return tryFail(VertxException.noStackTrace(message));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import io.vertx.core.Completable;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.impl.NoStackTraceThrowable;
import io.vertx.core.VertxException;
import io.vertx.core.impl.Utils;
import io.vertx.core.internal.ContextInternal;

Expand Down Expand Up @@ -46,7 +46,7 @@ public FailedFuture(Throwable t) {
*/
public FailedFuture(ContextInternal context, Throwable t) {
super(context);
this.cause = t != null ? t : new NoStackTraceThrowable(null);
this.cause = t != null ? t : VertxException.noStackTrace((String) null);
}

/**
Expand All @@ -62,7 +62,7 @@ public FailedFuture(String failureMessage) {
* @param failureMessage the failure message
*/
public FailedFuture(ContextInternal context, String failureMessage) {
this(context, new NoStackTraceThrowable(failureMessage));
this(context, VertxException.noStackTrace(failureMessage));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package io.vertx.core.impl.future;

import io.vertx.core.*;
import io.vertx.core.impl.NoStackTraceThrowable;
import io.vertx.core.internal.ContextInternal;

import java.util.ArrayList;
Expand Down Expand Up @@ -145,7 +144,7 @@ public final boolean tryComplete(T result) {

public final boolean tryFail(Throwable cause) {
if (cause == null) {
cause = new NoStackTraceThrowable(null);
cause = VertxException.noStackTrace((String) null);
}
return completeInternal(null, cause);
}
Expand Down
45 changes: 40 additions & 5 deletions vertx-core/src/test/java/io/vertx/tests/future/FutureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io.vertx.core.*;
import io.vertx.core.Future;
import io.vertx.core.internal.ContextInternal;
import io.vertx.core.impl.NoStackTraceThrowable;
import io.vertx.core.internal.FutureInternal;
import io.vertx.core.internal.PromiseInternal;
import io.vertx.test.core.Repeat;
Expand Down Expand Up @@ -330,17 +329,53 @@ public void testFailFutureToHandler() {
public void testCreateFailedWithNullFailure() {
io.vertx.core.Future<String> future = io.vertx.core.Future.failedFuture((Throwable)null);
Checker<String> checker = new Checker<>(future);
NoStackTraceThrowable failure = (NoStackTraceThrowable) checker.assertFailed();
Throwable failure = checker.assertFailed();
assertEquals(VertxException.class, failure.getClass());
assertNull(failure.getMessage());
assertEquals(0, failure.getStackTrace().length);
}

@Test
public void testFailureFutureWithNullFailure() {
Promise<String> promise = Promise.promise();
promise.fail((Throwable)null);
Checker<String> checker = new Checker<>(promise.future());
NoStackTraceThrowable failure = (NoStackTraceThrowable) checker.assertFailed();
Throwable failure = checker.assertFailed();
assertEquals(VertxException.class, failure.getClass());
assertNull(failure.getMessage());
assertEquals(0, failure.getStackTrace().length);
}

@Test
public void testFailWithMessage() {
Promise<String> promise = Promise.promise();
promise.fail("the-message");
Checker<String> checker = new Checker<>(promise.future());
Throwable failure = checker.assertFailed();
assertEquals(VertxException.class, failure.getClass());
assertEquals("the-message", failure.getMessage());
assertEquals(0, failure.getStackTrace().length);
}

@Test
public void testTryFailWithMessage() {
Promise<String> promise = Promise.promise();
assertTrue(promise.tryFail("the-message"));
Checker<String> checker = new Checker<>(promise.future());
Throwable failure = checker.assertFailed();
assertEquals(VertxException.class, failure.getClass());
assertEquals("the-message", failure.getMessage());
assertEquals(0, failure.getStackTrace().length);
}

@Test
public void testFailedFutureWithMessage() {
io.vertx.core.Future<String> future = io.vertx.core.Future.failedFuture("the-message");
Checker<String> checker = new Checker<>(future);
Throwable failure = checker.assertFailed();
assertEquals(VertxException.class, failure.getClass());
assertEquals("the-message", failure.getMessage());
assertEquals(0, failure.getStackTrace().length);
}

@Test
Expand Down Expand Up @@ -1913,7 +1948,7 @@ private void testListenersReportFailureOnContextAfterCompletion(Function<Context
@Test
public void testAndThenComplete() {
waitFor(4);
Throwable throwable = new NoStackTraceThrowable("test");
Throwable throwable = VertxException.noStackTrace("test");

testAndThen(io.vertx.core.Future.succeededFuture(), null, null);

Expand All @@ -1934,7 +1969,7 @@ public void testAndThenComplete() {
@Repeat(times = 50)
public void testAndThenCompleteContextual() {
waitFor(4);
Throwable throwable = new NoStackTraceThrowable("test");
Throwable throwable = VertxException.noStackTrace("test");

ContextInternal context = (ContextInternal) vertx.getOrCreateContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ public void testRequestTimesOutWhenIndicatedPeriodExpiresWithoutAResponseFromRem
// Catch the first, the second is going to be a connection closed exception when the
// server is shutdown on testComplete
if (failed.compareAndSet(false, true)) {
assertTrue(t instanceof TimeoutException);
assertEquals(0, t.getStackTrace().length);
checkpoint.succeed();
}
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
package io.vertx.tests.http.http3;

import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientAgent;
import io.vertx.core.http.HttpClientBuilder;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.RequestOptions;
import io.vertx.core.net.SocketAddress;
import io.vertx.test.core.Checkpoint;
import io.vertx.test.http.HttpConfigurator;
import io.vertx.tests.http.HttpClientTimeoutTest;
import org.junit.Ignore;
import org.junit.Test;

public class Http3ClientTimeoutTest extends HttpClientTimeoutTest {

private final HttpConfigurator config = Http3Configurator.INSTANCE;

@Override
public void setUp() throws Exception {
super.setUp();
testAddress = SocketAddress.inetSocketAddress(config.port(), config.host());
requestOptions = new RequestOptions()
.setHost(config.host())
.setPort(config.port())
.setURI(DEFAULT_TEST_URI);
}

@Override
protected HttpServer createHttpServer() {
return config.forServer().create(vertx);
}

@Override
protected HttpClientAgent createHttpClient() {
return config.forClient().create(vertx);
}

@Override
protected HttpClientBuilder httpClientBuilder(Vertx vertx) {
return config.forClient().builder(vertx);
}

@Ignore("Requires a saturated connection pool, needs stream concurrency limit support in the HTTP/3 test configurator")
@Test
@Override
public void testConnectTimeoutDoesFire() throws Exception {
}

@Ignore("Requires a saturated connection pool, needs stream concurrency limit support in the HTTP/3 test configurator")
@Test
@Override
public void testConnectTimeoutDoesNotFire() throws Exception {
}

@Ignore("Recreates the client from HttpClientOptions which cannot connect to an HTTP/3 server")
@Test
@Override
public void testRequestsTimeoutInQueue(Checkpoint checkpoint) throws Exception {
}

@Ignore("Recreates the client from HttpClientOptions which cannot connect to an HTTP/3 server")
@Test
@Override
public void testRequestTimeoutIsNotDelayedAfterResponseIsReceived(Checkpoint checkpoint) throws Exception {
}

@Ignore("Request idle timeout does not fire on HTTP/3 streams yet")
@Test
@Override
public void testRequestTimesOutWhenIndicatedPeriodExpiresWithoutAResponseFromRemoteServer(Checkpoint checkpoint) throws Exception {
}

@Ignore("Bypasses the HTTP/3 client under test with an HttpClientOptions based client and a NetServer")
@Test
@Override
public void testTimedOutWaiterDoesNotConnect(Checkpoint checkpoint) throws Exception {
}
}