Fix minor bug in (new) LogMessageExtractorCheck 94/42194/2
authorMichael Vorburger <vorburger@redhat.com>
Thu, 21 Jul 2016 02:06:59 +0000 (04:06 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 21 Jul 2016 08:25:44 +0000 (08:25 +0000)
Normally the target/ directory already exists of course, but if you e.g.
run just "mvn process-sources" then, on some project, the target/
directory may not exist (yet) - and thus this code must ensure it
creates it.

Change-Id: I764e3673433a4abb6819b883f24d7622ac2f352b
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
common/checkstyle-logging/src/main/java/org/opendaylight/yangtools/checkstyle/LogMessageExtractorCheck.java

index 8b223f261b654c86fbb04ccd06249d2fac605e7f..c4c14e8f799f3c84c29bba1fd23ea7684b9854bb 100644 (file)
@@ -56,6 +56,7 @@ public class LogMessageExtractorCheck extends AbstractLogMessageCheck {
     protected void updateMessagesReportFile(LogMessageOccurence log) {
         try {
             final File file = getLogMessagesReportFile();
+            file.getParentFile().mkdirs();
             if (file.exists()) {
                 Files.append(log.toString() + "\n", file, StandardCharsets.UTF_8);
             } else {