Fix checkstyle if-statements must use braces sal-dom-xsql 04/13504/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 9 Dec 2014 22:40:23 +0000 (17:40 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 9 Dec 2014 22:40:43 +0000 (17:40 -0500)
Change-Id: I68b6f356b30e56247dec7c96aa43e345e6d972f8
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java

index 867c7a4..a9c0f69 100644 (file)
@@ -114,8 +114,9 @@ public class XSQLBluePrint implements DatabaseMetaData, Serializable {
             String odlTableName) {
         Map<String, XSQLBluePrintNode> map = this.odlNameToBluePrint
                 .get(odlTableName);
-        if (map == null)
+        if (map == null) {
             return null;
+        }
         return map.values().toArray(new XSQLBluePrintNode[map.size()]);
     }
 
index 8e9ed3a..4a56545 100644 (file)
@@ -240,12 +240,15 @@ public class XSQLBluePrintNode implements Serializable {
         XSQLBluePrintNode other = (XSQLBluePrintNode) obj;
         if (odlNode != null) {
             return getBluePrintNodeName().equals(other.getBluePrintNodeName());
-        } else if (this.odlTableName == null && other.odlTableName != null)
+        } else if (this.odlTableName == null && other.odlTableName != null) {
             return false;
-        if (this.odlTableName != null && other.odlTableName == null)
+        }
+        if (this.odlTableName != null && other.odlTableName == null) {
             return false;
-        else
+        }
+        else {
             return this.odlTableName.equals(other.odlTableName);
+        }
     }
 
     @Override
index bf1244f..137631f 100644 (file)
@@ -73,8 +73,9 @@ public class JDBCConnection implements Connection, Runnable {
     }
 
     private void init() throws Exception {
-        if (addr.startsWith("http://"))
+        if (addr.startsWith("http://")) {
             addr = addr.substring(7);
+        }
         System.err.print("Address is:" + addr);
         socket = new Socket(addr, 40004);
         try {
index 37eacd5..d37fdb8 100644 (file)
@@ -66,16 +66,18 @@ public class JDBCResultSet implements Serializable, ResultSet,
     }
 
     public JDBCResultSet addSubQuery(String _sql,String logicalName) {
-        if(subQueries == null)
+        if (subQueries == null) {
             subQueries = new HashMap<String,JDBCResultSet>();
+        }
         JDBCResultSet rs = new JDBCResultSet(_sql);
         this.subQueries.put(logicalName,rs);
         return rs;
     }
 
     public Map<String,JDBCResultSet> getSubQueries() {
-        if(this.subQueries==null)
+        if (this.subQueries==null) {
             this.subQueries = new HashMap<>();
+        }
         return this.subQueries;
     }
 
@@ -381,13 +383,15 @@ public class JDBCResultSet implements Serializable, ResultSet,
         for (Object child : children) {
 
             String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
-            if (odlNodeName == null)
+            if (odlNodeName == null) {
                 continue;
+            }
 
             XSQLBluePrintNode eNodes[] = bluePrint
                     .getBluePrintNodeByODLTableName(odlNodeName);
-            if (eNodes == null)
+            if (eNodes == null) {
                 continue;
+            }
 
             boolean match = false;
             for (XSQLBluePrintNode enode : eNodes) {
@@ -397,8 +401,9 @@ public class JDBCResultSet implements Serializable, ResultSet,
                 }
             }
 
-            if (!match)
+            if (!match) {
                 continue;
+            }
 
             if (child.getClass().getName().endsWith("ImmutableContainerNode")) {
                 result.add(child);
@@ -466,8 +471,9 @@ public class JDBCResultSet implements Serializable, ResultSet,
                     for (XSQLBluePrintNode eNode : eNodes) {
                         bpn = this.tablesInQueryMap.get(eNode
                                 .getBluePrintNodeName());
-                        if (bpn != null)
+                        if (bpn != null) {
                             break;
+                        }
                     }
                     boolean isObjectInCriteria = true;
                     if (bpn != null) {
@@ -482,8 +488,9 @@ public class JDBCResultSet implements Serializable, ResultSet,
 
                     if (isObjectInCriteria) {
                         if (root) {
-                            if (!rec.data.isEmpty())
+                            if (!rec.data.isEmpty()) {
                                 addRecord(rec.data);
+                            }
                         } else {
                             result.add(rec);
                         }
index b348d8f..7b2733c 100644 (file)
@@ -193,10 +193,12 @@ public class JDBCServer extends Thread {
             int braketCount = 0;
             int endSubQuery = startSubQuery;
             do {
-                if (sql.charAt(endSubQuery) == '(')
+                if (sql.charAt(endSubQuery) == '(') {
                     braketCount++;
-                else if (sql.charAt(endSubQuery) == ')')
+                }
+                else if (sql.charAt(endSubQuery) == ')') {
                     braketCount--;
+                }
                 endSubQuery++;
             } while (braketCount > 0 || endSubQuery == sql.length());
             String subQuerySQL = sql.substring(startSubQuery + 1,endSubQuery - 1);
@@ -338,8 +340,9 @@ public class JDBCServer extends Thread {
             whereTo = order;
         }
 
-        if(whereTo==-1)
+        if(whereTo==-1) {
             whereTo=lowSQL.length();
+        }
 
         String whereStatement = rs.getSQL().substring(where + 5, whereTo)
                 .trim();