Package org.apache.james.jspf.core.exceptions

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


        try {
            // get the in Address
            this.inAddress = IPAddr.getInAddress(clientIP);
        } catch (PermErrorException e) {
            // throw an exception cause the ip was not rfc conform
            throw new PermErrorException(e.getMessage());
        }

        // setup the data!
        setupData(mailFrom, hostName);
    }
View Full Code Here

     * SPF-RFC Section 10.1. Processing Limits
     */
    public void increaseCurrentDepth() throws PermErrorException {
        this.currentDepth++;
        if (currentDepth > MAX_DEPTH)
            throw new PermErrorException(
                    "Maximum mechanism/modifiers calls done: "
                        + currentDepth);
    }
View Full Code Here

        // 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

    public synchronized void config(Configuration params) throws PermErrorException {
        super.config(params);
        if (params.groupCount() >= 2 && params.group(2) != null) {
            ip4cidr = Integer.parseInt(params.group(2));
            if (ip4cidr > 32) {
                throw new PermErrorException("Ivalid IP4 CIDR length");
            }
        } else {
            ip4cidr = 32;
        }
        if (params.groupCount() >= 3 && params.group(3) != null) {
            ip6cidr = Integer.parseInt(params.group(3).toString());
            if (ip6cidr > 128) {
                throw new PermErrorException("Ivalid IP6 CIDR length");
            }
        } else {
            ip6cidr = 128;
        }
    }
View Full Code Here

                }
            // PermError / TempError
            // TODO: Should we replace this with the "right" Exceptions ?
            } catch (Exception e) {
                log.debug("No valid ipAddress: ",e);
                throw new PermErrorException("No valid ipAddress: "
                        + spfData.getIpAddress());
            }
           
        }
View Full Code Here

    /**
     * @see org.apache.james.jspf.terms.ConfigurationEnabled#config(Configuration)
     */
    public synchronized void config(Configuration params) throws PermErrorException {
        if (params.groupCount() == 0) {
            throw new PermErrorException("Include mechanism without an host");
        }
        host = params.group(1);
    }
View Full Code Here

            }
           
            finallyChecker.checkSPF(session);
           
            if (exception instanceof NeutralException) {
                throw new PermErrorException("included checkSPF returned NeutralException");
            } else if (exception instanceof NoneException) {
                throw new PermErrorException("included checkSPF returned NoneException");
            } else if (exception instanceof PermErrorException){
                throw (PermErrorException) exception;
            } else if (exception instanceof TempErrorException){
                throw (TempErrorException) exception;
            } else if (exception instanceof RuntimeException){
View Full Code Here

    public Directive(String qualifier, Mechanism mechanism, Logger logger)
            throws PermErrorException {
        super();
        this.log = logger;
        if (qualifier == null) {
            throw new PermErrorException("Qualifier cannot be null");
        }
        this.qualifier = qualifier;
        if (mechanism == null) {
            throw new PermErrorException("Mechanism cannot be null");
        }
        this.resultChecker  = new MechanismResultChecker();
        this.mechanism = mechanism;
    }
View Full Code Here

            while ((checker = session.popChecker())!=spfChecker) {
                log.debug("Redirect resulted in exception. Removing checker: "+checker);
            }

            if (exception instanceof NeutralException) {
                throw new PermErrorException(
                "included checkSPF returned NeutralException");

            } else if (exception instanceof NoneException) {
                // no spf record assigned to the redirect domain
                throw new PermErrorException(
                        "included checkSPF returned NoneException");
            } else if (exception instanceof PermErrorException){
                throw (PermErrorException) exception;
            } else if (exception instanceof TempErrorException){
                throw (TempErrorException) exception;
View Full Code Here

TOP

Related Classes of org.apache.james.jspf.core.exceptions.PermErrorException

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.