|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright (c) 2021, 2022 IBM Corporation and others. |
| 2 | + * Copyright (c) 2021, 2025 IBM Corporation and others. |
3 | 3 | * All rights reserved. This program and the accompanying materials
|
4 | 4 | * are made available under the terms of the Eclipse Public License 2.0
|
5 | 5 | * which accompanies this distribution, and is available at
|
@@ -118,6 +118,10 @@ public TCPConfigurationImpl(Map<String, Object> options, boolean inbound) throws
|
118 | 118 | this.channelProperties = options;
|
119 | 119 |
|
120 | 120 | 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 | + |
121 | 125 | // read in values now, to save time reading them in each time
|
122 | 126 | // they are requested
|
123 | 127 | setValues();
|
@@ -160,7 +164,10 @@ public AddressAndHostNameAccessLists getAccessLists() {
|
160 | 164 |
|
161 | 165 | //@formatter:off
|
162 | 166 | 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") || |
164 | 171 | key.equals("type") ||
|
165 | 172 | key.startsWith("service.") ||
|
166 | 173 | key.startsWith("component.") ||
|
@@ -199,13 +206,7 @@ private void setValues() throws NettyException {
|
199 | 206 | value = entry.getValue();
|
200 | 207 |
|
201 | 208 | 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 |
209 | 210 | continue;
|
210 | 211 | }
|
211 | 212 |
|
|
0 commit comments