Added check before append review stats file.

This commit is contained in:
Christian P. MOMON 2018-05-19 00:26:47 +02:00
parent 47a92976f8
commit 7e905380f8

View File

@ -64,6 +64,8 @@ public class ReviewDatasFile
public static void append(final File file, final ReviewData stat) throws HebdobotException public static void append(final File file, final ReviewData stat) throws HebdobotException
{ {
try try
{
if ((file != null) && (file.exists()))
{ {
String line = String.format("%s\t%d\t%d", stat.getDate().format(DateTimeFormatter.ofPattern("yyyyMMdd-hh'h'mm")), stat.getUserCount(), String line = String.format("%s\t%d\t%d", stat.getDate().format(DateTimeFormatter.ofPattern("yyyyMMdd-hh'h'mm")), stat.getUserCount(),
stat.getDuration()); stat.getDuration());
@ -72,6 +74,7 @@ public class ReviewDatasFile
lines.add(line); lines.add(line);
StringsUtils.save(file, lines); StringsUtils.save(file, lines);
} }
}
catch (FileNotFoundException exception) catch (FileNotFoundException exception)
{ {
logger.error("File Not Found: " + exception.getMessage(), exception); logger.error("File Not Found: " + exception.getMessage(), exception);