🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"[SOLVED] Possible error in com.rapidminer.parameter.Parameters"

User: "daniel_thibault"
New Altair Community Member
Updated by Jocelyn
This is the code of com.rapidminer.parameter.Parameters.setParameter(String key, String value) as of Unuk rev 708:

/**
* Sets the parameter for the given key after performing a range-check. This method returns true if the type was
* known and false if no parameter type was defined for this key.
*/
public boolean setParameter(String key, String value) {
boolean knownType = true;
if (value == null) {
keyToValueMap.remove(key);
} else {
ParameterType type = keyToTypeMap.get(key);
if (type != null) {
value = type.transformNewValue(value);
knownType = true;
}
keyToValueMap.put(key, value);
}
fireUpdate(key);
return knownType;
}
Now, note that the Javadoc states "This method returns [...] false if no parameter type was defined for this key."  But if you take a close look at the method's code, you'll see that it can *never* return false.

The fix is simple: the knownType initializer needs to be changed, and the Javadoc refined as follows:

/**
* Sets the parameter for the given key after performing a range-check.
* This method returns true if the type was known and false if no
* parameter type was defined for this key (or if the parameter type
* is no longer defined as a result of setting its value to null).
*/
public boolean setParameter(String key, String value) {
boolean knownType = false;
...

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Nils_Woehler"
    New Altair Community Member
    Hi Urhixdur,

    thanks for the report. Seems to be true, we should initialize knownType with false here. I've fixed it :)

    Best,
    Nils