Search in sources :

Example 1 with SafeFileInputStream

use of org.eclipse.core.internal.preferences.SafeFileInputStream in project che by eclipse.

the class ChePreferences method loadProperties.

protected static Properties loadProperties(String location) throws BackingStoreException {
    //        if (DEBUG_PREFERENCE_GENERAL)
    //            PrefsMessages.message("Loading preferences from file: " + location); //$NON-NLS-1$
    InputStream input = null;
    Properties result = new Properties();
    try {
        input = new SafeFileInputStream(new File(location));
        result.load(input);
    } catch (FileNotFoundException e) {
        //                PrefsMessages.message("Preference file does not exist: " + location); //$NON-NLS-1$
        return result;
    } catch (IOException e) {
        //            log(new Status(IStatus.INFO, PrefsMessages.OWNER_NAME, IStatus.INFO, message, e));
        throw new BackingStoreException(e.getMessage(), e);
    } finally {
        if (input != null)
            try {
                input.close();
            } catch (IOException e) {
            // ignore
            }
    }
    return result;
}
Also used : SafeFileInputStream(org.eclipse.core.internal.preferences.SafeFileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) BackingStoreException(org.osgi.service.prefs.BackingStoreException) IOException(java.io.IOException) Properties(java.util.Properties) File(java.io.File) SafeFileInputStream(org.eclipse.core.internal.preferences.SafeFileInputStream)

Aggregations

File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 SafeFileInputStream (org.eclipse.core.internal.preferences.SafeFileInputStream)1 BackingStoreException (org.osgi.service.prefs.BackingStoreException)1