Fix spotbugs complaints around logging 99/85299/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Oct 2019 16:52:35 +0000 (18:52 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Oct 2019 17:48:09 +0000 (19:48 +0200)
Spotbugs is very much correct about warning about non-constant
format strings. This patch fixes that up.

Change-Id: I8df61b64be1478510e60af99dd2cd2365a98f2c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 89ffe8626f4addebedc19f4c85e12d35d047b2e0)

binding/maven-sal-api-gen-plugin/src/main/java/org/opendaylight/mdsal/binding/maven/api/gen/plugin/CodeGeneratorImpl.java
binding/maven-sal-api-gen-plugin/src/main/java/org/opendaylight/mdsal/binding/yang/unified/doc/generator/GeneratorImpl.xtend

index 9108d318d21d8cdcf98bf797248e304d849b051e..62c80d46cb28200f96fd03f55539e2a48b140e9e 100644 (file)
@@ -162,7 +162,7 @@ public final class CodeGeneratorImpl implements BasicCodeGenerator, BuildContext
         File outputBaseDir;
         outputBaseDir = new File(DEFAULT_OUTPUT_BASE_DIR_PATH);
         setOutputBaseDirAsSourceFolder(outputBaseDir, mavenProject);
-        LOG.debug("Adding " + outputBaseDir.getPath() + " as compile source root");
+        LOG.debug("Adding {} as compile source root", outputBaseDir.getPath());
         return outputBaseDir;
     }
 
@@ -233,10 +233,10 @@ public final class CodeGeneratorImpl implements BasicCodeGenerator, BuildContext
                     bw.write(source);
                 }
             } catch (Exception e) {
-                LOG.error("Could not write file: {}",file,e);
+                LOG.error("Could not write file: {}", file, e);
             }
         } catch (Exception e) {
-            LOG.error("Could not create file: {}",file,e);
+            LOG.error("Could not create file: {}", file, e);
         }
         return file;
     }
index f7abe1d4de33847fd756f7518041595e1a5ea1d6..8878eb6222353ff25885f6c05ea6503bfaf78c83 100644 (file)
@@ -99,7 +99,7 @@ class GeneratorImpl {
             bw.close();
             fw.close();
         } catch (IOException e) {
-            LOG.error(e.getMessage());
+            LOG.error("Failed to emit file {}", destination, e);
         }
         return destination;
     }