Skip to content

Commit c565f89

Browse files
committed
Nit: only accept "true" for override property
1 parent a9c345d commit c565f89

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

server/src/main/java/org/elasticsearch/transport/TransportService.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public class TransportService extends AbstractLifecycleComponent
8181
private static final Logger logger = LogManager.getLogger(TransportService.class);
8282

8383
private static final String PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY = "es.unsafely_permit_handshake_from_incompatible_builds";
84-
private static final boolean PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS
85-
= Boolean.parseBoolean(System.getProperty(PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY, "false"));
84+
private static final boolean PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS = getPermitHandshakesFromIncompatibleBuilds();
8685

8786
public static final String DIRECT_RESPONSE_PROFILE = ".direct";
8887
public static final String HANDSHAKE_ACTION_NAME = "internal:transport/handshake";
@@ -1440,4 +1439,17 @@ public void onResponseReceived(long requestId, Transport.ResponseContext holder)
14401439
}
14411440
}
14421441
}
1442+
1443+
private static boolean getPermitHandshakesFromIncompatibleBuilds() {
1444+
final String value = System.getProperty(PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY);
1445+
if (value == null) {
1446+
return false;
1447+
}
1448+
if (Boolean.parseBoolean(value)) {
1449+
return true;
1450+
}
1451+
throw new IllegalArgumentException("invalid value [" + value + "] for system property ["
1452+
+ PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY + "]");
1453+
}
1454+
14431455
}

0 commit comments

Comments
 (0)