From 921654200de6c92c765cb244fc39c3fd18d75c5a Mon Sep 17 00:00:00 2001 From: Rohit Awate Date: Thu, 15 Feb 2018 14:19:31 +0530 Subject: [PATCH] Fixed issue where DashboardState was saved with partial details --- pom.xml | 2 +- .../homewindow/DashboardController.java | 37 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 4f30abd..dc41084 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.4 + 3.1.0 diff --git a/src/main/java/com/rohitawate/restaurant/homewindow/DashboardController.java b/src/main/java/com/rohitawate/restaurant/homewindow/DashboardController.java index 2a080d7..2917184 100644 --- a/src/main/java/com/rohitawate/restaurant/homewindow/DashboardController.java +++ b/src/main/java/com/rohitawate/restaurant/homewindow/DashboardController.java @@ -395,25 +395,26 @@ public class DashboardController implements Initializable { */ public DashboardState getState() { DashboardState dashboardState = null; - try { - switch (httpMethodBox.getValue()) { - case "POST": - case "PUT": - dashboardState = new DashboardState(bodyTabController.getBasicRequest(httpMethodBox.getValue())); - dashboardState.setHeaders(headerTabController.getHeaders()); - break; - default: - // For GET, DELETE requests - dashboardState = new DashboardState(); - } - - dashboardState.setTarget(addressField.getText()); - dashboardState.setHttpMethod(httpMethodBox.getValue()); - dashboardState.setHeaders(headerTabController.getHeaders()); - dashboardState.setParams(getParams()); - } catch (MalformedURLException MURLE) { - System.out.println("Dashboard state was saved with a malformed URL."); + switch (httpMethodBox.getValue()) { + case "POST": + case "PUT": + dashboardState = new DashboardState(bodyTabController.getBasicRequest(httpMethodBox.getValue())); + dashboardState.setHeaders(headerTabController.getHeaders()); + break; + default: + // For GET, DELETE requests + dashboardState = new DashboardState(); } + + try { + dashboardState.setTarget(addressField.getText()); + } catch (MalformedURLException e) { + System.out.println("Dashboard state was saved with an invalid URL."); + } + dashboardState.setHttpMethod(httpMethodBox.getValue()); + dashboardState.setHeaders(headerTabController.getHeaders()); + dashboardState.setParams(getParams()); + return dashboardState; }