Skip to content

Commit

Permalink
#4743: Fix deploy fail when com.sun.faces.clientStateTimeout is invalid
Browse files Browse the repository at this point in the history
as well as explicitly disabling com.sun.faces.clientStateTimeout when
resolved value is negative
  • Loading branch information
BalusC committed Feb 20, 2022
1 parent 5c7f0fb commit b9e281c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.sun.faces.config.WebConfiguration.WebContextInitParameter.ClientStateTimeout;
import static com.sun.faces.config.WebConfiguration.WebContextInitParameter.ClientStateWriteBufferSize;
import static com.sun.faces.renderkit.RenderKitUtils.PredefinedPostbackParameter.VIEW_STATE_PARAM;
import static java.util.logging.Level.WARNING;

import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
Expand All @@ -32,6 +33,7 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Base64;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -48,7 +50,6 @@
import com.sun.faces.util.DebugUtil;
import com.sun.faces.util.FacesLogger;
import com.sun.faces.util.Util;
import java.util.Base64;

/**
* <p>
Expand Down Expand Up @@ -462,8 +463,16 @@ protected void init() {
String timeout = webConfig.getOptionValue(ClientStateTimeout);
try {
stateTimeout = Long.parseLong(timeout);

if (stateTimeout < 0) {
stateTimeoutEnabled = false;
}
} catch (NumberFormatException nfe) {
stateTimeout = Long.parseLong(ClientStateTimeout.getDefaultValue());
if (LOGGER.isLoggable(WARNING)) {
LOGGER.log(WARNING, ClientStateTimeout.getQualifiedName() + " context param value of '" + timeout + "' is not parseable as Long, it will be ignored");
}

stateTimeoutEnabled = false;
}
}

Expand Down

0 comments on commit b9e281c

Please sign in to comment.