From: Thanh Ha Date: Wed, 10 Dec 2014 00:13:17 +0000 (-0500) Subject: Fix checkstyle if-statements must use braces bundlescanner X-Git-Tag: release/lithium~778^2~2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=231a561bf984e1f3669a7f19f29de12ec651def7;ds=sidebyside Fix checkstyle if-statements must use braces bundlescanner Change-Id: I54dcb1e13e913f3dcfcb1b2801b78aa62919a6bf Signed-off-by: Thanh Ha --- diff --git a/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java b/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java index 69c81242d9..abe8618d9b 100644 --- a/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java +++ b/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java @@ -38,7 +38,9 @@ public class Activator extends ComponentActivatorAbstractBase { @Override protected void configureGlobalInstance(Component c, Object imp) { - if (!imp.equals(BundleScanServiceImpl.class)) return; + if (!imp.equals(BundleScanServiceImpl.class)) { + return; + } // export service c.setInterface( new String[] { IBundleScanService.class.getName() }, diff --git a/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleInfo.java b/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleInfo.java index 9cb1cb52ed..31c81dab7e 100644 --- a/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleInfo.java +++ b/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleInfo.java @@ -73,10 +73,14 @@ import org.slf4j.LoggerFactory; } private boolean matches(Pattern pattern, Set values) { - if (pattern == null) return true; + if (pattern == null) { + return true; + } //LOGGER.debug("Matching: {} {}", pattern.toString(), values); for (String s : values) { - if (pattern.matcher(s).find()) return true; + if (pattern.matcher(s).find()) { + return true; + } } return false; } @@ -130,7 +134,9 @@ import org.slf4j.LoggerFactory; Bundle initBundle, Set excludes) { for (BundleInfo other : bundlesToScan) { - if (other.getId() == target.getId()) continue; + if (other.getId() == target.getId()) { + continue; + } if (target.isDependantOn(other)) { if (!visited.contains(other)) { classes.addAll(BundleScanner.loadClasses( @@ -146,7 +152,9 @@ import org.slf4j.LoggerFactory; private boolean isDependantOn(BundleInfo other) { for (String pkg : importPkgs) { - if (other.exportPkgs.contains(pkg)) return true; + if (other.exportPkgs.contains(pkg)) { + return true; + } } return false; } @@ -154,14 +162,18 @@ import org.slf4j.LoggerFactory; public List getDependencies(Collection bundles) { List result = new ArrayList(); for(BundleInfo bundle : bundles) { - if (isDependantOn(bundle)) result.add(bundle); + if (isDependantOn(bundle)) { + result.add(bundle); + } } return result; } private static Set parsePackages(String packageString) { - if (packageString == null) return Collections.emptySet(); + if (packageString == null) { + return Collections.emptySet(); + } String[] packages = packageString.split(","); Set result = new HashSet(); for (int i=0; i> result = null; if (includeDependentBundleClasses) { @@ -254,7 +256,9 @@ import org.slf4j.LoggerFactory; StringBuilder errors = new StringBuilder(); for (String name : annotatedClasses) { try { - if (excludes != null && excludes.contains(name)) continue; + if (excludes != null && excludes.contains(name)) { + continue; + } result.add(initBundle.loadClass(name)); } catch (ClassNotFoundException e) { errors.append(name).append(", "); @@ -276,7 +280,9 @@ import org.slf4j.LoggerFactory; if (c.endsWith("*")) { c = c.substring(0, c.length() - 1); } - if (regex.length() > 0) regex.append("|"); + if (regex.length() > 0) { + regex.append("|"); + } regex.append("^"); if (convert2signature) { regex.append("L").append(c.replaceAll("\\.", "/")); @@ -291,12 +297,16 @@ import org.slf4j.LoggerFactory; } private void validate(List> classes) { - if (classes == null || classes.size() == 0) return; + if (classes == null || classes.size() == 0) { + return; + } Map names = new HashMap(); StringBuilder conflictsMsg = new StringBuilder(); for (Class c : classes) { XmlRootElement root = c.getAnnotation(XmlRootElement.class); - if (root == null) continue; + if (root == null) { + continue; + } String rootName = root.name(); if ("##default".equals(rootName)) { String clsName = c.getSimpleName();