Examples of StLightException


Examples of ca.pgon.st.light.exception.StLightException

     * @param message
     *            the error message to throw
     */
    public static void assertTrue(boolean actual, String message) {
        if (!actual) {
            throw new StLightException(message);
        }
    }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

            Process process = runtime.exec(command);
            StreamsUtils.flowStreamNonBlocking(process.getInputStream(), System.out);
            StreamsUtils.flowStreamNonBlocking(process.getErrorStream(), System.err);
            process.waitFor();
        } catch (Exception e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

     */
    public static String hashFile(File file) {
        try {
            return HashUtils.hashInputStream(ALGORITHM, new FileInputStream(file));
        } catch (FileNotFoundException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

        // Prepare the consumer
        MessageDigest messageDigest;
        try {
            messageDigest = MessageDigest.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            throw new StLightException(e);
        }

        // Read the stream
        try {
            byte[] bytes = new byte[BUFFER_SIZE];
            int len;

            while ((len = in.read(bytes)) != -1) {
                messageDigest.update(bytes, 0, len);
            }

        } catch (Exception e) {
            throw new StLightException("Issue hashing the stream", e);
        } finally {

            // Close the source
            try {
                in.close();
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

     */
    public static String hashFile(File file) {
        try {
            return HashUtils.hashInputStream(ALGORITHM, new FileInputStream(file));
        } catch (FileNotFoundException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

            process.getOutputStream().close();
            StreamsUtils.flowStreamNonBlocking(process.getInputStream(), System.out);
            StreamsUtils.flowStreamNonBlocking(process.getErrorStream(), System.err);
            process.waitFor();
        } catch (Exception e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

            while ((len = reader.read(chars)) != -1) {
                sb.append(chars, 0, len);
            }
            return sb.toString();
        } catch (Exception e) {
            throw new StLightException("Cannot load resource", e);
        } finally {
            try {
                in.close();
            } catch (Exception e) {
            }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

        // Register the directories
        try {
            fsWatchService = FileSystems.getDefault().newWatchService();
            registerRecursively(basePath);
        } catch (IOException e) {
            throw new StLightException(e);
        }

        // Start the watch thread
        start();
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

    protected void register(Path path) {
        try {
            WatchKey key = path.register(fsWatchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
            pathByKey.put(key, path);
        } catch (IOException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

Examples of ca.pgon.st.light.exception.StLightException

            // Wait for the next event
            WatchKey key;
            try {
                key = fsWatchService.take();
            } catch (InterruptedException e) {
                throw new StLightException(e);
            }

            // Go through all the events
            for (WatchEvent<?> event : key.pollEvents()) {
                WatchEvent<Path> pathEvent = (WatchEvent<Path>) event;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.