Graceful handling of ConnectException in HTTP delete

When the HTTPSBController attempts to delete a resource
on a device that is currently unavailable, a ConnectException
is thrown. This patch handles such a case more gracefully.

Change-Id: Iac2ea193bdd06fc8535ffce8850be6e522d3b441
Signed-off-by: Georgios Katsikas <katsikas.gp@gmail.com>
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
index aef15f6..e8fcca0 100644
--- a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
@@ -37,6 +37,7 @@
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
+import javax.ws.rs.ProcessingException;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.client.Entity;
@@ -239,7 +240,13 @@
         // FIXME: do we need to delete an entry by enclosing data in DELETE
         // request?
         // wouldn't it be nice to use PUT to implement the similar concept?
-        Response response = wt.request(mediaType).delete();
+        Response response = null;
+        try {
+            response = wt.request(mediaType).delete();
+        } catch (ProcessingException procEx) {
+            log.error("Cannot issue DELETE {} request on device {}", request, device);
+            return Status.SERVICE_UNAVAILABLE.getStatusCode();
+        }
 
         return response.getStatus();
     }