Package org.elasticsearch.hadoop

Examples of org.elasticsearch.hadoop.EsHadoopIllegalArgumentException


*/
public abstract class Assert {

    public static void hasText(CharSequence sequence, String message) {
        if (!StringUtils.hasText(sequence)) {
            throw new EsHadoopIllegalArgumentException(message);
        }
    }
View Full Code Here


        hasText(sequence, "[Assertion failed] - this CharSequence argument must have text; it must not be null, empty, or blank");
    }

    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new EsHadoopIllegalArgumentException(message);
        }
    }
View Full Code Here

        notNull(object, "[Assertion failed] - this argument is required; it must not be null");
    }

    public static void isTrue(Boolean object, String message) {
        if (!Boolean.TRUE.equals(object)) {
            throw new EsHadoopIllegalArgumentException(message);
        }
    }
View Full Code Here

        StringWriter sw = new StringWriter();
        if (props != null) {
            try {
                props.store(sw, "");
            } catch (IOException ex) {
                throw new EsHadoopIllegalArgumentException(ex);
            }
        }
        return sw.toString();
    }
View Full Code Here

        Properties copy = new Properties();
        if (source != null) {
            try {
                copy.load(new StringReader(source));
            } catch (IOException ex) {
                throw new EsHadoopIllegalArgumentException(ex);
            }
        }
        return copy;
    }
View Full Code Here

            if (!resource.contains(":")) {
                return loader.getResourceAsStream(resource);
            }
            return new URL(resource).openStream();
        } catch (IOException ex) {
            throw new EsHadoopIllegalArgumentException(String.format("Cannot open stream for resource %s", resource));
        }
    }
View Full Code Here

                    if ("jar".equals(url.getProtocol())) {
                        return url.getPath().replaceAll("!.*$", "");
                    }
                }
            } catch (IOException ex) {
                throw new EsHadoopIllegalArgumentException("Cannot find jar for class " + binaryName, ex);
            }
            throw new EsHadoopIllegalArgumentException("Cannot find class " + binaryName);
        }
View Full Code Here

            else {
                millis = Long.parseLong(sValue);
            }
            return new TimeValue(millis, TimeUnit.MILLISECONDS);
        } catch (NumberFormatException e) {
            throw new EsHadoopIllegalArgumentException("Failed to parse [" + sValue + "]", e);
        }
    }
View Full Code Here

    }

    public int bytesAsInt() throws EsHadoopIllegalArgumentException {
        long bytes = bytes();
        if (bytes > Integer.MAX_VALUE) {
            throw new EsHadoopIllegalArgumentException("size [" + toString() + "] is bigger than max int");
        }
        return (int) bytes;
    }
View Full Code Here

            }
            else {
                bytes = Long.parseLong(sValue);
            }
        } catch (NumberFormatException e) {
            throw new EsHadoopIllegalArgumentException("Failed to parse [" + sValue + "]", e);
        }
        return new ByteSizeValue(bytes, ByteSizeUnit.BYTES);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.hadoop.EsHadoopIllegalArgumentException

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.