Skip to content

Commit 87b54ea

Browse files
committed
Ensure ExternalName is set before a validation error can occur
1 parent 6b1262b commit 87b54ea

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

dev/io.openliberty.netty.internal.impl/src/io/openliberty/netty/internal/tcp/TCPConfigurationImpl.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2021, 2022 IBM Corporation and others.
2+
* Copyright (c) 2021, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -118,6 +118,10 @@ public TCPConfigurationImpl(Map<String, Object> options, boolean inbound) throws
118118
this.channelProperties = options;
119119

120120
if (this.channelProperties != null) {
121+
// Set the name of the channel before setting the values of the other properties. This ensures it is available
122+
// if a validation error occurs.
123+
this.externalName = (String) this.channelProperties.get(ConfigConstants.EXTERNAL_NAME);
124+
121125
// read in values now, to save time reading them in each time
122126
// they are requested
123127
setValues();
@@ -160,7 +164,10 @@ public AddressAndHostNameAccessLists getAccessLists() {
160164

161165
//@formatter:off
162166
private boolean skipKey(String key) {
163-
return key.equals("id") ||
167+
// We set externalName in the constructor. If we don't skip it while processing the rest of the properties the below error occurs:
168+
// CWWKO0212W: TCP Channel defaultHttpEndpoint has been constructed with an incorrect configuration property. Property Name: ExternalName Value: defaultHttpEndpoint
169+
return key.equals(ConfigConstants.EXTERNAL_NAME) ||
170+
key.equals("id") ||
164171
key.equals("type") ||
165172
key.startsWith("service.") ||
166173
key.startsWith("component.") ||
@@ -199,13 +206,7 @@ private void setValues() throws NettyException {
199206
value = entry.getValue();
200207

201208
if (skipKey(key)) {
202-
// skip osgi standard properties
203-
continue;
204-
}
205-
206-
// add the name for the channel
207-
if (key.equalsIgnoreCase(ConfigConstants.EXTERNAL_NAME)) {
208-
this.externalName = (String) value;
209+
// skip osgi standard properties and ExternalName
209210
continue;
210211
}
211212

0 commit comments

Comments
 (0)