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
-----
......
......@@ -103,7 +103,7 @@ public class PropertyManager {
*
*/
public void init() {
nomadHome = System.getenv("NOMADCLIENT_HOME");
nomadHome = ConfigManager.getInstance().getStringOrNothingAtAll("nomadGUIHome");
clientFilesFoundPerControllerType = new HashMap<String, Boolean>();
sizePropertyNames = new HashMap<String, String>();
......@@ -335,8 +335,10 @@ public class PropertyManager {
// create the property from database
// container id should not be important unless for properties of command box that should already have been created
// should we test is command box?
property = PropertyFactory.getInstance().createProperty(0, propertyId, "unknown", false);
propertyMap.get(servantId).put(propertyName, property);
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...
property = PropertyFactory.getInstance().createProperty(0, propertyId, "unknown", false);
propertyMap.get(servantId).put(propertyName, property);
}
}
return property;
......@@ -753,9 +755,20 @@ public class PropertyManager {
if (sizePropertyName != null) {
// New way of managing dynamic properties
int nbDynamics = Integer.valueOf(getProperty(servantId, sizePropertyName).getValue());
for (int i = 0; i < nbDynamics; i++) {
dynamicChildNames.add(genericPropertyName + "." + i);
Property sizeProperty = getProperty(servantId, sizePropertyName);
if (sizeProperty != null) {
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 {
// We do as before...
......
......@@ -163,17 +163,19 @@ public class ConfigManager {
// Load all properties file from conf directory
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);
if (files!= null) {
propertiesFiles.addAll(Arrays.asList(files));
}
// Load all .properties files from NomadGUI/conf/server directory
files = FileHelper.getFilesListByExtension(SERVER_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true);
if (files != null) {
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);
if (files != null) {
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