@Test public void testCanonicalFileLocation() throws IOException { try { canonicalFileLocation(Paths.get("/")); } catch (ProvidenceConfigException e) { assertThat(e.getMessage(), is("Trying to read root directory")); } }
public static Path canonicalFileLocation(@Nonnull Path file) throws ProvidenceConfigException { if (!file.isAbsolute()) { file = file.toAbsolutePath(); } if (file.getParent() == null) { throw new ProvidenceConfigException("Trying to read root directory"); } try { Path dir = readCanonicalPath(file.getParent()); return dir.resolve(file.getFileName().toString()); } catch (IOException e) { throw new ProvidenceConfigException(e, e.getMessage()); } }
ProvidenceConfigUtil { public static Path canonicalFileLocation(@Nonnull Path file) throws ProvidenceConfigException { if (!file.isAbsolute()) { file = file.toAbsolutePath(); } if (file.getParent() == null) { throw new ProvidenceConfigException("Trying to read root directory"); } try { Path dir = readCanonicalPath(file.getParent()); return dir.resolve(file.getFileName().toString()); } catch (IOException e) { throw new ProvidenceConfigException(e, e.getMessage()); } } }
ProvidenceConfigUtil { public static Path canonicalFileLocation(@Nonnull Path file) throws ProvidenceConfigException { if (!file.isAbsolute()) { file = file.toAbsolutePath(); } if (file.getParent() == null) { throw new ProvidenceConfigException("Trying to read root directory"); } try { Path dir = readCanonicalPath(file.getParent()); return dir.resolve(file.getFileName().toString()); } catch (IOException e) { throw new ProvidenceConfigException(e, e.getMessage()); } } private  ProvidenceConfigUtil(); }
ProvidenceConfigUtil { public static Path canonicalFileLocation(@Nonnull Path file) throws ProvidenceConfigException { if (!file.isAbsolute()) { file = file.toAbsolutePath(); } if (file.getParent() == null) { throw new ProvidenceConfigException("Trying to read root directory"); } try { Path dir = readCanonicalPath(file.getParent()); return dir.resolve(file.getFileName().toString()); } catch (IOException e) { throw new ProvidenceConfigException(e, e.getMessage()); } } private  ProvidenceConfigUtil(); static Path canonicalFileLocation(@Nonnull Path file); }
ProvidenceConfigUtil { public static Path canonicalFileLocation(@Nonnull Path file) throws ProvidenceConfigException { if (!file.isAbsolute()) { file = file.toAbsolutePath(); } if (file.getParent() == null) { throw new ProvidenceConfigException("Trying to read root directory"); } try { Path dir = readCanonicalPath(file.getParent()); return dir.resolve(file.getFileName().toString()); } catch (IOException e) { throw new ProvidenceConfigException(e, e.getMessage()); } } private  ProvidenceConfigUtil(); static Path canonicalFileLocation(@Nonnull Path file); static final String UNDEFINED; }