cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject git commit: updated refs/heads/master to c06d8a7
Date Thu, 07 Nov 2013 10:11:16 GMT
Updated Branches:
  refs/heads/master e77ab3854 -> c06d8a750


Fix for issues on Coverity related to IDs cv_1125383, cv_1125382, cv_1125380, cv_1125379,
cv_1125378, cv_1125377, cv_1125376, cv_1125375, cv_1125374.

Those bugs are related to classes not implementing Serializable, nox overriding the equals
and/or hashCode methods and with empty finalize method.

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/c06d8a75
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c06d8a75
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c06d8a75

Branch: refs/heads/master
Commit: c06d8a750c75f500fa29479c0aec58eb7fcea2ba
Parents: e77ab38
Author: wilderrodrigues <wrodrigues@schubegphilis.com>
Authored: Thu Nov 7 09:22:43 2013 +0100
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Thu Nov 7 10:59:10 2013 +0100

----------------------------------------------------------------------
 .../contrail/management/ServerDBSyncImpl.java    |  3 ++-
 .../management/ServerEventHandlerImpl.java       |  4 ----
 .../network/contrail/model/ModelObject.java      | 19 ++++++++++++++++++-
 .../network/contrail/model/ModelObjectBase.java  | 18 +++++++++++++++++-
 4 files changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c06d8a75/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerDBSyncImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerDBSyncImpl.java
b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerDBSyncImpl.java
index 8cb4e8d..7a77040 100644
--- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerDBSyncImpl.java
+++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerDBSyncImpl.java
@@ -18,6 +18,7 @@
 package org.apache.cloudstack.network.contrail.management;
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
@@ -931,7 +932,7 @@ public class ServerDBSyncImpl implements ServerDBSync {
         s_logger.debug("equal " + siModel.getQualifiedName());
     }
     
-    static class ServiceInstanceComparator implements Comparator<ServiceInstance> {
+    static class ServiceInstanceComparator implements Comparator<ServiceInstance>,
Serializable {
         @Override
         public int compare(ServiceInstance obj1, ServiceInstance obj2) {
             String name1 = StringUtils.join(obj1.getQualifiedName(), ':');

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c06d8a75/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerEventHandlerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerEventHandlerImpl.java
b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerEventHandlerImpl.java
index 455e601..ec37440 100644
--- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerEventHandlerImpl.java
+++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServerEventHandlerImpl.java
@@ -63,10 +63,6 @@ public class ServerEventHandlerImpl implements ServerEventHandler {
         setClassMap();
     }
 
-    protected void finalize () {
-
-    }
-    
     private void setMethodMap() {
         _methodMap = new HashMap<String, Method>();
         Method methods[] = this.getClass().getMethods();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c06d8a75/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java
b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java
index 71d28ac..e43c9db 100644
--- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java
+++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java
@@ -18,6 +18,7 @@
 package org.apache.cloudstack.network.contrail.model;
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.lang.ref.WeakReference;
 import java.util.TreeSet;
 
@@ -38,7 +39,7 @@ import com.cloud.exception.InternalErrorException;
  * The update method pushes updates to the contrail API server.
  */
 public interface ModelObject {
-    public static class ModelReference implements Comparable<ModelReference> {
+    public static class ModelReference implements Comparable<ModelReference>, Serializable
{
         WeakReference<ModelObject> reference;
         ModelReference(ModelObject obj) {
             reference = new WeakReference<ModelObject>(obj);
@@ -57,8 +58,22 @@ public interface ModelObject {
             
             return lhs.compareTo(rhs);
         }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result
+                    + ((reference == null) ? 0 : reference.hashCode());
+            return result;
+        }
+
         @Override
         public boolean equals(Object other) {
+            if (this == other)
+                return true;
+            if (other == null)
+                return false;
             try {
                 ModelReference rhs = (ModelReference) other;
                 return compareTo(rhs) == 0;
@@ -69,6 +84,8 @@ public interface ModelObject {
         public ModelObject get() {
             return reference.get();
         }
+        
+        
     };
     
     public void addSuccessor(ModelObject child);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c06d8a75/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObjectBase.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObjectBase.java
b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObjectBase.java
index f22c7c5..8d48fa1 100644
--- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObjectBase.java
+++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObjectBase.java
@@ -17,11 +17,12 @@
 
 package org.apache.cloudstack.network.contrail.model;
 
+import java.io.Serializable;
 import java.util.Comparator;
 import java.util.TreeSet;
 
 public abstract class ModelObjectBase implements ModelObject {
-    public static class UuidComparator implements Comparator<ModelObject> {
+    public static class UuidComparator implements Comparator<ModelObject>, Serializable
{
         @Override
         public int compare(ModelObject lhs, ModelObject rhs) {
             if (lhs == null) {
@@ -79,7 +80,22 @@ public abstract class ModelObjectBase implements ModelObject {
     }
 
     @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((_ancestors == null) ? 0 : _ancestors.hashCode());
+        result = prime * result
+                + ((_successors == null) ? 0 : _successors.hashCode());
+        return result;
+    }
+
+    @Override
     public boolean equals(Object rhs) {
+        if (this == rhs)
+            return true;
+        if (rhs == null)
+            return false;
         ModelObject other;
         try {
             other = (ModelObject) rhs;


Mime
View raw message