/** * Check if the resource was changed from previous run. The implementation uses resource content * digest (hash) to check for change. * * @param resource the {@link Resource} to check. * @return true if the resource was changed. */ private boolean isChanged(final Resource resource, final String groupName) { boolean changed = false; try { final String uri = resource.getUri(); // using AtomicBoolean because we need to mutate this variable inside an anonymous class. final AtomicBoolean changeDetected = new AtomicBoolean(resourceChangeDetector.checkChangeForGroup(uri, groupName)); if (!changeDetected.get() && resource.getType() == ResourceType.CSS) { final Reader reader = new InputStreamReader(locatorFactory.locate(uri)); LOG.debug("\tCheck @import directive from {}", resource); createCssImportProcessor(changeDetected, groupName) .process(resource, reader, new StringWriter()); } changed = changeDetected.get(); } catch (final IOException e) { LOG.debug( "[FAIL] Cannot check {} resource (Exception message: {}). Assuming it is unchanged...", resource, e.getMessage()); } LOG.debug("resource={}, changed={}", resource.getUri(), changed); return changed; }