Permalink
Browse files

Avoid potential NullPointerException when filter parameters aren't de…

…fined.
  • Loading branch information...
Andrew Walters
Andrew Walters committed May 23, 2012
1 parent 0a25cb8 commit 38230bc1b09a455c4a7a605899fc808a313a52f8
Showing with 13 additions and 4 deletions.
  1. +13 −4 hazelcast-wm/src/main/java/com/hazelcast/web/WebFilter.java
@@ -129,14 +129,23 @@ private void initInstance() throws ServletException {
if (properties == null) {
properties = new Properties();
}
- properties.setProperty(CONFIG_LOCATION, getParam(CONFIG_LOCATION));
- properties.setProperty(INSTANCE_NAME, getParam(INSTANCE_NAME));
- properties.setProperty(USE_CLIENT, getParam(USE_CLIENT));
- properties.setProperty(CLIENT_CONFIG_LOCATION, getParam(CLIENT_CONFIG_LOCATION));
+
+ setProperty(CONFIG_LOCATION);
+ setProperty(INSTANCE_NAME);
+ setProperty(USE_CLIENT);
+ setProperty(CLIENT_CONFIG_LOCATION);
hazelcastInstance = getInstance(properties);
}
+ private void setProperty(String propertyName) {
+ String value = getParam(propertyName);
+
+ if(value != null) {
+ properties.setProperty(propertyName, value);
+ }
+ }
+
private void removeSessionLocally(String sessionId) {
HazelcastHttpSession hazelSession = mapSessions.remove(sessionId);
if (hazelSession != null) {

0 comments on commit 38230bc

Please sign in to comment.