Merge remote-tracking branch 'origin/master'
diff --git a/core/api/src/main/java/org/onlab/onos/ApplicationId.java b/core/api/src/main/java/org/onlab/onos/ApplicationId.java
index f345607..433265e 100644
--- a/core/api/src/main/java/org/onlab/onos/ApplicationId.java
+++ b/core/api/src/main/java/org/onlab/onos/ApplicationId.java
@@ -8,7 +8,7 @@
  */
 public final class ApplicationId {
 
-    private static AtomicInteger idDispenser;
+    private static final AtomicInteger ID_DISPENCER = new AtomicInteger(1);
     private final Integer id;
 
     // Ban public construction
@@ -50,10 +50,7 @@
      * @return app id
      */
     public static ApplicationId getAppId() {
-        if (ApplicationId.idDispenser == null) {
-            ApplicationId.idDispenser = new AtomicInteger(1);
-        }
-        return new ApplicationId(ApplicationId.idDispenser.getAndIncrement());
+        return new ApplicationId(ApplicationId.ID_DISPENCER.getAndIncrement());
     }
 
 }
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowId.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowId.java
index 6bcf1db..52eac0a 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowId.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowId.java
@@ -26,6 +26,9 @@
         if (this == obj) {
             return true;
         }
+        if (obj == null) {
+            return false;
+        }
         if (obj.getClass()  == this.getClass()) {
             FlowId that = (FlowId) obj;
             return Objects.equal(this.flowid, that.flowid);
diff --git a/core/api/src/test/java/org/onlab/onos/net/device/DeviceEventTest.java b/core/api/src/test/java/org/onlab/onos/net/device/DeviceEventTest.java
index df19365..9c45b96 100644
--- a/core/api/src/test/java/org/onlab/onos/net/device/DeviceEventTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/device/DeviceEventTest.java
@@ -39,7 +39,7 @@
         Device device = createDevice();
         Port port = new DefaultPort(device, PortNumber.portNumber(123), true);
         long before = System.currentTimeMillis();
-        DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device);
+        DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device, port);
         long after = System.currentTimeMillis();
         validateEvent(event, DeviceEvent.Type.DEVICE_ADDED, device, before, after);
     }
diff --git a/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java b/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
index 0da2733..4933322 100644
--- a/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
@@ -94,14 +94,14 @@
 
     @Override
     public boolean known(IpPrefix addr) {
-        checkNotNull(MAC_ADDR_NULL, addr);
+        checkNotNull(addr, MAC_ADDR_NULL);
         Set<Host> hosts = hostService.getHostsByIp(addr);
         return !hosts.isEmpty();
     }
 
     @Override
     public void reply(Ethernet eth) {
-        checkNotNull(REQUEST_NULL, eth);
+        checkNotNull(eth, REQUEST_NULL);
         checkArgument(eth.getEtherType() == Ethernet.TYPE_ARP,
                 REQUEST_NOT_ARP);
         ARP arp = (ARP) eth.getPayload();
@@ -137,7 +137,7 @@
 
     @Override
     public void forward(Ethernet eth) {
-        checkNotNull(REQUEST_NULL, eth);
+        checkNotNull(eth, REQUEST_NULL);
         checkArgument(eth.getEtherType() == Ethernet.TYPE_ARP,
                 REQUEST_NOT_ARP);
         ARP arp = (ARP) eth.getPayload();
@@ -206,12 +206,12 @@
             for (Link l : links) {
                 // for each link, mark the concerned ports as internal
                 // and the remaining ports are therefore external.
-                if (l.src().deviceId().equals(d)
+                if (l.src().deviceId().equals(d.id())
                         && ports.contains(l.src().port())) {
                     ports.remove(l.src().port());
                     internalPorts.put(d, l.src().port());
                 }
-                if (l.dst().deviceId().equals(d)
+                if (l.dst().deviceId().equals(d.id())
                         && ports.contains(l.dst().port())) {
                     ports.remove(l.dst().port());
                     internalPorts.put(d, l.dst().port());
diff --git a/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTests.java b/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
similarity index 95%
rename from core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTests.java
rename to core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
index a5a2507..d651d56 100644
--- a/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTests.java
+++ b/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
@@ -34,7 +34,8 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.common.testing.EqualsTester;
 
-public class KryoSerializerTests {
+public class KryoSerializerTest {
+
     private static final ProviderId PID = new ProviderId("of", "foo");
     private static final ProviderId PIDA = new ProviderId("of", "foo", true);
     private static final DeviceId DID1 = deviceId("of:foo");
@@ -92,7 +93,7 @@
 
 
     @Test
-    public final void test() {
+    public final void testSerialization() {
         testSerialized(new ConnectPoint(DID1, P1));
         testSerialized(new DefaultLink(PID, CP1, CP2, Link.Type.DIRECT));
         testSerialized(new DefaultPort(DEV1, P1, true));
@@ -119,6 +120,7 @@
         }
     }
 
+    @Test
     public final void testAnnotations() {
         // Annotations does not have equals defined, manually test equality
         final byte[] a1Bytes = kryos.serialize(A1);
@@ -132,9 +134,9 @@
 
     // code clone
     public static void assertAnnotationsEquals(Annotations actual, SparseAnnotations... annotations) {
-        DefaultAnnotations expected = DefaultAnnotations.builder().build();
+        SparseAnnotations expected = DefaultAnnotations.builder().build();
         for (SparseAnnotations a : annotations) {
-            expected = DefaultAnnotations.merge(expected, a);
+            expected = DefaultAnnotations.union(expected, a);
         }
         assertEquals(expected.keys(), actual.keys());
         for (String key : expected.keys()) {
diff --git a/utils/misc/src/main/java/org/onlab/util/Timer.java b/utils/misc/src/main/java/org/onlab/util/Timer.java
index 276138f..7719fa1 100644
--- a/utils/misc/src/main/java/org/onlab/util/Timer.java
+++ b/utils/misc/src/main/java/org/onlab/util/Timer.java
@@ -8,7 +8,7 @@
  */
 public final class Timer {
 
-    private static HashedWheelTimer timer;
+    private static volatile HashedWheelTimer timer;
 
     // Ban public construction
     private Timer() {
@@ -21,10 +21,16 @@
      */
     public static HashedWheelTimer getTimer() {
         if (Timer.timer == null) {
+            initTimer();
+        }
+        return Timer.timer;
+    }
+
+    private static synchronized  void initTimer() {
+        if (Timer.timer == null) {
             Timer.timer = new HashedWheelTimer();
             Timer.timer.start();
         }
-        return Timer.timer;
     }
 
 }