當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。