| 296 | | |
| 297 | | /** |
| 298 | | * Initializes the {@link ExtensionsHandler} with the allowed or denied |
| 299 | | * extensions of a file type. |
| 300 | | * |
| 301 | | * @param type |
| 302 | | * @param allowedList |
| 303 | | * @param deniedList |
| 304 | | * @throws IllegalArgumentException |
| 305 | | * if allowed and denied extensions are set. |
| 306 | | */ |
| 307 | | private void setExtension(final ResourceTypeHandler type, |
| 308 | | final String allowedList, final String deniedList) { |
| 309 | | // if both lists are set, we have to throw an error, because only one |
| 310 | | // list should be set |
| 311 | | if (Utils.isNotEmpty(allowedList) && Utils.isNotEmpty(deniedList)) { |
| 312 | | String errorMsg = "Allowed and denied extensions are set for [" |
| 313 | | + type + "]. Just one of them should be set!"; |
| 314 | | logger.error(errorMsg); |
| 315 | | throw new IllegalArgumentException(errorMsg); |
| 316 | | } |
| 317 | | |
| 318 | | if (Utils.isNotEmpty(allowedList)) |
| 319 | | ExtensionsHandler.setExtensionsAllowed(type, allowedList); |
| 320 | | else |
| 321 | | ExtensionsHandler.setExtensionsDenied(type, deniedList); |
| 322 | | } |