Fixed issue where DashboardState was saved with partial details

This commit is contained in:
Rohit Awate 2018-02-15 14:19:31 +05:30
parent aab5c2d8f8
commit 921654200d
2 changed files with 20 additions and 19 deletions

View file

@ -16,7 +16,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4</version>
<version>3.1.0</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>

View file

@ -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;
}