Package au.net.causal.projo.prefs

Examples of au.net.causal.projo.prefs.PreferencesException


    {
      return(ImmutableSet.<String>builder().add(pref.childrenNames()).build());
    }
    catch (BackingStoreException e)
    {
      throw new PreferencesException(e);
    }
  }
View Full Code Here


    {
      pref.flush();
    }
    catch (BackingStoreException e)
    {
      throw new PreferencesException(e);
    }
  }
View Full Code Here

        encryptedPassword = encrypter.encrypt(passwordBytes);
        node.putValue(key, encryptedPassword, new PreferenceKeyMetadata<>(byte[].class));
      }
      catch (EncryptionOperationNotPossibleException e)
      {
        throw new PreferencesException("Failed to encrypt password: " + e, e);
      }
      catch (UserAbortedEnteringPasswordException e)
      {
        //Could be thrown if the encrypter is a sourced encrypter
        //In this case, treat as a cancel
        return(null);
      }
    }
    else
    {
      try
      {
        passwordBytes = encrypter.decrypt(encryptedPassword);
      }
      catch (EncryptionOperationNotPossibleException e)
      {
        throw new PreferencesException("Failed to decrypt password: " + e, e);
      }
      catch (UserAbortedEnteringPasswordException e)
      {
        //Could be thrown if the encrypter is a sourced encrypter
        //In this case, treat as a cancel
View Full Code Here

    {
      return(new BigDecimal(s));
    }
    catch (NumberFormatException e)
    {
      throw new PreferencesException("Failed to convert value '" + s + "' to a decimal number.", e);
    }
  }
View Full Code Here

          return(Paths.get(uri));
        }
        catch (ProviderNotFoundException | FileSystemNotFoundException e)
        {
          //Error
          throw new PreferencesException("Failed to load filesystem for URI '" + uri.toString() + "'.", e);
        }
      }
    }
    catch (URISyntaxException e)
    {
      //It's not a URI, proceed to next step
    }
   
    //Otherwise this might be specially encoded
    Path p = stringToPathForSpecialFileSystem(s);
    if (p != null)
      return(p);
   
    //If not then treat as a path from the local file system
    try
    {
      return(Paths.get(s));
    }
    catch (InvalidPathException e)
    {
      throw new PreferencesException("Invalid file path: " + s, e);
    }
  }
View Full Code Here

        fValue = storeValue.toFile();
      }
      catch (UnsupportedOperationException e)
      {
        //May occur if the path is not from the local file system and the path does not support creating Files
        throw new PreferencesException("Path '" + storeValue + "' cannot be converted to File.", e);
      }
    }
   
    //Safe because isSupported() ensured that T is only of File type
    @SuppressWarnings("unchecked")
View Full Code Here

      {
        pValue = fValue.toPath();
      }
      catch (InvalidPathException e)
      {
        throw new PreferencesException("Could not convert file '" + fValue + "' to a Path.", e);
      }
    }
   
    chain.putValue(key, pValue, keyMetadata.withDataType(Path.class));
   
View Full Code Here

    {
      return(Byte.valueOf(s));
    }
    catch (NumberFormatException e)
    {
      throw new PreferencesException("Failed to convert value '" + s + "' to a byte.", e);
    }
  }
View Full Code Here

      else if (storedValueType.equals(Short.class))
        value = storedValueType.cast(nValue.shortValue());
      else if (storedValueType.equals(Byte.class))
        value = storedValueType.cast(nValue.byteValue());
      else
        throw new PreferencesException("Cannot handle storedType=" + storedValueType.getCanonicalName() + ", allowedType=" + attribute.getAllowedValueType().getCanonicalName());
    }
    else
      throw new PreferencesException("Cannot handle storedType=" + storedValueType.getCanonicalName() + ", allowedType=" + attribute.getAllowedValueType().getCanonicalName());
   
    chain.putValue(key, value, componentKeyMetadata);
  }
View Full Code Here

      return(LocalDateTime.parse(s, formatter));
    }
    catch (IllegalArgumentException e)
    {
      //Thrown when parsing fails
      throw new PreferencesException("Could not parse date '" + s + "'.", e);
    }
  }
View Full Code Here

TOP

Related Classes of au.net.causal.projo.prefs.PreferencesException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.