private static void readAll(File file, AttributeProvider provider, Map<String, Object> map) { for (String attribute : provider.attributes(file)) { Object value = provider.get(file, attribute); // check for null to protect against race condition when an attribute present when // attributes(file) was called is deleted before get() is called for that attribute if (value != null) { map.put(attribute, value); } } }