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 { ...@@ -62,16 +62,24 @@ public class ControllerSwitchesResource extends ServerResource {
public Map<String,String> getDescription() { public Map<String,String> getDescription() {
Map<String,String> rv = new HashMap<String, String>(); Map<String,String> rv = new HashMap<String, String>();
rv.put("manufacturer", if (sw.getDescriptionStatistics() == null) {
sw.getDescriptionStatistics().getManufacturerDescription()); rv.put("manufacturer", "");
rv.put("hardware", rv.put("hardware", "");
sw.getDescriptionStatistics().getHardwareDescription()); rv.put("software", "");
rv.put("software", rv.put("serialNum", "");
sw.getDescriptionStatistics().getSoftwareDescription()); rv.put("datapath", "");
rv.put("serialNum", } else {
sw.getDescriptionStatistics().getSerialNumber()); rv.put("manufacturer",
rv.put("datapath", sw.getDescriptionStatistics().getManufacturerDescription());
sw.getDescriptionStatistics().getDatapathDescription()); 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; return rv;
} }
...@@ -92,6 +100,8 @@ public class ControllerSwitchesResource extends ServerResource { ...@@ -92,6 +100,8 @@ public class ControllerSwitchesResource extends ServerResource {
} }
public String getHarole() { public String getHarole() {
if (sw.getHARole() == null)
return "null";
return sw.getHARole().toString(); 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