Skip to content

Commit

Permalink
KristianRosenvold: Fixed some nasty string/integer boxing/unboxing pr…
Browse files Browse the repository at this point in the history
…oblem

r16447
  • Loading branch information
krosenvold committed Apr 4, 2012
1 parent 329238e commit 9283ede
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,11 @@ public int getCleanupCycle() {
}

public int getTimeout() {
final Integer timeout = get(CLIENT_TIMEOUT);
return timeout != null ? timeout : 0;
return getIntWith0Default(CLIENT_TIMEOUT);
}

public int getBrowserTimeout() {
final Integer timeout =get(BROWSER_TIMEOUT);
return timeout != null ? timeout : 0;
return getIntWith0Default(BROWSER_TIMEOUT);
}

public void setBrowserTimeout(int browserTimeout) {
Expand Down Expand Up @@ -412,6 +410,15 @@ private <T> T get(JsonKey jsonKey) {
return (T) allParams.get(jsonKey.getKey());
}

private Integer getIntWith0Default(JsonKey jsonKey) {
//noinspection unchecked
final Object o = allParams.get(jsonKey.getKey());
if (o instanceof String){
return Integer.parseInt((String) o);
}
return o != null ? (Integer) o : 0;
}

public void setNewSessionWaitTimeout(int newSessionWaitTimeout) {
this.newSessionWaitTimeout = newSessionWaitTimeout;
}
Expand Down

0 comments on commit 9283ede

Please sign in to comment.