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);
    }

}`
import java.util.Arrays;
import java.util.List;
import static org.junit.runners.Parameterized.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@RunWith(Parameterized.class)
public class CacheFilterTest {
    private RpcInvocation invocation;
    private CacheFilter cacheFilter = new CacheFilter();
    private Invoker<?> invoker = mock(Invoker.class);
    private Invoker<?> invoker1 = mock(Invoker.class);
    private Invoker<?> invoker2 = mock(Invoker.class);
    private String cacheType;
    private CacheFactory cacheFactory;
    public CacheFilterTest(String cacheType, CacheFactory cacheFactory) {
        this.cacheType = cacheType;
        this.cacheFactory = cacheFactory;
    }
    @Parameters
    public static List<Object[]> cacheFactories() {
        return Arrays.asList(new Object[][]{
                {"lru", new LruCacheFactory()},
                {"jcache", new JCacheFactory()},
                {"threadlocal", new ThreadLocalCacheFactory()}
        });
    }
    @Before
    public void setUp() throws Exception {
        invocation = new RpcInvocation();
        cacheFilter.setCacheFactory(this.cacheFactory);