• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MalformedCachePatternException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MalformedCachePatternException类属于org.apache.oro.text包,在下文中一共展示了MalformedCachePatternException类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: matchesPatterns

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
private boolean matchesPatterns(String url, CollectionProperty patterns)
{
    for (JMeterProperty jMeterProperty : patterns)
    {
        String item = jMeterProperty.getStringValue();
        try
        {
            Pattern pattern = JMeterUtils.getPatternCache().getPattern(item,
                    Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
            if (JMeterUtils.getMatcher().matches(url, pattern))
            {
                return true;
            }
        }
        catch (MalformedCachePatternException e)
        {
            LOG.warn("Skipped invalid pattern: " + item, e);
        }
    }
    return false;
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:22,代码来源:JMeterProxyControl.java


示例2: testPattern

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
/**
 * Returns true if matching pattern was different from expectedToMatch
 * @param expression Expression to match
 * @param sampleContentType
 * @return boolean true if Matching expression
 */
private final boolean testPattern(String expression, String sampleContentType, boolean expectedToMatch) {
    if(expression != null && expression.length() > 0) {
        if(log.isDebugEnabled()) {
            log.debug("Testing Expression : " + expression + " on sampleContentType:"+sampleContentType+", expected to match:"+expectedToMatch);
        }

        Pattern pattern = null;
        try {
            pattern = JMeterUtils.getPatternCache().getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
            if(JMeterUtils.getMatcher().contains(sampleContentType, pattern) != expectedToMatch) {
                return false;
            }
        } catch (MalformedCachePatternException e) {
            log.warn("Skipped invalid content pattern: " + expression, e);
        }
    }
    return true;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:25,代码来源:ProxyControl.java


示例3: matchesPatterns

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
private boolean matchesPatterns(String url, CollectionProperty patterns) {
    PropertyIterator iter = patterns.iterator();
    while (iter.hasNext()) {
        String item = iter.next().getStringValue();
        Pattern pattern = null;
        try {
            pattern = JMeterUtils.getPatternCache().getPattern(item, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
            if (JMeterUtils.getMatcher().matches(url, pattern)) {
                return true;
            }
        } catch (MalformedCachePatternException e) {
            log.warn("Skipped invalid pattern: " + item, e);
        }
    }
    return false;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:ProxyControl.java


示例4: createPattern

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
/**
 * create a new pattern object from the string.
 *
 * @param pattern
 *            string representation of the perl5 compatible regex pattern
 * @return compiled Pattern, or <code>null</code> if no pattern could be
 *         compiled
 */
public Pattern createPattern(String pattern) {
    try {
        return JMeterUtils.getPatternCache().getPattern(pattern,
                Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
    } catch (MalformedCachePatternException exception) {
        log.error("Problem with pattern: "+pattern,exception);
        return null;
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:LogFilter.java


示例5: testIsMatching_class_badincludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_class_badincludes() {
    checking(new Expectations() {{
        one (mockClassfile).getClassName();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, Collections.singletonList("/some"), noMatch, noMatch, noMatch);
    try {
        sut.isMatching(mockClassfile);
        fail("did not throw expection for bad excludes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例6: testIsMatching_class_badexcludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_class_badexcludes() {
    checking(new Expectations() {{
        one (mockClassfile).getClassName();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, allMatch, noMatch, Collections.singletonList("/some"), noMatch);
    try {
        sut.isMatching(mockClassfile);
        fail("did not throw expection for bad includes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例7: testIsMatching_field_badincludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_field_badincludes() {
    checking(new Expectations() {{
        one (mockField).getFullSignature();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, Collections.singletonList("/some"), noMatch, noMatch, noMatch);
    try {
        sut.isMatching(mockField);
        fail("did not throw expection for bad excludes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例8: testIsMatching_field_badexcludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_field_badexcludes() {
    checking(new Expectations() {{
        one (mockField).getFullSignature();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, allMatch, noMatch, Collections.singletonList("/some"), noMatch);
    try {
        sut.isMatching(mockField);
        fail("did not throw expection for bad includes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例9: testIsMatching_method_badincludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_method_badincludes() {
    checking(new Expectations() {{
        one (mockMethod).getFullSignature();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, Collections.singletonList("/some"), noMatch, noMatch, noMatch);
    try {
        sut.isMatching(mockMethod);
        fail("did not throw expection for bad excludes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例10: testIsMatching_method_badexcludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_method_badexcludes() {
    checking(new Expectations() {{
        one (mockMethod).getFullSignature();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, allMatch, noMatch, Collections.singletonList("/some"), noMatch);
    try {
        sut.isMatching(mockMethod);
        fail("did not throw expection for bad includes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例11: testIsMatching_local_badincludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_local_badincludes() {
    checking(new Expectations() {{
        one (mockLocalVariable).getName();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, Collections.singletonList("/some"), noMatch, noMatch, noMatch);
    try {
        sut.isMatching(mockLocalVariable);
        fail("did not throw expection for bad excludes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例12: testIsMatching_local_badexcludes

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
public void testIsMatching_local_badexcludes() {
    checking(new Expectations() {{
        one (mockLocalVariable).getName();
    }});

    FilteringSymbolGathererStrategy sut = new FilteringSymbolGathererStrategy(mockStrategy, allMatch, noMatch, Collections.singletonList("/some"), noMatch);
    try {
        sut.isMatching(mockLocalVariable);
        fail("did not throw expection for bad includes regular expression");
    } catch (MalformedCachePatternException ex) {
        // expected
    }
}
 
开发者ID:jeantessier,项目名称:dependency-finder,代码行数:14,代码来源:TestFilteringSymbolGathererStrategy.java


示例13: testPattern

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
/**
 * Returns true if matching pattern was different from expectedToMatch
 *
 * @param expression        Expression to match
 * @param sampleContentType
 * @return boolean true if Matching expression
 */
private boolean testPattern(String expression, String sampleContentType, boolean expectedToMatch)
{
    if (expression != null && expression.length() > 0)
    {
        if (LOG.isDebugEnabled())
        {
            LOG.debug("Testing Expression : " + expression + " on sampleContentType:" + sampleContentType
                    + ", expected to match:" + expectedToMatch);
        }

        Pattern pattern;
        try
        {
            pattern = JMeterUtils.getPatternCache().getPattern(expression,
                    Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
            if (JMeterUtils.getMatcher().contains(sampleContentType, pattern) != expectedToMatch)
            {
                return false;
            }
        }
        catch (MalformedCachePatternException e)
        {
            LOG.warn("Skipped invalid content pattern: " + expression, e);
        }
    }
    return true;
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:35,代码来源:JMeterProxyControl.java


示例14: createPattern

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
/**
 * create a new pattern object from the string.
 *
 * @param pattern
 * @return Pattern
 */
public Pattern createPattern(String pattern) {
    try {
        return JMeterUtils.getPatternCache().getPattern(pattern,
                Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
    } catch (MalformedCachePatternException exception) {
        log.error("Problem with pattern: "+pattern,exception);
        return null;
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:16,代码来源:LogFilter.java


示例15: process

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
private String process(String textToParse) {

        Perl5Matcher matcher = new Perl5Matcher();
        PatternMatcherInput input = new PatternMatcherInput(textToParse);

        PatternCacheLRU pcLRU = new PatternCacheLRU();
        Pattern pattern;
        try {
            pattern = pcLRU.getPattern(regexpField.getText(), Perl5Compiler.READ_ONLY_MASK);
        } catch (MalformedCachePatternException e) {
            return e.toString();
        }
        List<MatchResult> matches = new LinkedList<MatchResult>();
        while (matcher.contains(input, pattern)) {
            matches.add(matcher.getMatch());
        }
        // Construct a multi-line string with all matches
        StringBuilder sb = new StringBuilder();
        final int size = matches.size();
        sb.append("Match count: ").append(size).append("\n");
        for (int j = 0; j < size; j++) {
            MatchResult mr = matches.get(j);
            final int groups = mr.groups();
            for (int i = 0; i < groups; i++) {
                sb.append("Match[").append(j+1).append("][").append(i).append("]=").append(mr.group(i)).append("\n");
            }
        }
        return sb.toString();

    }
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:31,代码来源:RenderAsRegexp.java


示例16: getPattern

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
/**
 * Get a compiled expression from the pattern cache (READ_ONLY).
 *
 * @param expression regular expression to be looked up
 * @return compiled pattern
 *
 * @throws MalformedCachePatternException (Runtime)
 * This should be caught for expressions that may vary (e.g. user input)
 *
 */
public static Pattern getPattern(String expression) throws MalformedCachePatternException {
    return getPattern(expression, Perl5Compiler.READ_ONLY_MASK);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:14,代码来源:JMeterUtils.java


示例17: getPattern

import org.apache.oro.text.MalformedCachePatternException; //导入依赖的package包/类
/**
 * Get a compiled expression from the pattern cache (READ_ONLY).
 *
 * @param expression
 * @return compiled pattern
 *
 * @throws MalformedCachePatternException (Runtime)
 * This should be caught for expressions that may vary (e.g. user input)
 *
 */
public static Pattern getPattern(String expression) throws MalformedCachePatternException {
    return getPattern(expression, Perl5Compiler.READ_ONLY_MASK);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:14,代码来源:JMeterUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ModelProperties类代码示例发布时间:2022-05-23
下一篇:
Java RCFileOutputFormat类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap