Package org.constretto.exception

Examples of org.constretto.exception.ConstrettoException


    public InputStream getInputStream() {
        try {
            URL url = new URL(path);
            return url.openStream();
        } catch (MalformedURLException ex) {
            throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex);
        } catch (IOException e) {
            throw new ConstrettoException("Woot", e);
        }
    }
View Full Code Here


    public static final String FILE_PREFIX = "file:";
    final String path;

    protected Resource(String path) {
        if (path == null) {
            throw new ConstrettoException("Resources with a null value for the 'path' argument is not allowed. ");
        }
        this.path = path;
    }
View Full Code Here

    public InputStream getInputStream() {
        String fileName = extractFileNameFromFileResource(path);
        try {
            return new FileInputStream(new File(fileName));
        } catch (FileNotFoundException e) {
            throw new ConstrettoException("Could not read file from path: " + path);
        }
    }
View Full Code Here

                }

            }

        } catch (NamingException e) {
            throw new ConstrettoException("Could not read attributes from LDAP");
        }
        return properties;
    }
View Full Code Here

                    Properties props = new Properties();
                    props.load(is);
                    addPropertiesToMap(props);
                }
            } catch (IOException e) {
                throw new ConstrettoException(e);
            } finally {
                try {
                    if (is != null) {
                        is.close();
                    }
View Full Code Here

    private List<String> getKeys(Preferences p) {
        try {
            return Arrays.asList(p.keys());
        } catch (BackingStoreException e) {
            throw new ConstrettoException(e);
        }
    }
View Full Code Here

    private List<String> getChildren(Preferences p) {
        try {
            return Arrays.asList(p.childrenNames());
        } catch (BackingStoreException e) {
            throw new ConstrettoException(e);
        }
    }
View Full Code Here

    private Preferences load(Resource resource) {
        try {
            return new IniPreferences(resource.getInputStream());
        } catch (Exception e) {
            throw new ConstrettoException(e);
        }
    }
View Full Code Here

            for (int n; (n = inputStream.read(b)) != -1; ) {
                out.append(new String(b, 0, n, DEFAULT_CHARSET));
            }
            return out.toString();
        } catch (IOException e) {
            throw new ConstrettoException("Could not read json file", e);
        }

    }
View Full Code Here

                    if (!ConstrettoUtils.isEmpty(basePath)) {
                        path = basePath + "." + path;
                    }
                    properties.put(path, value);
                } catch (Exception e) {
                    throw new ConstrettoException("Could not access data in field", e);
                }
            }

        }
View Full Code Here

TOP

Related Classes of org.constretto.exception.ConstrettoException

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.