[Bugfix] fixed bug in RuntimeConfiguration

- the methods getConfigFile and getDataFile() didn't properly evaluate
if they should throw an exception if a directory or file does not exist
This commit is contained in:
Robert von Burg 2015-02-08 16:48:49 +01:00
parent 70ec912446
commit f847ff3208
1 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
*/
public File getConfigFile(String context, String fileName, boolean checkExists) {
File configFile = new File(getDataPath(), fileName);
if (checkExists && !configFile.isFile() || !configFile.canRead()) {
if (checkExists && (!configFile.isFile() || !configFile.canRead())) {
String msg = "[{0}] requires config file which does not exist with name: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, getName(), context, fileName);
throw new StrolchConfigurationException(msg);
@ -134,7 +134,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
*/
public File getDataFile(String context, String fileName, boolean checkExists) {
File dataFile = new File(getDataPath(), fileName);
if (checkExists && !dataFile.isFile() || !dataFile.canRead()) {
if (checkExists && (!dataFile.isFile() || !dataFile.canRead())) {
String msg = "[{0}] requires data file which does not exist with name: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, getName(), context, fileName);
throw new StrolchConfigurationException(msg);
@ -156,7 +156,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
*/
public File getDataDir(String context, String dirName, boolean checkExists) {
File dataDir = new File(getDataPath(), dirName);
if (checkExists && !dataDir.isDirectory() || !dataDir.canRead()) {
if (checkExists && (!dataDir.isDirectory() || !dataDir.canRead())) {
String msg = "[{0}] requires data directory which does not exist with name: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, getName(), context, dirName);
throw new StrolchConfigurationException(msg);