类javax.naming.directory.InvalidSearchFilterException源码实例Demo

下面列出了怎么用javax.naming.directory.InvalidSearchFilterException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码2 项目: TencentKona-8   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码3 项目: jdk8u60   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码4 项目: openjdk-jdk8u   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码6 项目: openjdk-jdk9   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码7 项目: jdk8u-jdk   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码8 项目: hottub   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码9 项目: openjdk-8-source   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码10 项目: openjdk-8   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码11 项目: jdk8u_jdk   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码12 项目: jdk8u-jdk   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码13 项目: jdk8u-dev-jdk   文件: Filter.java
/**
 * First convert filter string into byte[].
 * For LDAP v3, the conversion uses Unicode -> UTF8
 * For LDAP v2, the conversion uses Unicode -> ISO 8859 (Latin-1)
 *
 * Then parse the byte[] as a filter, converting \hh to
 * a single byte, and encoding the resulting filter
 * into the supplied BER buffer
 */
static void encodeFilterString(BerEncoder ber, String filterStr,
    boolean isLdapv3) throws IOException, NamingException {

    if ((filterStr == null) || (filterStr.equals(""))) {
        throw new InvalidSearchFilterException("Empty filter");
    }
    byte[] filter;
    int filterLen;
    if (isLdapv3) {
        filter = filterStr.getBytes("UTF8");
    } else {
        filter = filterStr.getBytes("8859_1");
    }
    filterLen = filter.length;
    if (dbg) {
        dbgIndent = 0;
        System.err.println("String filter: " + filterStr);
        System.err.println("size: " + filterLen);
        dprint("original: ", filter, 0, filterLen);
    }

    encodeFilter(ber, filter, 0, filterLen);
}
 
源代码14 项目: dragonwell8_jdk   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码15 项目: TencentKona-8   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码16 项目: jdk8u60   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码17 项目: openjdk-jdk8u   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码18 项目: openjdk-jdk8u-backup   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码19 项目: openjdk-jdk9   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码20 项目: jdk8u-jdk   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码21 项目: hottub   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码22 项目: openjdk-8-source   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码23 项目: openjdk-8   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码24 项目: jdk8u_jdk   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码25 项目: jdk8u-jdk   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码26 项目: jdk8u-dev-jdk   文件: Filter.java
private static int[] findRightParen(byte[] filter, int filtOffset[], int end)
throws IOException, NamingException {

    int balance = 1;
    boolean escape = false;
    int nextOffset = filtOffset[0];

    while (nextOffset < end && balance > 0) {
        if (!escape) {
            if (filter[nextOffset] == '(')
                balance++;
            else if (filter[nextOffset] == ')')
                balance--;
        }
        if (filter[nextOffset] == '\\' && !escape)
            escape = true;
        else
            escape = false;
        if (balance > 0)
            nextOffset++;
    }
    if (balance != 0) {
        throw new InvalidSearchFilterException("Unbalanced parenthesis");
    }

    // String tmp = filter.substring(filtOffset[0], nextOffset);

    int[] tmp = new int[] {filtOffset[0], nextOffset};

    filtOffset[0] = nextOffset + 1;

    return tmp;

}
 
源代码27 项目: dragonwell8_jdk   文件: Filter.java
static byte[] unescapeFilterValue(byte[] orig, int start, int end)
    throws NamingException {
    boolean escape = false, escStart = false;
    int ival;
    byte ch;

    if (dbg) {
        dprint("unescape: " , orig, start, end);
    }

    int len = end - start;
    byte tbuf[] = new byte[len];
    int j = 0;
    for (int i = start; i < end; i++) {
        ch = orig[i];
        if (escape) {
            // Try LDAP V3 escape (\xx)
            if ((ival = hexchar2int(ch)) < 0) {

                /**
                 * If there is no hex char following a '\' when
                 * parsing a LDAP v3 filter (illegal by v3 way)
                 * we fallback to the way we unescape in v2.
                 */
                if (escStart) {
                    // V2: \* \( \)
                    escape = false;
                    tbuf[j++] = ch;
                } else {
                    // escaping already started but we can't find 2nd hex
                    throw new InvalidSearchFilterException("invalid escape sequence: " + orig);
                }
            } else {
                if (escStart) {
                    tbuf[j] = (byte)(ival<<4);
                    escStart = false;
                } else {
                    tbuf[j++] |= (byte)ival;
                    escape = false;
                }
            }
        } else if (ch != '\\') {
            tbuf[j++] = ch;
            escape = false;
        } else {
            escStart = escape = true;
        }
    }
    byte[] answer = new byte[j];
    System.arraycopy(tbuf, 0, answer, 0, j);
    if (dbg) {
        Ber.dumpBER(System.err, "", answer, 0, j);
    }
    return answer;
}
 
源代码28 项目: dragonwell8_jdk   文件: Filter.java
private static void encodeFilterList(BerEncoder ber, byte[] filter,
    int filterType, int start, int end) throws IOException, NamingException {

    if (dbg) {
        dprint("encFilterList: ", filter, start, end);
        dbgIndent++;
    }

    int filtOffset[] = new int[1];
    int listNumber = 0;
    for (filtOffset[0] = start; filtOffset[0] < end; filtOffset[0]++) {
        if (Character.isSpaceChar((char)filter[filtOffset[0]]))
            continue;

        if ((filterType == LDAP_FILTER_NOT) && (listNumber > 0)) {
            throw new InvalidSearchFilterException(
                "Filter (!) cannot be followed by more than one filters");
        }

        if (filter[filtOffset[0]] == '(') {
            continue;
        }

        int[] parens = findRightParen(filter, filtOffset, end);

        // add enclosing parens
        int len = parens[1]-parens[0];
        byte[] newfilter = new byte[len+2];
        System.arraycopy(filter, parens[0], newfilter, 1, len);
        newfilter[0] = (byte)'(';
        newfilter[len+1] = (byte)')';
        encodeFilter(ber, newfilter, 0, newfilter.length);

        listNumber++;
    }

    if (dbg) {
        dbgIndent--;
    }

}
 
源代码29 项目: TencentKona-8   文件: Filter.java
static byte[] unescapeFilterValue(byte[] orig, int start, int end)
    throws NamingException {
    boolean escape = false, escStart = false;
    int ival;
    byte ch;

    if (dbg) {
        dprint("unescape: " , orig, start, end);
    }

    int len = end - start;
    byte tbuf[] = new byte[len];
    int j = 0;
    for (int i = start; i < end; i++) {
        ch = orig[i];
        if (escape) {
            // Try LDAP V3 escape (\xx)
            if ((ival = hexchar2int(ch)) < 0) {

                /**
                 * If there is no hex char following a '\' when
                 * parsing a LDAP v3 filter (illegal by v3 way)
                 * we fallback to the way we unescape in v2.
                 */
                if (escStart) {
                    // V2: \* \( \)
                    escape = false;
                    tbuf[j++] = ch;
                } else {
                    // escaping already started but we can't find 2nd hex
                    throw new InvalidSearchFilterException("invalid escape sequence: " + orig);
                }
            } else {
                if (escStart) {
                    tbuf[j] = (byte)(ival<<4);
                    escStart = false;
                } else {
                    tbuf[j++] |= (byte)ival;
                    escape = false;
                }
            }
        } else if (ch != '\\') {
            tbuf[j++] = ch;
            escape = false;
        } else {
            escStart = escape = true;
        }
    }
    byte[] answer = new byte[j];
    System.arraycopy(tbuf, 0, answer, 0, j);
    if (dbg) {
        Ber.dumpBER(System.err, "", answer, 0, j);
    }
    return answer;
}
 
源代码30 项目: TencentKona-8   文件: Filter.java
private static void encodeFilterList(BerEncoder ber, byte[] filter,
    int filterType, int start, int end) throws IOException, NamingException {

    if (dbg) {
        dprint("encFilterList: ", filter, start, end);
        dbgIndent++;
    }

    int filtOffset[] = new int[1];
    int listNumber = 0;
    for (filtOffset[0] = start; filtOffset[0] < end; filtOffset[0]++) {
        if (Character.isSpaceChar((char)filter[filtOffset[0]]))
            continue;

        if ((filterType == LDAP_FILTER_NOT) && (listNumber > 0)) {
            throw new InvalidSearchFilterException(
                "Filter (!) cannot be followed by more than one filters");
        }

        if (filter[filtOffset[0]] == '(') {
            continue;
        }

        int[] parens = findRightParen(filter, filtOffset, end);

        // add enclosing parens
        int len = parens[1]-parens[0];
        byte[] newfilter = new byte[len+2];
        System.arraycopy(filter, parens[0], newfilter, 1, len);
        newfilter[0] = (byte)'(';
        newfilter[len+1] = (byte)')';
        encodeFilter(ber, newfilter, 0, newfilter.length);

        listNumber++;
    }

    if (dbg) {
        dbgIndent--;
    }

}
 
 类所在包
 同包方法