Package org.apache.hadoop.chukwa.util.RegexUtil

Examples of org.apache.hadoop.chukwa.util.RegexUtil.CheckedPatternSyntaxException


    String[] patterns = listOfPatterns.split(SEPARATOR);
    for(String p: patterns) {
      int equalsPos = p.indexOf('=');
     
      if(equalsPos < 0 || equalsPos > (p.length() -2)) {
        throw new CheckedPatternSyntaxException(
            "pattern must be of form targ=pattern", p, -1);
      }
     
      String targ = p.substring(0, equalsPos);
      if(!targ.startsWith("tags.") && !ArrayUtils.contains(SEARCH_TARGS, targ)) {
        throw new CheckedPatternSyntaxException(
            "pattern doesn't start with recognized search target", p, -1);
      }
     
      String regex = p.substring(equalsPos+1);
      if (!RegexUtil.isRegex(regex)) {
          throw new CheckedPatternSyntaxException(RegexUtil.regexException(regex));
      }

      Pattern pat = Pattern.compile(regex, Pattern.DOTALL);
      compiledPatterns.add(new SearchRule(pat, targ));
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.chukwa.util.RegexUtil.CheckedPatternSyntaxException

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.