Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CacheConfig(CacheSimpleConfig simpleConfig) constructor broken in 3.4 #4423

Closed
kutsal opened this issue Jan 16, 2015 · 0 comments · Fixed by #4425
Closed

CacheConfig(CacheSimpleConfig simpleConfig) constructor broken in 3.4 #4423

kutsal opened this issue Jan 16, 2015 · 0 comments · Fixed by #4425

Comments

@kutsal
Copy link

kutsal commented Jan 16, 2015

Looks like @asimarslan forgot to fix variable assignments in this commit. This prevents JCache declarative initialization given a configuration XML containing entries for cache-writer-factory or expiry-policy-factory:

java.lang.ClassCastException: javax.cache.expiry.AccessedExpiryPolicy cannot be cast to javax.cache.integration.CacheLoader
    at com.hazelcast.cache.impl.AbstractCacheProxyBase.<init>(AbstractCacheProxyBase.java:82)
    at com.hazelcast.cache.impl.AbstractInternalCacheProxy.<init>(AbstractInternalCacheProxy.java:76)
    at com.hazelcast.cache.impl.AbstractCacheProxy.<init>(AbstractCacheProxy.java:61)
    at com.hazelcast.cache.impl.CacheProxy.<init>(CacheProxy.java:79)
    at com.hazelcast.cache.impl.HazelcastServerCacheManager.createCacheProxy(HazelcastServerCacheManager.java:130)
    at com.hazelcast.cache.impl.AbstractHazelcastCacheManager.getCacheUnchecked(AbstractHazelcastCacheManager.java:202)
    at com.hazelcast.cache.impl.AbstractHazelcastCacheManager.getCache(AbstractHazelcastCacheManager.java:152)
    at com.hazelcast.cache.impl.AbstractHazelcastCacheManager.getCache(AbstractHazelcastCacheManager.java:44)

Here's the broken code in question:

    public CacheConfig(CacheSimpleConfig simpleConfig) throws Exception {
        ...
        if (simpleConfig.getCacheLoaderFactory() != null) {
            this.cacheLoaderFactory = ClassLoaderUtil.newInstance(null, simpleConfig.getCacheLoaderFactory());
        }
        if (simpleConfig.getCacheWriterFactory() != null) {
            this.cacheLoaderFactory = ClassLoaderUtil.newInstance(null, simpleConfig.getCacheWriterFactory());
        }
        if (simpleConfig.getExpiryPolicyFactory() != null) {
            this.cacheLoaderFactory = ClassLoaderUtil.newInstance(null, simpleConfig.getExpiryPolicyFactory());
        }
        ...
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants