private String getCommand(String configName) { String configValue = getConfigValue(configName); File exec = new File(configValue); if (!FileUtils.isExecutable(exec)) { throw new ResourceException( Status.SERVER_ERROR_INTERNAL, configValue + " command does not exist or is not executable"); } return configValue; }
private static Properties readConfigFile() { File cfgFile = locateConfigFile(); Properties properties = new Properties(); Reader reader = null; try { reader = new InputStreamReader(new FileInputStream(cfgFile), Charset.defaultCharset()); properties.load(reader); } catch (IOException consumed) { throw new ResourceException( Status.SERVER_ERROR_INTERNAL, "An error occured while reading configuration file"); } finally { FileUtils.closeRaisingError(reader, cfgFile.getAbsolutePath()); } return properties; }