diff --git a/src/main/java/com/jcabi/log/FileDecor.java b/src/main/java/com/jcabi/log/FileDecor.java index 300f80f3..25f90149 100644 --- a/src/main/java/com/jcabi/log/FileDecor.java +++ b/src/main/java/com/jcabi/log/FileDecor.java @@ -75,6 +75,9 @@ public void formatTo(final Formatter formatter, final int flags, if (rel.startsWith("..")) { rel = self.toString(); } + if (rel.isEmpty()) { + rel = "./"; + } writer.write(rel); } formatter.format("%s", writer); diff --git a/src/test/java/com/jcabi/log/FileDecorTest.java b/src/test/java/com/jcabi/log/FileDecorTest.java index 8ef22640..56833948 100644 --- a/src/test/java/com/jcabi/log/FileDecorTest.java +++ b/src/test/java/com/jcabi/log/FileDecorTest.java @@ -103,6 +103,8 @@ private static Collection params() { new Object[][] { {null, "NULL", 0, 0, 0}, {"foo.txt", "foo.txt", 0, 0, 0}, + {".", "./", 0, 0, 0}, + {"/tmp", "/tmp", 0, 0, 0}, {new File("/tmp/x.txt"), "/tmp/x.txt", 0, 0, 0}, {Paths.get("/a/b/c.txt"), "/a/b/c.txt", 0, 0, 0}, }