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


Java MalformedCachePatternException类代码示例

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


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


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