Loads properties from the passed file
@param file The file to load from
@return the loaded properties
182971
protected static Properties loadConfig(File file) {
    InputStream is = null;
    try {
      is = new FileInputStream(file);
      return loadConfig(file.getAbsolutePath(), is);     
    } catch (Exception ex) {
      throw new IllegalArgumentException("Failed to load configuration from [" + file.getAbsolutePath() + "]");
    }finally {
      if(is!=null) try { is.close(); } catch (Exception ex) { /* No Op */ }
    }
  }
16359
public void loadFile(File file)
   {
      InputStream is = null;

      try
      {
         is = new FileInputStream(file);
         POIFSFileSystem fs = new POIFSFileSystem(is);
         m_model.setFile(fs);
      }

      catch (IOException ex)
      {
         throw new RuntimeException(ex);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }
   }
874942
private void loadProperties(final String filename, final int depth) {
    logger.warning("Loading file '" + filename + "'");
    final Properties properties = new Properties();
    try {
      // Load our properties file.
      for (final InputStream io : getInputStreamsForFile(filename)) {
        properties.load(io);
        logger.info("Property file loaded successfully (" + filename + ")");
        io.close();
      }
    }
    catch (final java.io.FileNotFoundException ex) {
      logger.warning("Property file not found (" + filename + ")");
    }
    catch (final java.io.IOException ex) {
      logger.warning("IOException loading file: " + ex.getMessage());
      logger.log(Logging.Priority.FATAL.getLevel(), "Error occured while loading properties file (" + filename + ")", ex);
    }
    allProperties.putAll(properties);
    final String includeFiles[] = readIncludeFiles(filename, depth);
    for (final String includeFile : includeFiles) {
      loadProperties(includeFile, depth + 1);
    }
  }
1117332
private Properties loadPropertiesFile(File propertiesFile) throws MojoExecutionException { // NOSONAR
        try (FileInputStream propertiesFileInputStream = new FileInputStream(propertiesFile)) {
            Properties loadedProperties = new Properties();
            loadedProperties.load(propertiesFileInputStream);
            return loadedProperties;
        } catch (IOException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
220196
public void loadPropertyFile(String file, Properties target)
  {
    try
    {
      // Use SecuritySupport class to provide priveleged access to property file
      SecuritySupport ss = SecuritySupport.getInstance();

      InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
                                              file);

      // get a buffered version
      BufferedInputStream bis = new BufferedInputStream(is);

      target.load(bis);  // and load up the property bag from this
      bis.close();  // close out after reading
    }
    catch (Exception ex)
    {
      // ex.printStackTrace();
      throw new org.apache.xml.utils.WrappedRuntimeException(ex);
    }
  }
1082940
private Document loadDocument(String file) {
		Document doc = null;
		URL url = null;
		File f = new File(file);
		if (f.exists()) {
			try {
				url = f.toURI().toURL();
			} catch (MalformedURLException e) {
				throw new ConfigurationException("Unable to load " + file, e);
			}
		}
		if (url == null) {
			url = ClassLoader.getSystemResource(file);
		}
		InputStream is = null;
		if (url == null) {
			if (errorIfMissing) {
				throw new ConfigurationException("Could not open files of the name " + file);
			} else {
				LOG.info("Unable to locate configuration files of the name " + file + ", skipping");
				return doc;
			}
		}
		try {
			is = url.openStream();
			InputSource in = new InputSource(is);
			in.setSystemId(url.toString());
			doc = DomHelper.parse(in, dtdMappings);
		} catch (Exception e) {
			throw new ConfigurationException("Unable to load " + file, e);
		} finally {
			try {
				is.close();
			} catch (IOException e) {
				LOG.error("Unable to close input stream", e);
			}
		}
		if (doc != null) {
			LOG.debug("Wallmod configuration parsed");
		}
		return doc;
	}
558463
public static Properties getPropertiesFromPath(String fileName)
      throws PropertiesFileNotFoundException {

    Properties props = new Properties();
    FileInputStream fis;
    try {
      fis = new FileInputStream(fileName);
      props.load(fis);
      fis.close();
    } catch (Exception e) {
      throw new PropertiesFileNotFoundException(
          "ERROR LOADING PROPERTIES FROM PATH >" + fileName + "< !!!", e);
    }
    return props;
  }
907243
public void loadPropertiesFromFile(final String propertiesFile)
			throws IOException {
		LOG.info("Loading properties from file: " + propertiesFile);
		File file = new File(propertiesFile);

		String bundleName = file.getPath().substring(0,
				file.getPath().indexOf("properties") - 1);
		FileInputStream inputStream = null;

		try {
			inputStream = new FileInputStream(file);
			ResourceBundle bundle = new PropertyResourceBundle(inputStream);
			LOG.info("Adding to bunlde: " + bundleName);
			bundles.put(bundleName, bundle);
		} finally {
			if (inputStream != null) {
				inputStream.close();
			}
		}

	}
569611
public void loadTagMappingFile(String file) {
        if (file != null) {
            File f = new File(file);
            if (!f.exists()) {
                throw new IllegalArgumentException("tag mapping file parameter points to a file that does not exist");
            }
            if (f.isDirectory()) {
                throw new IllegalArgumentException("tag mapping file parameter points to a directory, must be a file");
            } else if (!f.canRead()) {
                throw new IllegalArgumentException(
                        "tag mapping file parameter points to a file we have no read permissions");
            }

            try {
                this.tagMapping = f.toURI().toURL();
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
            }
        } else {
            this.tagMapping = PoiWriterTask.class.getClassLoader().getResource("poi-mapping.xml");
        }
    }
995131
public static ApplicationDescriptor load( File f ) throws IOException {

		Properties properties = Utils.readPropertiesFile( f );
		return load( properties );
	}
67526
public static String[] list(final File file) {
        return AccessController.doPrivileged(new PrivilegedAction<String[]>() {
            @Override
            public String[] run() {
                return file.list();
            }
        });
    }
1374880
public static Properties readProperties(File _file) {
        if (_file.exists()) {
            try {
                return readProperties(new FileInputStream(_file));
            } catch (FileNotFoundException _ex) {
                LOGGER.info("Could not load properties file: " + _file, _ex);
            }
        }
        return null;
    }
882085
public static Properties readPropertiesFile(String fileName) {
		InputStream in = getInputStream(fileName);
		if (in != null) {
			return readPropertiesStream(in);
		}
		return new Properties();
	}
805886
public static Properties readPropertiesFile(final File file) {
		if (!file.exists()) {
			JKIOUtil.logger.info(String.format("File %s doesnot exists , return empty map", file.getName()));
			return new Properties();
		}
		try {
			InputStream in = new FileInputStream(file);
			if (in != null) {
				return readPropertiesStream(in);
			}
		} catch (IOException e) {
			JKExceptionUtil.handle(e);
		}
		return null;
	}
815695
public void loadSettings(String file) throws IOException {
        Path path = Paths.get(file);

        try (BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
            Properties props = new Properties();
            props.load(reader);
            loadSettings(props);
        }
    }
512860
@Nonnull
    public static Properties loadProperties(@Nonnull String properties) throws IOException {
        Properties p = new Properties();
        p.load(new StringReader(properties));
        return p;
    }
29986
public static Properties loadProperties(String path){
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        InputStream in = null;
        try {
            in = cl.getResourceAsStream(path);

            Properties properties = new Properties();
            properties.load(in);

            return properties;

        } catch(IOException ex){
            return null;

        } finally {
            IOUtil.closeQuietly(in);
        }
    }