Commit 3a00d39c authored by helene ortiz's avatar helene ortiz
Browse files

No commit message

No commit message
parent 359dcd99
3.0.1-SNAPSHOT
--------------
* In PropertyManager.getProperty method: avoid the creation of a property that does not exist in reality by testing its id.
3.0.0 3.0.0
----- -----
......
...@@ -103,7 +103,7 @@ public class PropertyManager { ...@@ -103,7 +103,7 @@ public class PropertyManager {
* *
*/ */
public void init() { public void init() {
nomadHome = System.getenv("NOMADCLIENT_HOME"); nomadHome = ConfigManager.getInstance().getStringOrNothingAtAll("nomadGUIHome");
clientFilesFoundPerControllerType = new HashMap<String, Boolean>(); clientFilesFoundPerControllerType = new HashMap<String, Boolean>();
sizePropertyNames = new HashMap<String, String>(); sizePropertyNames = new HashMap<String, String>();
...@@ -335,8 +335,10 @@ public class PropertyManager { ...@@ -335,8 +335,10 @@ public class PropertyManager {
// create the property from database // create the property from database
// container id should not be important unless for properties of command box that should already have been created // container id should not be important unless for properties of command box that should already have been created
// should we test is command box? // should we test is command box?
property = PropertyFactory.getInstance().createProperty(0, propertyId, "unknown", false); if (propertyId != -1) { // H.ORTIZ 28 APR 2016: propertyId must be test to avoid the creation of a property that does not exist in reality...
propertyMap.get(servantId).put(propertyName, property); property = PropertyFactory.getInstance().createProperty(0, propertyId, "unknown", false);
propertyMap.get(servantId).put(propertyName, property);
}
} }
return property; return property;
...@@ -753,9 +755,20 @@ public class PropertyManager { ...@@ -753,9 +755,20 @@ public class PropertyManager {
if (sizePropertyName != null) { if (sizePropertyName != null) {
// New way of managing dynamic properties // New way of managing dynamic properties
int nbDynamics = Integer.valueOf(getProperty(servantId, sizePropertyName).getValue()); Property sizeProperty = getProperty(servantId, sizePropertyName);
for (int i = 0; i < nbDynamics; i++) { if (sizeProperty != null) {
dynamicChildNames.add(genericPropertyName + "." + i); try {
int nbDynamics = Integer.valueOf(sizeProperty.getValue());
for (int i = 0; i < nbDynamics; i++) {
dynamicChildNames.add(genericPropertyName + "." + i);
}
} catch (NumberFormatException e) {
System.err.println("Wrong numeric value for property " + sizePropertyName + " = " + sizeProperty.getValue() + ".");
LOGGER.log(Level.SEVERE, "Wrong numeric value for property " + sizePropertyName + " = " + sizeProperty.getValue() + ".");
}
} else {
System.err.println("Unable to find property " + sizePropertyName + " for servant " + servantId);
LOGGER.log(Level.SEVERE, "Unable to find property " + sizePropertyName + " for servant " + servantId);
} }
} else { } else {
// We do as before... // We do as before...
......
...@@ -163,17 +163,19 @@ public class ConfigManager { ...@@ -163,17 +163,19 @@ public class ConfigManager {
// Load all properties file from conf directory // Load all properties file from conf directory
List<String> propertiesFiles = new ArrayList<String>(); List<String> propertiesFiles = new ArrayList<String>();
// Load all .properties files from NomadGUI/conf/client directory
String[] files = FileHelper.getFilesListByExtension(CLIENT_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true); String[] files = FileHelper.getFilesListByExtension(CLIENT_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true);
if (files!= null) { if (files!= null) {
propertiesFiles.addAll(Arrays.asList(files)); propertiesFiles.addAll(Arrays.asList(files));
} }
// Load all .properties files from NomadGUI/conf/server directory
files = FileHelper.getFilesListByExtension(SERVER_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true); files = FileHelper.getFilesListByExtension(SERVER_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true);
if (files != null) { if (files != null) {
propertiesFiles.addAll(Arrays.asList(files)); propertiesFiles.addAll(Arrays.asList(files));
} }
// Load all .properties files from USER_HOME/.nomad directory
files = FileHelper.getFilesListByExtension(USER_HOME + FILE_SEPARATOR + ".nomad" + FILE_SEPARATOR, PROPERTIES_EXTENSION, true, true); files = FileHelper.getFilesListByExtension(USER_HOME + FILE_SEPARATOR + ".nomad" + FILE_SEPARATOR, PROPERTIES_EXTENSION, true, true);
if (files != null) { if (files != null) {
propertiesFiles.addAll(Arrays.asList(files)); propertiesFiles.addAll(Arrays.asList(files));
......
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