Package org.arch.dns.exception

Examples of org.arch.dns.exception.InvalidNameException


        }
        // Check for empty labels:  may have only one, and only at end.
        int len = comp.length();
        if ((pos > 0 && len == 0) ||
            (pos == 0 && hasRootLabel())) {
                throw new InvalidNameException(
                        "Empty label must be the last label in a domain name");
        }
        // Check total name length.
        if (len > 0) {
            if (octets + len + 1 >= 256) {
                throw new InvalidNameException("Name too long");
            }
            octets += (short) (len + 1);
        }

        int i = size() - pos;   // index for insertion into "labels"
View Full Code Here


            return this;
        }
        // Check for empty labels:  may have only one, and only at end.
        if ((pos > 0 && dn.hasRootLabel()) ||
            (pos == 0 && hasRootLabel())) {
                throw new InvalidNameException(
                    "Empty label must be the last label in a domain name");
        }

        short newOctets = (short) (octets + dn.octets - 1);
        if (newOctets > 255) {
            throw new InvalidNameException("Name too long");
        }
        octets = newOctets;
        int i = size() - pos;       // index for insertion into "labels"
        labels.addAll(i, dn.labels);
View Full Code Here

                char c3 = name.charAt(++pos);
                if (isDigit(c2) && isDigit(c3)) {
                    return (char)
                        ((c1 - '0') * 100 + (c2 - '0') * 10 + (c3 - '0'));
                } else {
                    throw new InvalidNameException(
                            "Invalid escape sequence in " + name);
                }
            } else {                    // sequence is `\C'
                return c1;
            }
        } catch (IndexOutOfBoundsException e) {
            throw new InvalidNameException(
                    "Invalid escape sequence in " + name);
        }
    }
View Full Code Here

     * Checks that this label is valid.
     * @throws InvalidNameException if label is not valid.
     */
    private static void verifyLabel(String label) throws InvalidNameException {
        if (label.length() > 63) {
            throw new InvalidNameException(
                    "Label exceeds 63 octets: " + label);
        }
        // Check for two-byte characters.
        for (int i = 0; i < label.length(); i++) {
            char c = label.charAt(i);
            if ((c & 0xFF00) != 0) {
                throw new InvalidNameException(
                        "Label has two-byte char: " + label);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.arch.dns.exception.InvalidNameException

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.