MCPcopy Create free account
hub / github.com/apache/tomcat / getEnabled

Method getEnabled

java/org/apache/tomcat/util/net/SSLUtilBase.java:165–205  ·  view source on GitHub ↗
(String name, Log log, boolean warnOnSkip, Collection<T> configured,
            Collection<T> implemented)

Source from the content-addressed store, hash-verified

163
164
165 static <T> List<T> getEnabled(String name, Log log, boolean warnOnSkip, Collection<T> configured,
166 Collection<T> implemented) {
167
168 List<T> enabled = new ArrayList<>();
169
170 if (implemented.isEmpty()) {
171 // Unable to determine the list of available protocols. This will
172 // have been logged previously.
173 // Use the configuredProtocols and hope they work. If not, an error
174 // will be generated when the list is used. Not ideal but no more
175 // can be done at this point.
176 enabled.addAll(configured);
177 } else {
178 enabled.addAll(configured);
179 enabled.retainAll(implemented);
180
181 if (enabled.isEmpty()) {
182 // Don't use the defaults in this case. They may be less secure
183 // than the configuration the user intended.
184 // Force the failure of the connector
185 throw new IllegalArgumentException(sm.getString("sslUtilBase.noneSupported", name, configured));
186 }
187 if (log.isDebugEnabled()) {
188 log.debug(sm.getString("sslUtilBase.active", name, enabled));
189 }
190 if (log.isDebugEnabled() || warnOnSkip) {
191 if (enabled.size() != configured.size()) {
192 List<T> skipped = new ArrayList<>(configured);
193 skipped.removeAll(enabled);
194 String msg = sm.getString("sslUtilBase.skipped", name, skipped);
195 if (warnOnSkip) {
196 log.warn(msg);
197 } else {
198 log.debug(msg);
199 }
200 }
201 }
202 }
203
204 return enabled;
205 }
206
207
208 /*

Callers 1

SSLUtilBaseMethod · 0.95

Calls 9

getStringMethod · 0.65
isDebugEnabledMethod · 0.65
debugMethod · 0.65
warnMethod · 0.65
isEmptyMethod · 0.45
addAllMethod · 0.45
retainAllMethod · 0.45
sizeMethod · 0.45
removeAllMethod · 0.45

Tested by

no test coverage detected