@Test public void shouldReturnNullIfErrorInReadingFile() { assertNull(ModulePropertiesRecord.buildFrom(new File("someRandomFile"))); }
public static ModulePropertiesRecord buildFrom(File file) { try (InputStream inputStream = FileUtils.openInputStream(file)) { final String fileName = file.getName(); boolean raw = !isExtension(fileName, PROPERTIES_FILE_EXTENSION); Properties properties = buildProperties(inputStream, raw); String bundle = raw ? file.getParentFile().getParentFile().getName() : file.getParentFile().getName(); return new ModulePropertiesRecord(properties, bundle, "", fileName, raw); } catch (IOException e) { LOGGER.error(String.format("Error reading config file %s", file.getAbsolutePath()), e); return null; } }
ModulePropertiesRecord { public static ModulePropertiesRecord buildFrom(File file) { try (InputStream inputStream = FileUtils.openInputStream(file)) { final String fileName = file.getName(); boolean raw = !isExtension(fileName, PROPERTIES_FILE_EXTENSION); Properties properties = buildProperties(inputStream, raw); String bundle = raw ? file.getParentFile().getParentFile().getName() : file.getParentFile().getName(); return new ModulePropertiesRecord(properties, bundle, "", fileName, raw); } catch (IOException e) { LOGGER.error(String.format("Error reading config file %s", file.getAbsolutePath()), e); return null; } } }
ModulePropertiesRecord { public static ModulePropertiesRecord buildFrom(File file) { try (InputStream inputStream = FileUtils.openInputStream(file)) { final String fileName = file.getName(); boolean raw = !isExtension(fileName, PROPERTIES_FILE_EXTENSION); Properties properties = buildProperties(inputStream, raw); String bundle = raw ? file.getParentFile().getParentFile().getName() : file.getParentFile().getName(); return new ModulePropertiesRecord(properties, bundle, "", fileName, raw); } catch (IOException e) { LOGGER.error(String.format("Error reading config file %s", file.getAbsolutePath()), e); return null; } } ModulePropertiesRecord();  ModulePropertiesRecord(Map<String, Object> properties, String bundle, String version, String filename, boolean raw);  ModulePropertiesRecord(Properties props, String bundle, String version, String filename, boolean raw); }
ModulePropertiesRecord { public static ModulePropertiesRecord buildFrom(File file) { try (InputStream inputStream = FileUtils.openInputStream(file)) { final String fileName = file.getName(); boolean raw = !isExtension(fileName, PROPERTIES_FILE_EXTENSION); Properties properties = buildProperties(inputStream, raw); String bundle = raw ? file.getParentFile().getParentFile().getName() : file.getParentFile().getName(); return new ModulePropertiesRecord(properties, bundle, "", fileName, raw); } catch (IOException e) { LOGGER.error(String.format("Error reading config file %s", file.getAbsolutePath()), e); return null; } } ModulePropertiesRecord();  ModulePropertiesRecord(Map<String, Object> properties, String bundle, String version, String filename, boolean raw);  ModulePropertiesRecord(Properties props, String bundle, String version, String filename, boolean raw); static ModulePropertiesRecord buildFrom(File file); Map<String, Object> getProperties(); void setProperties(Map<String, Object> properties); String getBundle(); void setBundle(String bundle); String getVersion(); void setVersion(String version); String getFilename(); void setFilename(String filename); boolean isRaw(); void setRaw(boolean raw); boolean sameAs(Object dataObject); @Override int hashCode(); @Override String toString(); @Override boolean equals(Object obj); }
ModulePropertiesRecord { public static ModulePropertiesRecord buildFrom(File file) { try (InputStream inputStream = FileUtils.openInputStream(file)) { final String fileName = file.getName(); boolean raw = !isExtension(fileName, PROPERTIES_FILE_EXTENSION); Properties properties = buildProperties(inputStream, raw); String bundle = raw ? file.getParentFile().getParentFile().getName() : file.getParentFile().getName(); return new ModulePropertiesRecord(properties, bundle, "", fileName, raw); } catch (IOException e) { LOGGER.error(String.format("Error reading config file %s", file.getAbsolutePath()), e); return null; } } ModulePropertiesRecord();  ModulePropertiesRecord(Map<String, Object> properties, String bundle, String version, String filename, boolean raw);  ModulePropertiesRecord(Properties props, String bundle, String version, String filename, boolean raw); static ModulePropertiesRecord buildFrom(File file); Map<String, Object> getProperties(); void setProperties(Map<String, Object> properties); String getBundle(); void setBundle(String bundle); String getVersion(); void setVersion(String version); String getFilename(); void setFilename(String filename); boolean isRaw(); void setRaw(boolean raw); boolean sameAs(Object dataObject); @Override int hashCode(); @Override String toString(); @Override boolean equals(Object obj); @Ignore
    static final String PROPERTIES_FILE_EXTENSION; }