@Override public void setLocations(final Resource... locations) { // Invalidate previous cache if (GlobalPropertyUtils.props != null) { setGlobalProperties(null); setGlobalLocations(); } // Cleanup resources to avoid useless WAR final List<Resource> newLocations = new ArrayList<>(locations.length); for (final Resource location : locations) { try (InputStream inputStream = location.getInputStream()) { if (inputStream != null) { newLocations.add(location); } } catch (final IOException ioe) { // NOSONAR - Check error, no pollution required logger.warn(String.format("Ignoring location %s since is not found : %s", location, ioe.getMessage())); } } final Resource[] newLocationsArray; if (newLocations.size() == locations.length) { newLocationsArray = locations; } else { newLocationsArray = newLocations.toArray(new Resource[newLocations.size()]); } // Add the locations to the bean super.setLocations(locations); // Increase the application properties setGlobalLocations(ArrayUtils.addAll(GlobalPropertyUtils.locations, newLocationsArray)); }