Skip to content
Snippets Groups Projects
Commit c2f2804c authored by abat's avatar abat
Browse files

Merge into master from pull request #3731:

Fix NPE in REST API for SLAVE switch. BSC-3922  (https://github.com/bigswitch/bigswitchcontroller/pull/3731)
parents 1997db17 dc0486c3
No related branches found
No related tags found
No related merge requests found
......@@ -62,16 +62,24 @@ public class ControllerSwitchesResource extends ServerResource {
public Map<String,String> getDescription() {
Map<String,String> rv = new HashMap<String, String>();
rv.put("manufacturer",
sw.getDescriptionStatistics().getManufacturerDescription());
rv.put("hardware",
sw.getDescriptionStatistics().getHardwareDescription());
rv.put("software",
sw.getDescriptionStatistics().getSoftwareDescription());
rv.put("serialNum",
sw.getDescriptionStatistics().getSerialNumber());
rv.put("datapath",
sw.getDescriptionStatistics().getDatapathDescription());
if (sw.getDescriptionStatistics() == null) {
rv.put("manufacturer", "");
rv.put("hardware", "");
rv.put("software", "");
rv.put("serialNum", "");
rv.put("datapath", "");
} else {
rv.put("manufacturer",
sw.getDescriptionStatistics().getManufacturerDescription());
rv.put("hardware",
sw.getDescriptionStatistics().getHardwareDescription());
rv.put("software",
sw.getDescriptionStatistics().getSoftwareDescription());
rv.put("serialNum",
sw.getDescriptionStatistics().getSerialNumber());
rv.put("datapath",
sw.getDescriptionStatistics().getDatapathDescription());
}
return rv;
}
......@@ -92,6 +100,8 @@ public class ControllerSwitchesResource extends ServerResource {
}
public String getHarole() {
if (sw.getHARole() == null)
return "null";
return sw.getHARole().toString();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment