Enable spotbugs in mdsal-binding-dom-codec-osgi 08/76908/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Oct 2018 18:57:37 +0000 (20:57 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Oct 2018 18:57:37 +0000 (20:57 +0200)
This fixes up the issues reported and flips enforcement to on.

Change-Id: Ia58b4f08fb1b594446cec458268586db8df8d62c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec-osgi/pom.xml
binding/mdsal-binding-dom-codec-osgi/src/main/java/org/opendaylight/mdsal/binding/dom/codec/osgi/impl/Activator.java
binding/mdsal-binding-dom-codec-osgi/src/main/java/org/opendaylight/mdsal/binding/dom/codec/osgi/impl/ModuleInfoBundleTracker.java

index 251cea398950645a736546e83445e5d38454de18..0eb12c10c480a4a504699ce0243aaee0012873b8 100644 (file)
                     <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
+                <configuration>
+                    <failOnError>true</failOnError>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>
index 994a88d815bc13ec76342d00035241094a805588..0c6ed145fdd1a9d3c58fbdbc4f72d719cdb7613d 100644 (file)
@@ -24,8 +24,8 @@ import org.osgi.util.tracker.BundleTracker;
 public final class Activator implements BundleActivator {
     private final List<ServiceRegistration<?>> registrations = new ArrayList<>(2);
 
-    private BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> moduleInfoResolvedBundleTracker;
-    private SimpleBindingRuntimeContextService service;
+    private BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> moduleInfoResolvedBundleTracker = null;
+    private SimpleBindingRuntimeContextService service = null;
 
     @Override
     public void start(final BundleContext context) {
index 460a10a9e325c9cce4c1d347c4cabafb00ccf0af..3933b0328bf69a5feb37634c88ca474ee4b458b8 100644 (file)
@@ -11,6 +11,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.io.Resources;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.IOException;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
@@ -94,7 +95,7 @@ final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collectio
             moduleInfoRegistry.updateService();
         }
 
-        LOG.trace("Bundle {} resultend in registrations {}", registrations);
+        LOG.trace("Bundle {} resultend in registrations {}", bundle, registrations);
         return registrations;
     }
 
@@ -160,6 +161,7 @@ final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collectio
         }
     }
 
+    @SuppressFBWarnings("SLF4J_UNKNOWN_ARRAY")
     private static String logMessage(final String slfMessage, final Object... params) {
         LOG.info(slfMessage, params);
         return String.format(BRACE_PATTERN.matcher(slfMessage).replaceAll("%s"), params);