Skip to content

Commit 2cd965b

Browse files
committed
Patch form jasonab
http://code.google.com/p/hibernate-memcached/issues/detail?id=12 Findbugs and Eclipse warnings...
1 parent d7125be commit 2cd965b

File tree

5 files changed

+10
-25
lines changed

5 files changed

+10
-25
lines changed

‎pom.xml‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,6 @@
101101
<target>1.5</target>
102102
</configuration>
103103
</plugin>
104-
<plugin>
105-
<artifactId>maven-eclipse-plugin</artifactId>
106-
<configuration>
107-
<downloadSources>true</downloadSources>
108-
</configuration>
109-
</plugin>
110-
<plugin>
111-
<artifactId>maven-idea-plugin</artifactId>
112-
<configuration>
113-
<downloadSources>true</downloadSources>
114-
<downloadJavadocs>false</downloadJavadocs>
115-
</configuration>
116-
</plugin>
117104
<plugin>
118105
<artifactId>maven-assembly-plugin</artifactId>
119106
<configuration>

‎src/main/java/com/googlecode/hibernate/memcached/MemcachedCache.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ private String dogpileTokenKey(String objectKey) {
107107

108108
private Object memcacheGet(Object key) {
109109
String objectKey = toKey(key);
110-
String dogpileKey = dogpileTokenKey(objectKey);
111110

112111
Map<String, Object> multi;
113112

114113
if (dogpilePreventionEnabled) {
114+
String dogpileKey = dogpileTokenKey(objectKey);
115115
log.debug("Checking dogpile key: [{}]", dogpileKey);
116116

117117
log.debug("Memcache.getMulti({}, {})", objectKey, dogpileKey);
@@ -121,9 +121,8 @@ private Object memcacheGet(Object key) {
121121
log.debug("Dogpile key ({}) not found updating token and returning null", dogpileKey);
122122
memcache.set(dogpileKey, cacheTimeSeconds, DOGPILE_TOKEN);
123123
return null;
124-
} else {
125-
log.debug("Dogpile token found for key ({}), getting cached object", dogpileKey);
126124
}
125+
log.debug("Dogpile token found for key ({}), getting cached object", dogpileKey);
127126
} else {
128127
log.debug("Memcache.get({})", objectKey);
129128
multi = memcache.getMulti(objectKey);
@@ -235,7 +234,7 @@ private long getClearIndex() {
235234
Object value = memcache.get(clearIndexKey);
236235
if (value != null) {
237236
if (value instanceof String) {
238-
index = Long.parseLong((String) value);
237+
index = Long.valueOf((String) value);
239238
} else if (value instanceof Long) {
240239
index = (Long) value;
241240
} else {

‎src/main/java/com/googlecode/hibernate/memcached/MemcachedCacheProvider.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,18 @@ protected MemcacheClientFactory getMemcachedClientFactory(Config config) {
166166
.getConstructor(PropertiesHelper.class);
167167
} catch (ClassNotFoundException e) {
168168
throw new CacheException(
169-
"Unable to find factory class [" + factoryClassName + "]");
169+
"Unable to find factory class [" + factoryClassName + "]", e);
170170
} catch (NoSuchMethodException e) {
171171
throw new CacheException(
172-
"Unable to find PropertiesHelper constructor for factory class [" + factoryClassName + "]");
172+
"Unable to find PropertiesHelper constructor for factory class [" + factoryClassName + "]", e);
173173
}
174174

175175
MemcacheClientFactory clientFactory;
176176
try {
177177
clientFactory = (MemcacheClientFactory) constructor.newInstance(config.getPropertiesHelper());
178178
} catch (Exception e) {
179179
throw new CacheException(
180-
"Unable to instantiate factory class [" + factoryClassName + "]");
180+
"Unable to instantiate factory class [" + factoryClassName + "]", e);
181181
}
182182

183183
return clientFactory;

‎src/main/java/com/googlecode/hibernate/memcached/dangamemcached/DangaMemcacheClientFactory.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ public ErrorHandler getErrorHandler() {
116116
(ErrorHandler) Class.forName(errorHandlerName).newInstance();
117117
} catch (ClassNotFoundException e) {
118118
throw new CacheException(
119-
"Unable to find error handler class [" + errorHandlerName + "]");
119+
"Unable to find error handler class [" + errorHandlerName + "]", e);
120120
} catch (IllegalAccessException e) {
121121
throw new CacheException(
122-
"Illegally accessed error handler class [" + errorHandlerName + "]");
122+
"Illegally accessed error handler class [" + errorHandlerName + "]", e);
123123
} catch (InstantiationException e) {
124124
throw new CacheException(
125-
"Failed to instantiate error handler class [" + errorHandlerName + "]");
125+
"Failed to instantiate error handler class [" + errorHandlerName + "]", e);
126126
}
127127

128128
return errorHandler;

‎src/main/java/com/googlecode/hibernate/memcached/utils/StringUtils.java‎

100755100644
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ private static byte[] digest(String algorithm, String data) {
7272
throw new RuntimeException(e);
7373
}
7474

75-
byte[] bytes = digest.digest(data.getBytes());
76-
return bytes;
75+
return digest.digest(data.getBytes());
7776
}
7877
}

0 commit comments

Comments
 (0)