Examples of PermErrorException


Examples of org.apache.james.jspf.core.exceptions.PermErrorException

            return spfR1;
        } else if (spfR1 == null && spfR2 != null) {
            return spfR2;
        } else if (spfR1 != null && spfR2 != null) {
            if (spfR1.toLowerCase().equals(spfR2.toLowerCase()) == false) {
                throw new PermErrorException("Published SPF records not equals");
            } else {
                return spfR1;
            }
        } else {
            return null;
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

            try {
                spfChecker.checkSPF(spfData);
            } catch (NoneException e) {
                // no spf record assigned to the redirect domain
                throw new PermErrorException(
                        "included checkSPF returned NoneException");
            } catch (NeutralException e) {
                throw new PermErrorException("included checkSPF returned NeutralException");
           
            } finally {
                //After the redirect we should not use the explanation from the orginal record
                spfData.setIgnoreExplanation(true);
            }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

            // If domain-spec is empty, or there are any DNS processing errors (any RCODE other than 0),
            // or if no records are returned, or if more than one record is returned, or if there are syntax
            // errors in the explanation string, then proceed as if no exp modifier was given.  
            if (records.size() > 1) {
                log.debug("More then one TXT-Record found for explanation");
                throw new PermErrorException("More then one TXT-Record for explanation");
            } else {
                return (String) records.get(0);
            }
        } catch (DNSService.TimeoutException e) {
            throw new TempErrorException("Timeout querying dns server");
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

                for (int i = 0; i < bytes.length / 2; i++) {
                    address[i] = unsigned(bytes[i * 2]) * 256
                            + unsigned(bytes[i * 2 + 1]);
                }
            } else {
                throw new PermErrorException("Not a valid address: " + netAddress);
            }
        } catch (NumberFormatException e) {
            throw new PermErrorException("Not a valid address: " + netAddress);
        }
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

     *             if the ipAddress is not valid (rfc conform)
     */
    public static String getInAddress(String ipAddress)
            throws PermErrorException {
        if (ipAddress == null) {
            throw new PermErrorException(
                    "IP is not a valid ipv4 or ipv6 address");
        } else if (Inet6Util.isValidIPV4Address(ipAddress)) {
            return "in-addr";
        } else if (Inet6Util.isValidIP6Address(ipAddress)) {
            return "ip6";
        } else {
            throw new PermErrorException(
                    "IP is not a valid ipv4 or ipv6 address");
        }
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

    public static String getProperIpAddress(String ip) throws PermErrorException {
        if (isIPV6(ip) && isIPV4MappedIP(ip)) {
            try {
                return getConvertedIP(ip);
            } catch (UnknownHostException e) {
                throw new PermErrorException("Invalid ipAddress: " + ip);
            }
        }
        return ip;
       
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

        // cycle terms
        for (int i = 0; i < terms.length; i++) {
            if (terms[i].length() > 0) {
                Matcher termMatcher = termPattern.matcher(terms[i]);
                if (!termMatcher.matches()) {
                    throw new PermErrorException("Term [" + terms[i]
                            + "] is not syntactically valid: "
                            + termPattern.pattern());
                }

                // true if we matched a modifier, false if we matched a
                // directive
                String modifierString = termMatcher
                        .group(TERM_STEP_REGEX_MODIFIER_POS);

                if (modifierString != null) {
                    // MODIFIER
                    Modifier mod = (Modifier) lookupAndCreateTerm(termMatcher,
                            TERM_STEP_REGEX_MODIFIER_POS);

                    if (mod.enforceSingleInstance()) {
                        Iterator it = result.getModifiers().iterator();
                        while (it.hasNext()) {
                            if (it.next().getClass().equals(mod.getClass())) {
                                throw new PermErrorException("More than one "
                                        + modifierString
                                        + " found in SPF-Record");
                            }
                        }
                    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

        this.log = logger;
        if (qualifier != null && qualifier.length() > 0) {
            this.qualifier = qualifier;
        }
        if (mechanism == null) {
            throw new PermErrorException("Mechanism cannot be null");
        }
        this.mechanism = mechanism;
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

        log.debug("Start expand domain: " + input);

        Matcher inputMatcher = domainSpecPattern.matcher(input);
        if (!inputMatcher.matches() || inputMatcher.groupCount() != 2) {
            throw new PermErrorException("Invalid DomainSpec: "+input);
        }

        StringBuffer res = new StringBuffer();
        if (inputMatcher.group(1) != null && inputMatcher.group(1).length() > 0) {
            res.append(expandMacroString(inputMatcher.group(1), false));
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

        int pos = 0;

        while (inputMatcher.find()) {
            String match2 = inputMatcher.group();
            if (pos != inputMatcher.start()) {
                throw new PermErrorException("Middle part does not match: "+input.substring(0,pos)+">>"+input.substring(pos, inputMatcher.start())+"<<"+input.substring(inputMatcher.start())+" ["+input+"]");
            }
            if (match2.length() > 0) {
                if (match2.startsWith("%{")) {
                    macroCell = input.substring(inputMatcher.start() + 2, inputMatcher
                            .end() - 1);
                    inputMatcher
                            .appendReplacement(decodedValue, replaceCell(macroCell, isExplanation));
                } else if (match2.length() == 2 && match2.startsWith("%")) {
                    // handle the % escaping
                    inputMatcher.appendReplacement(decodedValue, match2.substring(1));
                }
            }
           
            pos = inputMatcher.end();
        }
       
        if (input.length() != pos) {
            throw new PermErrorException("End part does not match: "+input.substring(pos));
        }
       
        inputMatcher.appendTail(decodedValue);

        return decodedValue.toString();
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.