Skip to content

Commit 2d57322

Browse files
committed
@SuppressForbidden
1 parent c8ade2e commit 2d57322

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libs/entitlement/qa/common/src/main/java/org/elasticsearch/entitlement/qa/common/RestEntitlementsCheckAction.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
public class RestEntitlementsCheckAction extends BaseRestHandler {
6161
private static final Logger logger = LogManager.getLogger(RestEntitlementsCheckAction.class);
62-
public static final Thread NO_OP_SHUTDOWN_HOOK = new Thread(() -> {});
62+
public static final Thread NO_OP_SHUTDOWN_HOOK = new Thread(() -> {}, "Shutdown hook for testing");
6363
private final String prefix;
6464

6565
record CheckAction(Runnable action, boolean isAlwaysDeniedToPlugins) {
@@ -185,10 +185,12 @@ private static void setHttpsConnectionProperties() {
185185
System.setIn(System.in);
186186
}
187187

188+
@SuppressForbidden(reason = "This should be a no-op so we don't interfere with system streams")
188189
private static void system$$setOut() {
189190
System.setOut(System.out);
190191
}
191192

193+
@SuppressForbidden(reason = "This should be a no-op so we don't interfere with system streams")
192194
private static void system$$setErr() {
193195
System.setErr(System.err);
194196
}
@@ -259,6 +261,7 @@ private static void setHttpsConnectionProperties() {
259261
}
260262

261263
@SuppressWarnings("deprecation")
264+
@SuppressForbidden(reason = "We're required to prevent calls to this forbidden API")
262265
private static void datagramSocket$$setDatagramSocketImplFactory() {
263266
try {
264267
DatagramSocket.setDatagramSocketImplFactory(new DatagramSocketImplFactory() {
@@ -277,6 +280,7 @@ public DatagramSocketImpl createDatagramSocketImpl() {
277280
}
278281

279282
@SuppressWarnings("deprecation")
283+
@SuppressForbidden(reason = "We're required to prevent calls to this forbidden API")
280284
private static void serverSocket$$setSocketFactory() {
281285
try {
282286
ServerSocket.setSocketFactory(() -> { throw new IllegalStateException(); });
@@ -286,6 +290,7 @@ public DatagramSocketImpl createDatagramSocketImpl() {
286290
}
287291

288292
@SuppressWarnings("deprecation")
293+
@SuppressForbidden(reason = "We're required to prevent calls to this forbidden API")
289294
private static void socket$$setSocketImplFactory() {
290295
try {
291296
Socket.setSocketImplFactory(() -> { throw new IllegalStateException(); });

0 commit comments

Comments
 (0)