Page 1 of 1

Default boolean values in config.java

PostPosted:Mon Sep 26, 2016 1:19 pm
by Catscratch
Hi.

I wonder about the default boolean values in config.java.

E.g.:
Code: Select all
STORE_NODE_PATH = ConfigDAO.getBoolean(PROPERTY_STORE_NODE_PATH, "on".equalsIgnoreCase(cfg.getProperty(PROPERTY_STORE_NODE_PATH, "off")));
This always is set to "false" on my installation (fresh install).

Shouldn't it be
Code: Select all
STORE_NODE_PATH = ConfigDAO.getBoolean(PROPERTY_STORE_NODE_PATH, "true".equalsIgnoreCase(cfg.getProperty(PROPERTY_STORE_NODE_PATH, "false")));
?

I'm using community source code.

Re: Default boolean values in config.java

PostPosted:Fri Sep 30, 2016 8:06 am
by pavila
Well, it's the same thing because the boolean value is generated from the "on".equalsIgnoreCase(...) method. In the first case the value should be "on" so the "equalsIgnoreCase()" method would return true. In the second code the value should be "true" because it's making a comparison with the "true" string.

Perhaps it's a bit confusing an the right code should be:
Code: Select all
STORE_NODE_PATH = ConfigDAO.getBoolean(PROPERTY_STORE_NODE_PATH, cfg.getProperty(PROPERTY_STORE_NODE_PATH, "false"));