diff --git a/bubble-server/src/main/java/bubble/client/BubbleNodeClient.java b/bubble-server/src/main/java/bubble/client/BubbleNodeClient.java index 29688ff6..de98a61e 100644 --- a/bubble-server/src/main/java/bubble/client/BubbleNodeClient.java +++ b/bubble-server/src/main/java/bubble/client/BubbleNodeClient.java @@ -13,6 +13,7 @@ import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.entity.ContentType; import org.cobbzilla.util.http.ApiConnectionInfo; import org.cobbzilla.util.http.HttpRequestBean; @@ -20,6 +21,8 @@ import org.cobbzilla.wizard.server.config.HttpConfiguration; import java.io.IOException; import java.io.InputStream; +import java.net.ConnectException; +import java.net.UnknownHostException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -102,8 +105,12 @@ public class BubbleNodeClient extends BubbleApiClient { try { log.debug("execute: attempting request..."); return super.execute(client, request); + + } catch (ConnectException | ConnectTimeoutException | UnknownHostException e) { + throw e; + } catch (Exception e) { - return die("execute("+request+"): error: "+e); + throw new IllegalStateException("execute("+request+"): error: "+e, e); } } diff --git a/bubble-server/src/main/java/bubble/service/cloud/NodeLauncher.java b/bubble-server/src/main/java/bubble/service/cloud/NodeLauncher.java index df3ab2fa..1cf48cec 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/NodeLauncher.java +++ b/bubble-server/src/main/java/bubble/service/cloud/NodeLauncher.java @@ -33,7 +33,7 @@ public class NodeLauncher implements Runnable { try { for (int i=0; i 0 && !launchMonitor.isRegistered(networkUuid)) { - die("NodeLauncher.run: no longer registered: "+networkUuid); + throw new IllegalStateException("NodeLauncher.run: no longer registered: "+networkUuid); } if (!lock.get().equals(newNodeRequest.getLock())) { die("NodeLauncher.run: existingLock (" + lock.get() + ") is different than lock in NewNodeNotification: " + newNodeRequest.getLock()); diff --git a/bubble-server/src/main/java/bubble/service/notify/NotificationInboxProcessor.java b/bubble-server/src/main/java/bubble/service/notify/NotificationInboxProcessor.java index 54d5fcfe..1e5f7504 100644 --- a/bubble-server/src/main/java/bubble/service/notify/NotificationInboxProcessor.java +++ b/bubble-server/src/main/java/bubble/service/notify/NotificationInboxProcessor.java @@ -22,10 +22,10 @@ import static org.cobbzilla.util.json.JsonUtil.json; @AllArgsConstructor @Slf4j public class NotificationInboxProcessor implements Runnable { - private ReceivedNotification n; - private Map syncRequests; - private BubbleConfiguration configuration; - private ReceivedNotificationDAO receivedNotificationDAO; + private final ReceivedNotification n; + private final Map syncRequests; + private final BubbleConfiguration configuration; + private final ReceivedNotificationDAO receivedNotificationDAO; @Override public void run() { try { diff --git a/bubble-server/src/main/java/bubble/service/notify/NotificationService.java b/bubble-server/src/main/java/bubble/service/notify/NotificationService.java index 85b6adbe..32d61df5 100644 --- a/bubble-server/src/main/java/bubble/service/notify/NotificationService.java +++ b/bubble-server/src/main/java/bubble/service/notify/NotificationService.java @@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.net.ConnectException; +import java.net.UnknownHostException; import java.util.List; import java.util.Map; @@ -122,17 +123,17 @@ public class NotificationService { log.debug("_notify: <<<<< RECEIPT <<<<<< " + json(receipt, COMPACT_MAPPER) + " <<<<<<<<<<<<<<<<<<"); return receipt; - } catch (ConnectException | ConnectTimeoutException | ApiException e) { + } catch (ConnectException | ConnectTimeoutException | UnknownHostException | ApiException e) { notification.setStatus(NotificationSendStatus.error); notification.setException(e); sentNotificationDAO.update(notification); - return die("_notify: " + e); + throw new IllegalStateException("_notify: "+shortError(e), e); } catch (Exception e) { notification.setStatus(NotificationSendStatus.error); notification.setException(e); sentNotificationDAO.update(notification); - return die("_notify: " + e, e); + return die("_notify: "+shortError(e), e); } } }