Fix checkstyle if-statements must use braces bundlescanner 22/13522/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 10 Dec 2014 00:13:17 +0000 (19:13 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 10 Dec 2014 00:13:17 +0000 (19:13 -0500)
Change-Id: I54dcb1e13e913f3dcfcb1b2801b78aa62919a6bf
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java
opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleInfo.java
opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanner.java

index 69c81242d99c1ace9cc2ebdbb8a9fd47d9ca07c8..abe8618d9b58558b4d48ea56c6fa8df0a3f07a1e 100644 (file)
@@ -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() },
index 9cb1cb52ed36e0e8d2de80b84cc59620eb9f5430..31c81dab7ecd7c558e885f17b70d58aad756bbf0 100644 (file)
@@ -73,10 +73,14 @@ import org.slf4j.LoggerFactory;
     }
 
     private boolean matches(Pattern pattern, Set<String> 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<String> 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<BundleInfo> getDependencies(Collection<BundleInfo> bundles) {
         List<BundleInfo> result = new ArrayList<BundleInfo>();
         for(BundleInfo bundle : bundles) {
-            if (isDependantOn(bundle)) result.add(bundle);
+            if (isDependantOn(bundle)) {
+                result.add(bundle);
+            }
         }
         return result;
     }
 
 
     private static Set<String> parsePackages(String packageString) {
-        if (packageString == null) return Collections.emptySet();
+        if (packageString == null) {
+            return Collections.emptySet();
+        }
         String[] packages = packageString.split(",");
         Set<String> result = new HashSet<String>();
         for (int i=0; i<packages.length; i++) {
index 2fee2720c2197d5af35ec0c839ad44f5df631942..f6b604d8b68ee304a85a40c524839a01a545a670 100644 (file)
@@ -72,7 +72,9 @@ import org.slf4j.LoggerFactory;
             boolean includeDependentBundleClasses)
     {
         BundleInfo info = bundleAnnotations.get(context.getBundle().getBundleId());
-        if (info == null) return Collections.emptyList();
+        if (info == null) {
+            return Collections.emptyList();
+        }
         Pattern pattern = mergePatterns(annotations, false);
         List<Class<?>> 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<Class<?>> classes) {
-        if (classes == null || classes.size() == 0) return;
+        if (classes == null || classes.size() == 0) {
+            return;
+        }
         Map<String,String> names = new HashMap<String,String>();
         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();