Commit 0c9433e6 authored by Cristina Cocho's avatar Cristina Cocho

Avoid null access when using PropertyManager to store properties of a new...

Avoid null access when using PropertyManager to store properties of a new created driver or controller
parent a2eadce3
...@@ -158,7 +158,10 @@ public class PropertyManager { ...@@ -158,7 +158,10 @@ public class PropertyManager {
boolean clientFilesExist = readPropertiesClientFilesFor(driverType); boolean clientFilesExist = readPropertiesClientFilesFor(driverType);
if (clientFilesExist) { if (clientFilesExist) {
Controller controller = DriverManager.getInstance().getDriver(driverName); Controller controller = DriverManager.getInstance().getDriver(driverName);
createPropertiesForController((Servant)controller); // Revise the name of the method
if (propertiesByControllerType != null && propertiesByControllerType.containsKey(((Servant)controller).getType())) {
createPropertiesForController((Servant)controller); // Revise the name of the method
}
if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant)controller).getType())) { if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant)controller).getType())) {
createDynamicPropertiesForController((Servant)controller); createDynamicPropertiesForController((Servant)controller);
} }
...@@ -175,7 +178,9 @@ public class PropertyManager { ...@@ -175,7 +178,9 @@ public class PropertyManager {
try { try {
// Ask Helene why the getDriver from DriverManager does not throw an exception // Ask Helene why the getDriver from DriverManager does not throw an exception
Controller controller = ControllerManager.getInstance().getController(controllerName); Controller controller = ControllerManager.getInstance().getController(controllerName);
createPropertiesForController((Servant) controller); // Revise the name of the method if (propertiesByControllerType != null && propertiesByControllerType.containsKey(((Servant)controller).getType())) {
createPropertiesForController((Servant) controller); // Revise the name of the method
}
if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant) controller).getType())) { if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant) controller).getType())) {
createDynamicPropertiesForController((Servant) controller); createDynamicPropertiesForController((Servant) controller);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment