- Use Boolean.parseBoolean() instead of own code (reduces code-base)
String contextParameter = this.getStringContextParameter(String.format("is_debug_%s_enabled", controllerName)); //NOI18N
// Is it set and true?
- boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.equals("true"))); //NOI18N
+ boolean isEnabled = (Boolean.parseBoolean(contextParameter) == Boolean.TRUE);
// Return it
return isEnabled;
// Try it as an NPE may come
try {
// Get value from property
- String value = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
+ String contextParameter = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
// Is it set?
- isEnabled = (value.toLowerCase().equals("true")); //NOI18N
+ isEnabled = (Boolean.parseBoolean(contextParameter) == Boolean.TRUE);
} catch (final NullPointerException ex) {
// Ignored
}