@Override
    public boolean match(Message msg, StreamRule rule) {
        if (msg.getField(rule.getField()) == null)
            return rule.getInverted();

        try {
            final Pattern pattern = patternCache.get(rule.getValue());
            final CharSequence charSequence = new InterruptibleCharSequence(msg.getField(rule.getField()).toString());
            return rule.getInverted() ^ pattern.matcher(charSequence).find();
        } catch (ExecutionException e) {
            LOG.error("Unable to get pattern from regex cache: ", e);
        }

        return false;
    }
@Test
    public void testInvertedMissingFieldShouldMatch() throws Exception {
        final StreamRule rule = getSampleRule();
        rule.setField("nonexistingfield");
        rule.setValue("^foo");
        rule.setInverted(true);

        final Message msg = getSampleMessage();

        final StreamRuleMatcher matcher = getMatcher(rule);
        assertTrue(matcher.match(msg, rule));
    }