Examples of InvalidPatternException


Examples of org.drools.rule.InvalidPatternException

        TerminalNode terminal = null;

        if ( !(rule instanceof Query) ) {
            // Check a consequence is set
            if ( rule.getConsequence() == null ) {
                throw new InvalidPatternException( "Rule '" + rule.getName() + "' has no Consequence" );
            }
            terminal = new RuleTerminalNode( context.getNextId(),
                                             context.getTupleSource(),
                                             rule,
                                             subrule );
        } else {
            // Check there is no consequence
            if ( rule.getConsequence() != null ) {
                throw new InvalidPatternException( "Query '" + rule.getName() + "' should have no Consequence" );
            }
            terminal = new QueryTerminalNode( context.getNextId(),
                                              context.getTupleSource(),
                                              rule,
                                              subrule );
View Full Code Here

Examples of org.drools.rule.InvalidPatternException

            buffer.append( list.get( 0 ) );
            for ( int i = 1, size = list.size(); i < size; i++ ) {
                buffer.append( ", " + list.get( i ) );
            }

            throw new InvalidPatternException( "Required Declarations not bound: '" + buffer + "'");
        }
    }
View Full Code Here

Examples of org.drools.rule.InvalidPatternException

            buffer.append( list.get( 0 ) );
            for ( int i = 1, size = list.size(); i < size; i++ ) {
                buffer.append( ", " + list.get( i ) );
            }

            throw new InvalidPatternException( "Required Declarations not bound: '" + buffer + "'");
        }
    }
View Full Code Here

Examples of org.eclipse.jgit.errors.InvalidPatternException

        characterClasses.add(DigitPattern.INSTANCE);
      } else {
        final String message = String.format(MessageFormat.format(
            JGitText.get().characterClassIsNotSupported,
            characterClass));
        throw new InvalidPatternException(message, wholePattern);
      }

      pattern = matcher.replaceFirst("");
      matcher.reset(pattern);
    }
View Full Code Here

Examples of org.eclipse.jgit.errors.InvalidPatternException

   * @return Java regex pattern corresponding to given glob pattern
   * @throws InvalidPatternException
   */
  static Pattern convertGlob(String pattern) throws InvalidPatternException {
    if (UNSUPPORTED.matcher(pattern).find())
      throw new InvalidPatternException(
          "Collating symbols [[.a.]] or equivalence class expressions [[=a=]] are not supported", //$NON-NLS-1$
          pattern);

    StringBuilder sb = new StringBuilder(pattern.length());

    int in_brackets = 0;
    boolean seenEscape = false;
    boolean ignoreLastBracket = false;
    boolean in_char_class = false;
    // 6 is the length of the longest posix char class "xdigit"
    char[] charClass = new char[6];

    for (int i = 0; i < pattern.length(); i++) {
      char c = pattern.charAt(i);
      switch (c) {

      case '*':
        if (seenEscape || in_brackets > 0)
          sb.append(c);
        else
          sb.append('.').append(c);
        break;

      case '.':
        if (seenEscape)
          sb.append(c);
        else
          sb.append('\\').append('.');
        break;

      case '?':
        if (seenEscape || in_brackets > 0)
          sb.append(c);
        else
          sb.append('.');
        break;

      case ':':
        if (in_brackets > 0)
          if (lookBehind(sb) == '['
              && isLetter(lookAhead(pattern, i)))
            in_char_class = true;
        sb.append(':');
        break;

      case '-':
        if (in_brackets > 0) {
          if (lookAhead(pattern, i) == ']')
            sb.append('\\').append(c);
          else
            sb.append(c);
        } else
          sb.append('-');
        break;

      case '\\':
        if (in_brackets > 0) {
          char lookAhead = lookAhead(pattern, i);
          if (lookAhead == ']' || lookAhead == '[')
            ignoreLastBracket = true;
        }
        sb.append(c);
        break;

      case '[':
        if (in_brackets > 0) {
          sb.append('\\').append('[');
          ignoreLastBracket = true;
        } else {
          if (!seenEscape) {
            in_brackets++;
            ignoreLastBracket = false;
          }
          sb.append('[');
        }
        break;

      case ']':
        if (seenEscape) {
          sb.append(']');
          ignoreLastBracket = true;
          break;
        }
        if (in_brackets <= 0) {
          sb.append('\\').append(']');
          ignoreLastBracket = true;
          break;
        }
        char lookBehind = lookBehind(sb);
        if ((lookBehind == '[' && !ignoreLastBracket)
            || lookBehind == '^') {
          sb.append('\\');
          sb.append(']');
          ignoreLastBracket = true;
        } else {
          ignoreLastBracket = false;
          if (!in_char_class) {
            in_brackets--;
            sb.append(']');
          } else {
            in_char_class = false;
            String charCl = checkPosixCharClass(charClass);
            // delete last \[:: chars and set the pattern
            if (charCl != null) {
              sb.setLength(sb.length() - 4);
              sb.append(charCl);
            }
            reset(charClass);
          }
        }
        break;

      case '!':
        if (in_brackets > 0) {
          if (lookBehind(sb) == '[')
            sb.append('^');
          else
            sb.append(c);
        } else
          sb.append(c);
        break;

      default:
        if (in_char_class)
          setNext(charClass, c);
        else
          sb.append(c);
        break;
      } // end switch

      seenEscape = c == '\\';

    } // end for

    if (in_brackets > 0)
      throw new InvalidPatternException("Not closed bracket?", pattern); //$NON-NLS-1$
    return Pattern.compile(sb.toString());
  }
View Full Code Here

Examples of org.eclipse.jgit.errors.InvalidPatternException

        characterClasses.add(DigitPattern.INSTANCE);
      } else {
        final String message = String.format(MessageFormat.format(
            JGitText.get().characterClassIsNotSupported,
            characterClass));
        throw new InvalidPatternException(message, wholePattern);
      }

      pattern = matcher.replaceFirst(""); //$NON-NLS-1$
      matcher.reset(pattern);
    }
View Full Code Here

Examples of org.eclipse.jgit.errors.InvalidPatternException

        characterClasses.add(DigitPattern.INSTANCE);
      } else {
        final String message = String.format(MessageFormat.format(
            JGitText.get().characterClassIsNotSupported,
            characterClass));
        throw new InvalidPatternException(message, wholePattern);
      }

      pattern = matcher.replaceFirst("");
      matcher.reset(pattern);
    }
View Full Code Here

Examples of org.spearce_voltpatches.jgit.errors.InvalidPatternException

            }
            else {
                final String message = String.format(
                        "The character class %s is not supported.",
                        characterClass);
                throw new InvalidPatternException(message, wholePattern);
            }

            pattern = matcher.replaceFirst("");
            matcher.reset(pattern);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.