Skip to content

Commit

Permalink
sonar refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
svenkubiak committed Dec 21, 2015
1 parent ee16ae8 commit 734a116
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mangooio-core/src/main/java/io/mangoo/cache/CacheProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.mangoo.enums.CacheType;
import io.mangoo.enums.Default;
import io.mangoo.enums.Key;
import io.mangoo.exceptions.MangooCacheException;
import io.mangoo.interfaces.MangooCache;

/**
Expand Down Expand Up @@ -44,15 +45,15 @@ public CacheProvider(Config config, Injector injector) {
}

private Class<? extends MangooCache> getCache(CacheType cacheType) {
Class<? extends MangooCache> mangooCache;
Class<? extends MangooCache> cache;
try {
mangooCache = Class.forName(cacheType.getClassName()).asSubclass(MangooCache.class);
LOG.info("Using {} as implementation for Cache.", mangooCache);
cache = Class.forName(cacheType.getClassName()).asSubclass(MangooCache.class);
LOG.info("Using {} as implementation for Cache.", cache);
} catch (ClassNotFoundException | ClassCastException e) {
throw new RuntimeException("Failed to initialize cache implementation", e);
throw new MangooCacheException("Failed to initialize cache implementation", e);
}

return mangooCache;
return cache;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.mangoo.exceptions;

/**
*
* @author svenkubiak
*
*/
public class MangooCacheException extends RuntimeException {
private static final long serialVersionUID = -4928845472170479321L;

public MangooCacheException(String message, Exception e){
super(message, e);
}
}

0 comments on commit 734a116

Please sign in to comment.