当前位置: 首页>>代码示例>>Java>>正文


Java MalformedPatternException.getMessage方法代码示例

本文整理汇总了Java中org.apache.oro.text.regex.MalformedPatternException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MalformedPatternException.getMessage方法的具体用法?Java MalformedPatternException.getMessage怎么用?Java MalformedPatternException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.oro.text.regex.MalformedPatternException的用法示例。


在下文中一共展示了MalformedPatternException.getMessage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Perl5Regex

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
/**
 * @param regex
 *          the regular expression pattern to compile.
 * @throws PatternInvalidSyntaxException
 *           if the regular expression's syntax is invalid.
 */
public Perl5Regex(String regex) {
  super();

  Perl5Compiler perl5Compiler = new Perl5Compiler();

  try {
    pattern = perl5Compiler.compile(regex);
    regexPattern = regex;

  } catch (MalformedPatternException malformedPatternException) {
    throw new PatternInvalidSyntaxException(malformedPatternException
        .getMessage());
  }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:21,代码来源:Perl5Regex.java

示例2: call

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static Object call(PageContext pc , String regExpr, String str, double start, boolean returnsubexpressions) throws ExpressionException {
	try {
		if(returnsubexpressions)
			return Perl5Util.find(regExpr,str,(int)start,true);
		return new Double(Perl5Util.indexOf(regExpr,str,(int)start,true));
	} catch (MalformedPatternException e) {
		throw new FunctionException(pc,"reFind",1,"regularExpression",e.getMessage());
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:10,代码来源:REFind.java

示例3: call

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static Array call(PageContext pc , String regExpr, String str) throws ExpressionException {
	try {
		return Perl5Util.match(regExpr, str, 1, true);
	} 
	catch (MalformedPatternException e) {
		throw new FunctionException(pc,"REMatch",1,"regularExpression",e.getMessage());
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:9,代码来源:REMatch.java

示例4: call

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static Array call(PageContext pc , String regExpr, String str) throws ExpressionException {
	try {
		return Perl5Util.match(regExpr, str, 1, false);
	} 
	catch (MalformedPatternException e) {
		throw new FunctionException(pc,"REMatchNoCase",1,"regularExpression",e.getMessage());
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:9,代码来源:REMatchNoCase.java

示例5: call

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static String call(PageContext pc , String string, String regExp, String replace) throws ExpressionException {
       try {
           return Perl5Util.replace(string,regExp,replace,false,false);
       } 
       catch (MalformedPatternException e) {
           throw new FunctionException(pc,"reReplaceNoCase",2,"regularExpression",e.getMessage());
       }
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:9,代码来源:REReplaceNoCase.java

示例6: call

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static String call(String string, String regExp, String replace) throws ExpressionException { // MUST is this really needed?
    try {
		return Perl5Util.replace(string,regExp,replace,true,false);
	} catch (MalformedPatternException e) {
		throw new ExpressionException("reReplace"+"second"+"regularExpression"+e.getMessage());
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:8,代码来源:REReplace.java

示例7: call

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static Object call(PageContext pc , String regExpr, String str, double start, boolean returnsubexpressions) throws ExpressionException {
	try {
		if(returnsubexpressions)
			return Perl5Util.find(regExpr,str,(int)start,false);
		return new Double(Perl5Util.indexOf(regExpr,str,(int)start,false));
	} catch (MalformedPatternException e) {
		throw new FunctionException(pc,"reFindNoCase",1,"regularExpression",e.getMessage());
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:10,代码来源:REFindNoCase.java

示例8: matches

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
public static boolean matches(String strPattern, String strInput) throws PageException {
	try {
		return _matches(strPattern, strInput);
	} 
	catch (MalformedPatternException e) {
		throw new ExpressionException("The provided pattern ["+strPattern+"] is invalid",e.getMessage());
	}
	
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:10,代码来源:Perl5Util.java

示例9: param

import org.apache.oro.text.regex.MalformedPatternException; //导入方法依赖的package包/类
private void param(String type, String name, Object defaultValue, double min,double max, String strPattern, int maxLength) throws PageException {

    	// check attributes type
    	if(type==null)type="any";
		else type=type.trim().toLowerCase();

    	// check attributes name
    	if(StringUtil.isEmpty(name))
			throw new ExpressionException("The attribute name is required");
    	
    	Object value=null;
		boolean isNew=false;
		
		// get value
		value=VariableInterpreter.getVariableEL(this,name,NullSupportHelper.NULL());
		if(NullSupportHelper.NULL()==value) {
			if(defaultValue==null)
				throw new ExpressionException("The required parameter ["+name+"] was not provided.");
			value=defaultValue;
			isNew=true;
		}
		
		// cast and set value
		if(!"any".equals(type)) {
			// range
			if("range".equals(type)) {
				boolean hasMin=Decision.isValid(min);
				boolean hasMax=Decision.isValid(max);
				double number = Caster.toDoubleValue(value);
				
				if(!hasMin && !hasMax)
					throw new ExpressionException("you need to define one of the following attributes [min,max], when type is set to [range]");
				
				if(hasMin && number<min)
					throw new ExpressionException("The number ["+Caster.toString(number)+"] is to small, the number must be at least ["+Caster.toString(min)+"]");
				
				if(hasMax && number>max)
					throw new ExpressionException("The number ["+Caster.toString(number)+"] is to big, the number cannot be bigger than ["+Caster.toString(max)+"]");
				
				setVariable(name,Caster.toDouble(number));
			}
			// regex
			else if("regex".equals(type) || "regular_expression".equals(type)) {
				String str=Caster.toString(value);
				
				if(strPattern==null) throw new ExpressionException("Missing attribute [pattern]");
				
				try {
					Pattern pattern = new Perl5Compiler().compile(strPattern, Perl5Compiler.DEFAULT_MASK);
			        PatternMatcherInput input = new PatternMatcherInput(str);
			        if( !new Perl5Matcher().matches(input, pattern))
			        	throw new ExpressionException("The value ["+str+"] doesn't match the provided pattern ["+strPattern+"]");
			        
				} catch (MalformedPatternException e) {
					throw new ExpressionException("The provided pattern ["+strPattern+"] is invalid",e.getMessage());
				}
				setVariable(name,str);
			}
			else if ( type.equals( "int" ) || type.equals( "integer" ) ) {

				if ( !Decision.isInteger( value ) )
					throw new ExpressionException( "The value [" + value + "] is not a valid integer" );

                setVariable( name, value );
			}
			else {
				if(!Decision.isCastableTo(type,value,true,true,maxLength)) {
					if(maxLength>-1 && ("email".equalsIgnoreCase(type) || "url".equalsIgnoreCase(type) || "string".equalsIgnoreCase(type))) {
						StringBuilder msg=new StringBuilder(CasterException.createMessage(value, type));
						msg.append(" with a maximum length of "+maxLength+" characters");
						throw new CasterException(msg.toString());	
					}
					throw new CasterException(value,type);	
				}
				
				setVariable(name,value);
				//REALCAST setVariable(name,Caster.castTo(this,type,value,true));
			}
		}
	    else if(isNew) setVariable(name,value);
	}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:82,代码来源:PageContextImpl.java


注:本文中的org.apache.oro.text.regex.MalformedPatternException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。