cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [01/50] [abbrv] git commit: updated refs/heads/ui-restyle to c64bfa5
Date Thu, 20 Feb 2014 19:17:07 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/ui-restyle 849d601cc -> c64bfa5d8


findbugs findings

Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5a6ad11f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5a6ad11f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5a6ad11f

Branch: refs/heads/ui-restyle
Commit: 5a6ad11fa2ca3de64b94095c628bd3ba12e618c3
Parents: 33c2c87
Author: Ian Southam <isoutham@schubergphilis.com>
Authored: Wed Feb 12 17:08:52 2014 +0100
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Fri Feb 14 18:37:46 2014 +0100

----------------------------------------------------------------------
 framework/db/src/com/cloud/utils/db/Filter.java |  2 +-
 .../src/com/cloud/utils/db/GenericDaoBase.java  | 27 ++++++++++++--------
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6ad11f/framework/db/src/com/cloud/utils/db/Filter.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/Filter.java b/framework/db/src/com/cloud/utils/db/Filter.java
index b2482fd..fdcad9c 100755
--- a/framework/db/src/com/cloud/utils/db/Filter.java
+++ b/framework/db/src/com/cloud/utils/db/Filter.java
@@ -79,7 +79,7 @@ public class Filter {
         String name = column != null ? column.name() : field;
 
         StringBuilder order = new StringBuilder();
-        if (column.table() == null || column.table().length() == 0) {
+        if (column == null || column.table() == null || column.table().length() == 0) {
             order.append(DbUtil.getTableName(clazz));
         } else {
             order.append(column.table());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6ad11f/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index f282428..d929e00 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -396,10 +396,10 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
         final List<T> result = new ArrayList<T>();
         try {
             pstmt = txn.prepareAutoCloseStatement(sql);
-            int i = 0;
+            int i = 1;
             if (clause != null) {
                 for (final Pair<Attribute, Object> value : sc.getValues()) {
-                    prepareAttribute(++i, pstmt, value.first(), value.second());
+                    prepareAttribute(i++, pstmt, value.first(), value.second());
                 }
             }
 
@@ -431,10 +431,13 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
     @Override
     @SuppressWarnings("unchecked")
     public <M> List<M> customSearchIncludingRemoved(SearchCriteria<M> sc,
final Filter filter) {
+        if (sc == null) {
+            throw new CloudRuntimeException("Call to customSearchIncludingRemoved with null
search Criteria");
+        }
         if (sc.isSelectAll()) {
             return (List<M>)searchIncludingRemoved((SearchCriteria<T>)sc, filter,
null, false);
         }
-        String clause = sc != null ? sc.getWhereClause() : null;
+        String clause = sc.getWhereClause();
         if (clause != null && clause.length() == 0) {
             clause = null;
         }
@@ -445,11 +448,9 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
         }
 
         Collection<JoinBuilder<SearchCriteria<?>>> joins = null;
-        if (sc != null) {
-            joins = sc.getJoins();
-            if (joins != null) {
-                addJoins(str, joins);
-            }
+        joins = sc.getJoins();
+        if (joins != null) {
+            addJoins(str, joins);
         }
 
         List<Object> groupByValues = addGroupBy(str, sc);
@@ -461,10 +462,10 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
         PreparedStatement pstmt = null;
         try {
             pstmt = txn.prepareAutoCloseStatement(sql);
-            int i = 0;
+            int i = 1;
             if (clause != null) {
                 for (final Pair<Attribute, Object> value : sc.getValues()) {
-                    prepareAttribute(++i, pstmt, value.first(), value.second());
+                    prepareAttribute(i++, pstmt, value.first(), value.second());
                 }
             }
 
@@ -1070,6 +1071,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
 
     @DB()
     protected List<Object> addGroupBy(final StringBuilder sql, SearchCriteria<?>
sc) {
+        if (sc == null)
+            return null;
         Pair<GroupBy<?, ?, ?>, List<Object>> groupBys = sc.getGroupBy();
         if (groupBys != null) {
             groupBys.first().toSql(sql);
@@ -1179,6 +1182,10 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
     // FIXME: Does not work for joins.
     @Override
     public int expunge(final SearchCriteria<T> sc) {
+        if (sc == null) {
+            throw new CloudRuntimeException("Call to throw new expunge with null search Criteria");
+        }
+
         final StringBuilder str = new StringBuilder("DELETE FROM ");
         str.append(_table);
         str.append(" WHERE ");


Mime
View raw message