Merge "Fix For Bug #335 Bug Description : Remove SW2 property "description" to a...
authorGiovanni Meo <gmeo@cisco.com>
Wed, 29 Jan 2014 05:54:17 +0000 (05:54 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 29 Jan 2014 05:54:17 +0000 (05:54 +0000)
opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java
opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java
opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java

index 03acfa8..e4d55d1 100644 (file)
@@ -9,6 +9,7 @@
 
 package org.opendaylight.controller.configuration.internal;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashSet;
@@ -189,7 +190,12 @@ public class ConfigurationService implements IConfigurationService, ICacheUpdate
         }
         String source = String.format("%s%s", ROOT, fileName);
         Object obj = objReader.read(reader, source);
-        return (obj == null || !(obj instanceof List)) ? Collections.<ConfigurationObject> emptyList()
-                : (List<ConfigurationObject>) obj;
+        if (obj == null) {
+            return Collections.<ConfigurationObject> emptyList();
+        }
+        if (obj instanceof ConcurrentMap) {
+            return new ArrayList<ConfigurationObject>(((ConcurrentMap)obj).values());
+        }
+        return (List<ConfigurationObject>) obj;
     }
 }
index c33fdef..9c1d391 100644 (file)
@@ -10,6 +10,7 @@
 package org.opendaylight.controller.configuration.internal;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Dictionary;
 import java.util.EnumSet;
@@ -219,7 +220,12 @@ public class ContainerConfigurationService implements IConfigurationContainerSer
         }
         String source = String.format("%s%s", root, fileName);
         Object obj = objReader.read(reader, source);
-        return (obj == null || !(obj instanceof List)) ? Collections.<ConfigurationObject> emptyList()
-                : (List<ConfigurationObject>) obj;
+        if (obj == null) {
+            return Collections.<ConfigurationObject> emptyList();
+        }
+        if (obj instanceof ConcurrentMap) {
+            return new ArrayList<ConfigurationObject>(((ConcurrentMap)obj).values());
+        }
+        return (List<ConfigurationObject>) obj;
     }
 }
index e1a8ef8..9cae434 100644 (file)
@@ -480,7 +480,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
              * Host replacement has failed, do the recovery
              */
             hostsDB.put(id, newHost);
-            logger.error("Host replacement failed. Overwrite the host. Repalced Host: {}, New Host: {}", removedHost,
+            logger.error("Host replacement failed. Overwrite the host. Replaced Host: {}, New Host: {}", removedHost,
                     newHost);
         }
         notifyHostLearnedOrRemoved(removedHost, false);
index e8104b5..19f45e6 100644 (file)
@@ -1402,7 +1402,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
             } catch (SocketException e) {
                 log.error("Failed to acquire controller MAC: ", e);
             }
-            if (macAddress != null) {
+            if (macAddress != null && macAddress.length != 0) {
                 break;
             }
         }