public Long getValidLong()

in src/main/java/org/apache/sling/xss/impl/XSSAPIImpl.java [117:132]


    public Long getValidLong(String source, long defaultValue) {
        if (source != null && source.length() > 0) {
            try {
                LongValidationRule ivr =
                        new LongValidationRule("number", ESAPI.encoder(), -9000000000000000000L, 9000000000000000000L);
                ivr.setAllowNull(false);
                return ivr.getValid("XSS", source);
            } catch (Exception e) {
                LOGGER.warn("Unable to get a valid long from the input.", e);
                LOGGER.debug("Long input: {}", source);
            }
        }

        // fall through to default if empty, null, or validation failure
        return defaultValue;
    }