Package org.spearce_voltpatches.jgit.errors

Examples of org.spearce_voltpatches.jgit.errors.NoClosingBracketException


                                    final String pattern) throws InvalidPatternException {
        int firstValidCharClassIndex = indexOfStartBracket + 1;
        int firstValidEndBracketIndex = indexOfStartBracket + 2;

        if(indexOfStartBracket + 1 >= pattern.length()) {
            throw new NoClosingBracketException(indexOfStartBracket, "[", "]",
                    pattern);
        }

        if(pattern.charAt(firstValidCharClassIndex) == '!') {
            firstValidCharClassIndex++;
            firstValidEndBracketIndex++;
        }

        final Matcher charClassStartMatcher = characterClassStartPattern
                .matcher(pattern);

        int groupEnd = -1;
        while(groupEnd == -1) {

            final int possibleGroupEnd = pattern.indexOf(']',
                    firstValidEndBracketIndex);
            if(possibleGroupEnd == -1) {
                throw new NoClosingBracketException(indexOfStartBracket, "[",
                        "]", pattern);
            }

            final boolean foundCharClass = charClassStartMatcher
                    .find(firstValidCharClassIndex);

            if(foundCharClass
                    && charClassStartMatcher.start() < possibleGroupEnd) {

                final String classStart = charClassStartMatcher.group(0);
                final String classEnd = classStart.charAt(1) + "]";

                final int classStartIndex = charClassStartMatcher.start();
                final int classEndIndex = pattern.indexOf(classEnd,
                        classStartIndex + 2);

                if(classEndIndex == -1) {
                    throw new NoClosingBracketException(classStartIndex,
                            classStart, classEnd, pattern);
                }
                firstValidCharClassIndex = classEndIndex + 2;
                firstValidEndBracketIndex = firstValidCharClassIndex;
            }
View Full Code Here

TOP

Related Classes of org.spearce_voltpatches.jgit.errors.NoClosingBracketException

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.