(String name, Log log, boolean warnOnSkip, Collection<T> configured,
Collection<T> implemented)
| 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 | /* |
no test coverage detected