Merge pull request #522 from y-higuchi/fix_FI_PUBLIC_SHOULD_BE_PROTECTED

Fix fingbug warning FI_PUBLIC_SHOULD_BE_PROTECTED
diff --git a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
index 6483121..33091b9 100644
--- a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
+++ b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
@@ -78,7 +78,7 @@
     private IMap<String, byte[]> mapTopology = null;
     private MapTopologyListener mapTopologyListener = null;
     private String mapTopologyListenerId = null;
-    
+
     // State related to the ARP map
     protected static final String arpMapName = "arpMap";
     private IMap<ArpMessage, byte[]> arpMap = null;
@@ -98,8 +98,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryAdded(EntryEvent<Long, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -116,8 +117,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryRemoved(EntryEvent<Long, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -134,8 +136,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryUpdated(EntryEvent<Long, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -152,6 +155,7 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryEvicted(EntryEvent<Long, byte[]> event) {
 	    // NOTE: We don't use eviction for this map
 	}
@@ -170,8 +174,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryAdded(EntryEvent<Long, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -188,8 +193,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryRemoved(EntryEvent<Long, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -206,8 +212,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryUpdated(EntryEvent<Long, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -224,6 +231,7 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryEvicted(EntryEvent<Long, byte[]> event) {
 	    // NOTE: We don't use eviction for this map
 	}
@@ -242,8 +250,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryAdded(EntryEvent<String, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -261,8 +270,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryRemoved(EntryEvent<String, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -280,8 +290,9 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryUpdated(EntryEvent<String, byte[]> event) {
-	    byte[] valueBytes = (byte[])event.getValue();
+	    byte[] valueBytes = event.getValue();
 
 	    //
 	    // Decode the value and deliver the notification
@@ -299,11 +310,12 @@
 	 *
 	 * @param event the notification event for the entry.
 	 */
+	@Override
 	public void entryEvicted(EntryEvent<String, byte[]> event) {
 	    // NOTE: We don't use eviction for this map
 	}
     }
-    
+
     /**
      * Class for receiving notifications for ARP requests.
      *
@@ -317,11 +329,12 @@
 		 *
 		 * @param event the notification event for the entry.
 		 */
+		@Override
 		public void entryAdded(EntryEvent<ArpMessage, byte[]> event) {
 		    for (IArpEventHandler arpEventHandler : arpEventHandlers) {
 		    	arpEventHandler.arpRequestNotification(event.getKey());
 		    }
-		    
+
 		    //
 		    // Decode the value and deliver the notification
 		    //
@@ -334,30 +347,33 @@
 		    flowEventHandlerService.notificationRecvTopologyElementAdded(topologyElement);
 		    */
 		}
-	
+
 		/**
 		 * Receive a notification that an entry is removed.
 		 *
 		 * @param event the notification event for the entry.
 		 */
+		@Override
 		public void entryRemoved(EntryEvent<ArpMessage, byte[]> event) {
 			// Not used
 		}
-	
+
 		/**
 		 * Receive a notification that an entry is updated.
 		 *
 		 * @param event the notification event for the entry.
 		 */
+		@Override
 		public void entryUpdated(EntryEvent<ArpMessage, byte[]> event) {
 			// Not used
 		}
-	
+
 		/**
 		 * Receive a notification that an entry is evicted.
 		 *
 		 * @param event the notification event for the entry.
 		 */
+		@Override
 		public void entryEvicted(EntryEvent<ArpMessage, byte[]> event) {
 		    // Not used
 		}
@@ -374,7 +390,7 @@
 	System.setProperty("hazelcast.socket.send.buffer.size", "32");
 	*/
 	// System.setProperty("hazelcast.heartbeat.interval.seconds", "100");
-	
+
 	// Init from configuration file
 	try {
 	    hazelcastConfig = new FileSystemXmlConfig(configFilename);
@@ -395,7 +411,8 @@
     /**
      * Shutdown the Hazelcast Datagrid operation.
      */
-    public void finalize() {
+    @Override
+    protected void finalize() {
 	close();
     }
 
@@ -413,7 +430,7 @@
      */
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
-        Collection<Class<? extends IFloodlightService>> l = 
+        Collection<Class<? extends IFloodlightService>> l =
             new ArrayList<Class<? extends IFloodlightService>>();
         l.add(IDatagridService.class);
         return l;
@@ -425,10 +442,10 @@
      * @return the collection of implemented services.
      */
     @Override
-    public Map<Class<? extends IFloodlightService>, IFloodlightService> 
+    public Map<Class<? extends IFloodlightService>, IFloodlightService>
 			       getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-	    IFloodlightService> m = 
+	    IFloodlightService> m =
             new HashMap<Class<? extends IFloodlightService>,
                 IFloodlightService>();
         m.put(IDatagridService.class, this);
@@ -441,7 +458,7 @@
      * @return the collection of modules this module depends on.
      */
     @Override
-    public Collection<Class<? extends IFloodlightService>> 
+    public Collection<Class<? extends IFloodlightService>>
                                                     getModuleDependencies() {
 	Collection<Class<? extends IFloodlightService>> l =
 	    new ArrayList<Class<? extends IFloodlightService>>();
@@ -477,7 +494,7 @@
 	hazelcastInstance = Hazelcast.newHazelcastInstance(hazelcastConfig);
 
 	restApi.addRestletRoutable(new DatagridWebRoutable());
-	
+
 	arpMap = hazelcastInstance.getMap(arpMapName);
 	arpMap.addEntryListener(new ArpMapListener(), true);
     }
@@ -538,19 +555,19 @@
 
 	this.flowEventHandlerService = null;
     }
-    
+
     @Override
     public void registerArpEventHandler(IArpEventHandler arpEventHandler) {
     	if (arpEventHandler != null) {
     		arpEventHandlers.add(arpEventHandler);
     	}
     }
-    
+
     @Override
     public void deregisterArpEventHandler(IArpEventHandler arpEventHandler) {
     	arpEventHandlers.remove(arpEventHandler);
     }
-    
+
     /**
      * Get all Flows that are currently in the datagrid.
      *
@@ -883,7 +900,7 @@
 	    mapTopology.removeAsync(key);
 	}
     }
-    
+
     @Override
     public void sendArpRequest(ArpMessage arpMessage) {
     	//log.debug("ARP bytes: {}", HexString.toHexString(arpRequest));
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
index ee08177..c830d44 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
@@ -29,7 +29,7 @@
  */
 public class DeviceStorageImpl implements IDeviceStorage {
 	protected final static Logger log = LoggerFactory.getLogger(DeviceStorageImpl.class);
-	
+
 	private GraphDBOperation ope;
 
 	/***
@@ -43,8 +43,8 @@
 		} catch (TitanException e) {
 			log.error("Couldn't open graph operation", e);
 		}
-	}	
-	
+	}
+
 	/***
 	 * Finalize/close function. After you use this class, please call this method.
 	 * It will close the DB connection.
@@ -53,20 +53,20 @@
 	public void close() {
 		ope.close();
 	}
-	
+
 	/***
 	 * Finalize/close function. After you use this class, please call this method.
 	 * It will close the DB connection. This is for Java garbage collection.
 	 */
 	@Override
-	public void finalize() {
+	protected void finalize() {
 		close();
 	}
 
 	/***
 	 * This function is for adding the device into the DB.
 	 * @param device The device you want to add into the DB.
-	 * @return IDeviceObject which was added in the DB. 
+	 * @return IDeviceObject which was added in the DB.
 	 */
 	@Override
 	public IDeviceObject addDevice(IDevice device) {
@@ -82,20 +82,20 @@
 	            	obj = ope.newDevice();
 	                log.debug("Adding device {}: creating new device", device.getMACAddressString());
 	            }
-	 			
+
 	            if (obj == null) {
 	            	return null;
 	            }
-	            
+
 	            changeDeviceAttachments(device, obj);
-		        
+
 	            changeDeviceIpv4Addresses(device, obj);
-	            
+
 	 			obj.setMACAddress(device.getMACAddressString());
 	 			obj.setType("device");
 	 			obj.setState("ACTIVE");
 	 			ope.commit();
-	 			
+
 	 			break;
 	 			//log.debug("Adding device {}",device.getMACAddressString());
 			} catch (TitanException e) {
@@ -104,14 +104,14 @@
 				obj = null;
 			}
 		}
- 		
-		return obj;		
+
+		return obj;
 	}
 
 	/***
 	 * This function is for updating the Device properties.
 	 * @param device The device you want to add into the DB.
-	 * @return IDeviceObject which was added in the DB. 
+	 * @return IDeviceObject which was added in the DB.
 	 */
 	@Override
 	public IDeviceObject updateDevice(IDevice device) {
@@ -125,12 +125,13 @@
 	@Override
 	public void removeDevice(IDevice device) {
 		IDeviceObject dev;
-		
+
 		if ((dev = ope.searchDevice(device.getMACAddressString())) != null) {
 			removeDevice(dev);
 		}
 	}
-	
+
+	@Override
 	public void removeDevice(IDeviceObject deviceObject) {
 		String deviceMac = deviceObject.getMACAddress();
 
@@ -144,12 +145,12 @@
 			log.error("DeviceStorage:removeDevice mac:{} failed", deviceMac);
 		}
 	}
-	
+
 	public void removeDeviceImpl(IDeviceObject deviceObject) {
 		for (IIpv4Address ipv4AddressVertex : deviceObject.getIpv4Addresses()) {
 			ope.removeIpv4Address(ipv4AddressVertex);
 		}
-		
+
 		ope.removeDevice(deviceObject);
 	}
 
@@ -202,9 +203,9 @@
 		} catch (TitanException e) {
 			ope.rollback();
 			log.error(":addDevice mac:{} failed", device.getMACAddressString());
-		}	
+		}
 	}
-	
+
 	/***
 	 * This function is for changing the Device attachment point.
 	 * @param device The new device you want change the attachment point
@@ -218,7 +219,7 @@
 			//Check if there is the port
 			IPortObject port = ope.searchPort(HexString.toHexString(ap.getSwitchDPID()),
 					(short) ap.getPort());
-			log.debug("New Switch Port is {},{}", 
+			log.debug("New Switch Port is {},{}",
 					HexString.toHexString(ap.getSwitchDPID()), (short) ap.getPort());
 
 			if (port != null){
@@ -228,18 +229,18 @@
 					attachedPorts.remove(port);
 				} else {
 					log.debug("Adding device {}: attaching to port", device.getMACAddressString());
-					port.setDevice(obj);  
+					port.setDevice(obj);
 				}
 
 				log.debug("port number is {}", port.getNumber());
 				log.debug("port desc is {}", port.getDesc());
 			}
-		}      		 
+		}
 
 		for (IPortObject port: attachedPorts) {
 			log.debug("Detaching the device {}: detaching from port", device.getMACAddressString());
 			port.removeDevice(obj);
-			
+
 			if (!obj.getAttachedPorts().iterator().hasNext()) {
 				// XXX If there are no more ports attached to the device,
 				// delete it. Otherwise we have a situation where the
@@ -262,17 +263,17 @@
   		try {
   			if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
   				changeDeviceIpv4Addresses(device, obj);
-  	            
+
               	ope.commit();
   			} else {
             	log.error(":changeDeviceIPv4Address mac:{} failed", device.getMACAddressString());
-            }		
+            }
   		} catch (TitanException e) {
   			ope.rollback();
 			log.error(":changeDeviceIPv4Address mac:{} failed due to exception {}", device.getMACAddressString(), e);
 		}
 	}
-	
+
 	private void changeDeviceIpv4Addresses(IDevice device, IDeviceObject deviceObject) {
 		List<String> dbIpv4Addresses = new ArrayList<String>();
 		List<Integer> intDbIpv4Addresses = new ArrayList<Integer>();
@@ -280,33 +281,33 @@
 			dbIpv4Addresses.add(InetAddresses.fromInteger(ipv4Vertex.getIpv4Address()).getHostAddress());
 			intDbIpv4Addresses.add(ipv4Vertex.getIpv4Address());
 		}
-		
+
 		List<String> memIpv4Addresses = new ArrayList<String>();
 		for (int addr : device.getIPv4Addresses()) {
 			memIpv4Addresses.add(InetAddresses.fromInteger(addr).getHostAddress());
 		}
-		
+
 		log.debug("Device IP addresses {}, database IP addresses {}",
 				memIpv4Addresses, dbIpv4Addresses);
-		
+
 		for (int ipv4Address : device.getIPv4Addresses()) {
 			//if (deviceObject.getIpv4Address(ipv4Address) == null) {
 			if (!intDbIpv4Addresses.contains(ipv4Address)) {
 				IIpv4Address dbIpv4Address = ope.ensureIpv4Address(ipv4Address);
-				
+
 				/*
 				IDeviceObject oldDevice = dbIpv4Address.getDevice();
 				if (oldDevice != null) {
 					oldDevice.removeIpv4Address(dbIpv4Address);
 				}
 				*/
-				
-				log.debug("Adding IP address {}", 
+
+				log.debug("Adding IP address {}",
 						InetAddresses.fromInteger(ipv4Address).getHostAddress());
 				deviceObject.addIpv4Address(dbIpv4Address);
 			}
 		}
-			
+
 		List<Integer> deviceIpv4Addresses = Arrays.asList(device.getIPv4Addresses());
 		for (IIpv4Address dbIpv4Address : deviceObject.getIpv4Addresses()) {
 			if (!deviceIpv4Addresses.contains(dbIpv4Address.getIpv4Address())) {
@@ -317,17 +318,17 @@
 			}
 		}
 	}
-	
+
 	/**
 	 * Takes an {@link OnosDevice} and adds it into the database. There is no
-	 * checking of the database data and removing old data - an 
+	 * checking of the database data and removing old data - an
 	 * {@link OnosDevice} basically corresponds to a packet we've just seen,
 	 * and we need to add that information into the database.
 	 */
 	@Override
 	public void addOnosDevice(OnosDevice onosDevice) {
 		String macAddress = HexString.toHexString(onosDevice.getMacAddress().toBytes());
-		
+
 		//if the switch port we try to attach a new device already has a link, then stop adding device
 		IPortObject portObject1 = ope.searchPort(HexString.toHexString(
 				onosDevice.getSwitchDPID()), onosDevice.getSwitchPort());
@@ -339,19 +340,19 @@
 			}
 			return;
 		}
-		
+
 		log.debug("addOnosDevice: {}", onosDevice);
 
 		try {
 			IDeviceObject device = ope.searchDevice(macAddress);
-			
+
 			if (device == null) {
 				device = ope.newDevice();
 				device.setType("device");
 				device.setState("ACTIVE");
 				device.setMACAddress(macAddress);
 			}
-			
+
 			// Check if the device has the IP address, add it if it doesn't
 			if (onosDevice.getIpv4Address() != null) {
 				boolean hasIpAddress = false;
@@ -361,7 +362,7 @@
 						break;
 					}
 				}
-				
+
 				if (!hasIpAddress) {
 					IIpv4Address ipv4Address = ope.ensureIpv4Address(onosDevice.getIpv4Address().intValue());
 					IDeviceObject oldDevice = ipv4Address.getDevice();
@@ -371,7 +372,7 @@
 					device.addIpv4Address(ipv4Address);
 				}
 			}
-			
+
 			// Check if the device has the attachment point, add it if not
 			// TODO single attachment point for now, extend to multiple later
 			String switchDpid = HexString.toHexString(onosDevice.getSwitchDPID());
@@ -390,7 +391,7 @@
 					}
 				}
 			}
-			
+
 			/*
 			for (IPortObject portObject : device.getAttachedPorts()) {
 				ISwitchObject switchObject = portObject.getSwitch();
@@ -401,14 +402,14 @@
 				}
 			}
 			*/
-			
+
 			if (!hasAttachmentPoint) {
 				IPortObject portObject = ope.searchPort(switchDpid, onosDevice.getSwitchPort());
 				if (portObject != null) {
 					portObject.setDevice(device);
 				}
 			}
-			
+
 			ope.commit();
 		}
 		catch (TitanException e) {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
index 5818462..60f8e10 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
@@ -19,11 +19,11 @@
  * This is the class for storing the information of links into GraphDB
  */
 public class LinkStorageImpl implements ILinkStorage {
-	
+
 	protected final static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
 	protected GraphDBOperation op;
 
-	
+
 	/**
 	 * Initialize the object. Open LinkStorage using given configuration file.
 	 * @param conf Path (absolute path for now) to configuration file.
@@ -39,7 +39,7 @@
 	//  Routine process should be implemented in private method.
 	//  A private method MUST NOT call commit or rollback.
 
-	
+
 	/**
 	 * Update a record in the LinkStorage in a way provided by dmop.
 	 * @param link Record of a link to be updated.
@@ -49,7 +49,7 @@
 	@Override
 	public boolean update(Link link, LinkInfo linkinfo, DM_OPERATION dmop) {
 		boolean success = false;
-		
+
 		switch (dmop) {
 		case CREATE:
 		case INSERT:
@@ -99,7 +99,7 @@
 			}
 			break;
 		}
-		
+
 		return success;
 	}
 
@@ -129,7 +129,7 @@
 	@Override
 	public boolean addLink(Link link, LinkInfo linfo) {
 		boolean success = false;
-		
+
 		try {
 			//delete the Device attachment points for the related switch and port
 			deleteDeviceOnPort(link.getSrc(),link.getSrcPort());
@@ -154,10 +154,10 @@
 			e.printStackTrace();
 			log.error("LinkStorageImpl:addLink link:{} linfo:{} failed", link, linfo);
 		}
-		
+
 		return success;
 	}
-	
+
 	/**
 	 * Update multiple records in the LinkStorage in a way provided by op.
 	 * @param links List of records to be updated.
@@ -166,13 +166,13 @@
 	@Override
 	public boolean addLinks(List<Link> links) {
 		boolean success = false;
-		
+
 		for (Link lt: links) {
 			if (! addLinkImpl(lt)) {
 				return false;
 			}
 		}
-		
+
 		try {
 			op.commit();
 			success = true;
@@ -181,7 +181,7 @@
 			e.printStackTrace();
 			log.error("LinkStorageImpl:addLinks link:s{} failed", links);
 		}
-		
+
 		return success;
 	}
 
@@ -192,9 +192,9 @@
 	@Override
 	public boolean deleteLink(Link lt) {
 		boolean success = false;
-		
+
 		log.debug("LinkStorageImpl:deleteLink(): {}", lt);
-		
+
         try {
          	if (deleteLinkImpl(lt)) {
         		op.commit();
@@ -210,7 +210,7 @@
         			new Object[]{lt, e.toString()});
         	e.printStackTrace();
         }
-        
+
         return success;
 	}
 
@@ -221,7 +221,7 @@
 	@Override
 	public boolean deleteLinks(List<Link> links) {
 		boolean success = false;
-		
+
 		try {
 			for (Link lt : links) {
 				if (! deleteLinkImpl(lt)) {
@@ -236,7 +236,7 @@
 			e.printStackTrace();
         	log.error("LinkStorageImpl:deleteLinks failed invalid vertices {}", links);
 		}
-		
+
 		return success;
 	}
 
@@ -256,7 +256,7 @@
 	    ISwitchObject srcSw = srcPort.getSwitch();
 	    if (srcSw == null)
 		return links;
-    	
+
 	    for(IPortObject dstPort : srcPort.getLinkedPorts()) {
 		ISwitchObject dstSw = dstPort.getSwitch();
 		if (dstSw != null) {
@@ -278,14 +278,14 @@
 	@Override
 	public List<Link> getReverseLinks(Long dpid, short port) {
 	    List<Link> links = new ArrayList<Link>();
-    	
+
 	    IPortObject srcPort = op.searchPort(HexString.toHexString(dpid), port);
 	    if (srcPort == null)
 		return links;
 	    ISwitchObject srcSw = srcPort.getSwitch();
 	    if (srcSw == null)
 		return links;
-    	
+
 	    for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) {
 		ISwitchObject dstSw = dstPort.getSwitch();
 		if (dstSw != null) {
@@ -297,7 +297,7 @@
 	    }
 	    return links;
 	}
-	
+
 	/**
 	 * Delete records of the links connected to the port specified by given DPID and port number.
 	 * @param dpid DPID of desired port.
@@ -306,7 +306,7 @@
 	@Override
 	public boolean deleteLinksOnPort(Long dpid, short port) {
 		boolean success = false;
-		
+
 		List<Link> linksToDelete = getLinks(dpid, port);
 		try {
 			for(Link l : linksToDelete) {
@@ -323,7 +323,7 @@
 			e.printStackTrace();
         	log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port);
 		}
-		
+
 		return success;
 	}
 
@@ -337,7 +337,7 @@
 		List<Link> links = new ArrayList<Link>();
 
 		ISwitchObject srcSw = op.searchSwitch(dpid);
-		
+
 		if(srcSw != null) {
 			for(IPortObject srcPort : srcSw.getPorts()) {
 				for(IPortObject dstPort : srcPort.getLinkedPorts()) {
@@ -352,7 +352,7 @@
 				}
 			}
 		}
-		
+
 		return links;
 	}
 
@@ -367,7 +367,7 @@
 		List<Link> links = new ArrayList<Link>();
 
 		ISwitchObject srcSw = op.searchSwitch(dpid);
-		
+
 		if(srcSw != null) {
 			for(IPortObject srcPort : srcSw.getPorts()) {
 				for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) {
@@ -376,7 +376,7 @@
 		        		Link link = new Link(
 							HexString.toLong(dstSw.getDPID()),
 							dstPort.getNumber(),
-					
+
 							HexString.toLong(dpid),
 							srcPort.getNumber());
 		        		links.add(link);
@@ -384,7 +384,7 @@
 				}
 			}
 		}
-		
+
 		return links;
 	}
 
@@ -392,16 +392,17 @@
 	 * Get list of all links whose state is ACTIVE.
 	 * @return List of active links. Empty list if no port was found.
 	 */
+	@Override
 	public List<Link> getActiveLinks() {
 		Iterable<ISwitchObject> switches = op.getActiveSwitches();
 
-		List<Link> links = new ArrayList<Link>(); 
-		
+		List<Link> links = new ArrayList<Link>();
+
 		for (ISwitchObject srcSw : switches) {
 			for(IPortObject srcPort : srcSw.getPorts()) {
 				for(IPortObject dstPort : srcPort.getLinkedPorts()) {
 					ISwitchObject dstSw = dstPort.getSwitch();
-					
+
 					if(dstSw != null && dstSw.getState().equals("ACTIVE")) {
 						links.add(new Link(HexString.toLong(srcSw.getDPID()),
 								srcPort.getNumber(),
@@ -411,10 +412,10 @@
 				}
 			}
 		}
-		
+
 		return links;
 	}
-	
+
 	@Override
 	public LinkInfo getLinkInfo(Link link) {
 		// TODO implement this
@@ -424,7 +425,8 @@
 	/**
 	 * Finalize the object.
 	 */
-	public void finalize() {
+	@Override
+	protected void finalize() {
 		close();
 	}
 
@@ -434,7 +436,7 @@
 	@Override
 	public void close() {
 		// TODO Auto-generated method stub
-//		graph.shutdown();		
+//		graph.shutdown();
 	}
 
 	/**
@@ -444,25 +446,25 @@
 	 */
 	private boolean setLinkInfoImpl(Link link, LinkInfo linkinfo) {
 		// TODO implement this
-		
+
 		return false;
 	}
 
 	private boolean addLinkImpl(Link lt) {
 		boolean success = false;
-		
+
 		IPortObject vportSrc = null, vportDst = null;
-		
+
 		// get source port vertex
 		String dpid = HexString.toHexString(lt.getSrc());
 		short port = lt.getSrcPort();
 		vportSrc = op.searchPort(dpid, port);
-		
+
 		// get dest port vertex
 		dpid = HexString.toHexString(lt.getDst());
 		port = lt.getDstPort();
 		vportDst = op.searchPort(dpid, port);
-		            
+
 		if (vportSrc != null && vportDst != null) {
 			IPortObject portExist = null;
 			// check if the link exists
@@ -472,7 +474,7 @@
 					break;
 				}
 			}
-		
+
 			if (portExist == null) {
 				vportSrc.setLinkPort(vportDst);
 				success = true;
@@ -481,24 +483,24 @@
 						new Object[]{op, lt, vportSrc, vportDst});
 			}
 		}
-		
+
 		return success;
 	}
 
 	private boolean deleteLinkImpl(Link lt) {
 		boolean success = false;
 		IPortObject vportSrc = null, vportDst = null;
-	
+
 	    // get source port vertex
 	 	String dpid = HexString.toHexString(lt.getSrc());
 	 	short port = lt.getSrcPort();
 	 	vportSrc = op.searchPort(dpid, port);
-	    
+
 	    // get dst port vertex
 	 	dpid = HexString.toHexString(lt.getDst());
 	 	port = lt.getDstPort();
 	 	vportDst = op.searchPort(dpid, port);
-	 	
+
 		// FIXME: This needs to remove all edges
 		if (vportSrc != null && vportDst != null) {
 			vportSrc.removeLink(vportDst);
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
index be015d3..9963887 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
@@ -39,7 +39,7 @@
 	 * It will close the DB connection.
 	 */
 	@Override
-	public void finalize() {
+	protected void finalize() {
 		close();
 	}
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
index 71fecd0..7c897d4 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
@@ -18,25 +18,26 @@
 import com.tinkerpop.pipes.transform.PathPipe;
 
 public class TopoLinkServiceImpl implements ITopoLinkService {
-	
+
 	protected GraphDBOperation op;
 	protected final static Logger log = LoggerFactory.getLogger(TopoLinkServiceImpl.class);
 
-	public void finalize() {
+	@Override
+	protected void finalize() {
 		close();
 	}
-	
+
 	@Override
 	public void close() {
 		op.close();
 	}
- 
+
 	@Override
 	public List<Link> getActiveLinks() {
 		op = new GraphDBOperation("");
 		op.commit(); //Commit to ensure we see latest data
 		Iterable<ISwitchObject> switches = op.getActiveSwitches();
-		List<Link> links = new ArrayList<Link>(); 
+		List<Link> links = new ArrayList<Link>();
 		for (ISwitchObject sw : switches) {
 			GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
 			ExtractLink extractor = new ExtractLink();
@@ -44,12 +45,12 @@
 			pipe.start(sw.asVertex());
 			pipe.enablePath(true);
 			pipe.out("on").out("link").in("on").path().step(extractor);
-					
+
 			while (pipe.hasNext() ) {
 				Link l = pipe.next();
 				links.add(l);
 			}
-						
+
 		}
 		op.commit();
 		return links;
@@ -57,7 +58,7 @@
 
 	@Override
 	public List<Link> getLinksOnSwitch(String dpid) {
-		List<Link> links = new ArrayList<Link>(); 
+		List<Link> links = new ArrayList<Link>();
 		ISwitchObject sw = op.searchSwitch(dpid);
 		GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
 		ExtractLink extractor = new ExtractLink();
@@ -65,7 +66,7 @@
 		pipe.start(sw.asVertex());
 		pipe.enablePath(true);
 		pipe.out("on").out("link").in("on").path().step(extractor);
-			
+
 		while (pipe.hasNext() ) {
 			Link l = pipe.next();
 			links.add(l);
@@ -81,7 +82,7 @@
 			long d_dpid = 0;
 			short s_port = 0;
 			short d_port = 0;
-			
+
 			List<?> V = pipe.next();
 			Vertex src_sw = (Vertex)V.get(0);
 			Vertex dest_sw = (Vertex)V.get(3);
@@ -91,9 +92,9 @@
 			d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
 			s_port = (Short) src_port.getProperty("number");
 			d_port = (Short) dest_port.getProperty("number");
-			
+
 			Link l = new Link(s_dpid,s_port,d_dpid,d_port);
-			
+
 			return l;
 		}
 	}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
index 3a324b1..52a5817 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
@@ -9,7 +9,7 @@
 import org.slf4j.LoggerFactory;
 
 public class TopoSwitchServiceImpl implements ITopoSwitchService {
-	
+
 	private GraphDBOperation op;
 	protected final static Logger log = LoggerFactory.getLogger(TopoSwitchServiceImpl.class);
 
@@ -20,16 +20,17 @@
 	public TopoSwitchServiceImpl() {
 		this("");
 	}
-	
-	public void finalize() {
+
+	@Override
+	protected void finalize() {
 		close();
 	}
-	
+
 	@Override
 	public void close() {
 		op.close();
 	}
-	
+
 	@Override
 	public Iterable<ISwitchObject> getActiveSwitches() {
 		// TODO Auto-generated method stub
@@ -65,5 +66,5 @@
 	public IPortObject getPortOnSwitch(String dpid, short port_num) {
 		// TODO Auto-generated method stub
 		return null;
-	}	
+	}
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index 02e3210..dd98f4e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -90,7 +90,7 @@
      * Shutdown the Flow Manager operation.
      */
     @Override
-    public void finalize() {
+    protected void finalize() {
     	close();
     }
 
@@ -711,7 +711,7 @@
 			retry = true;
 		    } catch (Exception e) {
 			log.error("Exception deleting Flow Path from Network MAP: {}", e);
-		    } 
+		    }
 		} while (retry);
 
 		continue;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
index be207c6..4feaa8e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
@@ -82,7 +82,8 @@
     /**
      * Shutdown the Topology Manager operation.
      */
-    public void finalize() {
+    @Override
+    protected void finalize() {
 	close();
     }
 
@@ -100,7 +101,7 @@
      */
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
-        Collection<Class<? extends IFloodlightService>> l = 
+        Collection<Class<? extends IFloodlightService>> l =
             new ArrayList<Class<? extends IFloodlightService>>();
         l.add(ITopologyNetService.class);
         return l;
@@ -112,10 +113,10 @@
      * @return the collection of implemented services.
      */
     @Override
-    public Map<Class<? extends IFloodlightService>, IFloodlightService> 
+    public Map<Class<? extends IFloodlightService>, IFloodlightService>
 			       getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-	    IFloodlightService> m = 
+	    IFloodlightService> m =
             new HashMap<Class<? extends IFloodlightService>,
 	    IFloodlightService>();
         m.put(ITopologyNetService.class, this);
@@ -128,7 +129,7 @@
      * @return the collection of modules this module depends on.
      */
     @Override
-    public Collection<Class<? extends IFloodlightService>> 
+    public Collection<Class<? extends IFloodlightService>>
                                                     getModuleDependencies() {
 	Collection<Class<? extends IFloodlightService>> l =
 	    new ArrayList<Class<? extends IFloodlightService>>();
@@ -191,6 +192,7 @@
      *
      * @return the allocated topology handler.
      */
+    @Override
     public Topology newDatabaseTopology() {
 	Topology topology = new Topology();
 	topology.readFromDatabase(dbHandler);
@@ -207,6 +209,7 @@
      *
      * @param topology the topology to release.
      */
+    @Override
     public void dropTopology(Topology topology) {
 	topology = null;
     }
@@ -303,6 +306,7 @@
      * @return the data path with the computed shortest path if
      * found, otherwise null.
      */
+    @Override
     public DataPath getTopologyShortestPath(Topology topology,
 					    SwitchPort src, SwitchPort dest) {
 	return ShortestPath.getTopologyShortestPath(topology, src, dest);