com.alibaba.dubbo.cache.filter.CacheFilter
when value is null,it will throw NPE(if use ehcache for jcache),why not check null here?
if the value is null ,maybe we have no need to cache it.



`package com.alibaba.dubbo.cache.filter;
public class CacheFilter implements Filter {

    private CacheFactory cacheFactory;

    public void setCacheFactory(CacheFactory cacheFactory) {
        this.cacheFactory = cacheFactory;
    }

    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        if (cacheFactory != null && ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.CACHE_KEY))) {
            Cache cache = cacheFactory.getCache(invoker.getUrl().addParameter(Constants.METHOD_KEY, invocation.getMethodName()));
            if (cache != null) {
                String key = StringUtils.toArgumentString(invocation.getArguments());
                if (cache != null && key != null) {
                    Object value = cache.get(key);
                    if (value != null) {
                        return new RpcResult(value);
                    }
                    Result result = invoker.invoke(invocation);
                    **if (!result.hasException()) {**// should check value null or not ?
                        cache.put(key, result.getValue());
                    }
                    return result;
                }
            }
        }
        return invoker.invoke(invocation);
    }

}`
URL url = URL.valueOf("test://test:11/test?cache=" + this.cacheType);
        given(invoker.invoke(invocation)).willReturn(new RpcResult("value"));
        given(invoker.getUrl()).willReturn(url);
        given(invoker1.invoke(invocation)).willReturn(new RpcResult("value1"));
        given(invoker1.getUrl()).willReturn(url);
        given(invoker2.invoke(invocation)).willReturn(new RpcResult("value2"));
        given(invoker2.getUrl()).willReturn(url);
    }
    @Test
    public void testNonArgsMethod() {
        invocation.setMethodName("echo");
        invocation.setParameterTypes(new Class<?>[]{});
        invocation.setArguments(new Object[]{});
        cacheFilter.invoke(invoker, invocation);
        RpcResult rpcResult1 = (RpcResult) cacheFilter.invoke(invoker1, invocation);
        RpcResult rpcResult2 = (RpcResult) cacheFilter.invoke(invoker2, invocation);
        Assert.assertEquals(rpcResult1.getValue(), rpcResult2.getValue());
    }
    @Test
    public void testMethodWithArgs() {
        invocation.setMethodName("echo1");
        invocation.setParameterTypes(new Class<?>[]{String.class});
        invocation.setArguments(new Object[]{"arg1"});
        cacheFilter.invoke(invoker, invocation);
        RpcResult rpcResult1 = (RpcResult) cacheFilter.invoke(invoker1, invocation);
        RpcResult rpcResult2 = (RpcResult) cacheFilter.invoke(invoker2, invocation);
        Assert.assertEquals(rpcResult1.getValue(), rpcResult2.getValue());
    }
}