/****************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one   *
 * or more contributor license agreements.  See the NOTICE file *
 * distributed with this work for additional information        *
 * regarding copyright ownership.  The ASF licenses this file   *
 * to you under the Apache License, Version 2.0 (the            *
 * "License"); you may not use this file except in compliance   *
 * with the License.  You may obtain a copy of the License at   *
 *                                                              *
 *   http://www.apache.org/licenses/LICENSE-2.0                 *
 *                                                              *
 * Unless required by applicable law or agreed to in writing,   *
 * software distributed under the License is distributed on an  *
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
 * KIND, either express or implied.  See the License for the    *
 * specific language governing permissions and limitations      *
 * under the License.                                           *
 ****************************************************************/


package org.apache.james.jspf.terms;

import org.apache.james.jspf.util.Inet6Util;

/**
 * This class represent the ip6 mechanism
 * 
 */
public class IP6Mechanism extends IP4Mechanism {

    /**
     * ABNF: IP6 = "ip6" ":" ip6-network [ ip6-cidr-length ]
     */
    public static final String REGEX = "[iI][pP][6]"
            + "\\:([0-9A-Fa-f\\:\\.]+)" + "(?:" + IP6_CIDR_LENGTH_REGEX + ")?";

    /**
     * @see org.apache.james.jspf.terms.IP4Mechanism#isValidAddress(String)
     */
    protected boolean isValidAddress(String ipString) {
        // TODO: this check is not accurate ":CAFE::BABE" pass the test but is invalid
        boolean res = Inet6Util.isValidIP6Address(ipString);
        // System.err.println("IP6: " + ipString + " valid? "+res);
        return res;
    }

    /**
     * @see org.apache.james.jspf.terms.IP4Mechanism#getMaxCidr()
     */
    protected int getMaxCidr() {
        return 128;
    }
}

@@ -1743,234 +1743,52 @@
     
-// TODO: this check is not accurate %22:CAFE::BABE%22 pass the test but is invalid%0A        boolean res = Inet6Util.isValidIP6Address(ipString);%0A        // System.err.println(%22IP6: %22 + ipString + %22 valid? %22+res);%0A        return res
+return Inet6Util.isValidIP6Address(ipString)
 ;%0A  

Fix Inet6Util.isValidIP6Address for addresses starting with a single ':'