Package bear.core.except

Examples of bear.core.except.ValidationException


            CommandLineResult<?> run = result;

            Predicate<String> errorPredicate = or(contains("404 Not Found"), contains("ERROR"));

            if(errorPredicate.apply(run.output)){
                throw new ValidationException("Error during download of " + url +
                    ": " + find(on('\n').split(run.output), errorPredicate));
            }
            return result.getResult();
        }
View Full Code Here


                String versionLine = Iterables.find(LINE_SPLITTER.split(text), Predicates2.contains("CentOS"));
                Matcher matcher = Pattern.compile("release\\s+([^\\s]+)").matcher(versionLine);

                if (!matcher.find()) {
                    throw new ValidationException("could not parse OS version: " + versionLine);
                }

                version = Versions.VERSION_SCHEME.parseVersion(matcher.group(1));
            } else if (text.contains("Ubuntu")) {
                flavour = UnixFlavour.UBUNTU;
                subFlavour = UnixSubFlavour.UBUNTU;

                Matcher matcher = Pattern.compile("Ubuntu\\s+(\\d+\\.\\d+)").matcher(text);

                if (!matcher.find()) {
                    throw new ValidationException("could not parse OS version: " + text);
                }

                version = Versions.VERSION_SCHEME.parseVersion(matcher.group(1));
            } else {
                throw new UnsupportedOperationException("todo support: " + text);
View Full Code Here

            path = FilenameUtils.normalize(path, true);

            int dirLevel = StringUtils.split(path, '/').length;

            if(dirLevel <= 2) {
                throw new ValidationException(String.format("won't delete a directory on the second level or higher: %s, dir: %s", dirLevel, path));
            }
        }
    }
View Full Code Here

        return line;
    }

    public void validateOutput(String script, String output){
        if(output.contains("Operation not permitted")){
            throw new ValidationException(script + ": " + output);
        }
    }
View Full Code Here

        if(lineResult.output !=null
            && lineResult.output.contains("doesn't exist")
            && lineResult.output.contains("failed to load")
            ) {
            lineResult.setException(new ValidationException("failed to load " + tempPath));
        }

        return lineResult;
    }
View Full Code Here

TOP

Related Classes of bear.core.except.ValidationException

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.