Skip to content

Commit 56f0055

Browse files
authored
Merge pull request #5588 from eclipse-ee4j/4.1
4.1
2 parents 32a4682 + 2d6d3f4 commit 56f0055

File tree

3 files changed

+393
-13
lines changed

3 files changed

+393
-13
lines changed

impl/src/main/java/com/sun/faces/context/flash/ELFlash.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
import java.util.logging.Level;
3939
import java.util.logging.Logger;
4040

41-
import com.sun.faces.config.WebConfiguration;
42-
import com.sun.faces.config.WebConfiguration.WebContextInitParameter;
43-
import com.sun.faces.facelets.tag.ui.UIDebug;
44-
import com.sun.faces.util.ByteArrayGuardAESCTR;
45-
import com.sun.faces.util.FacesLogger;
46-
4741
import jakarta.faces.application.FacesMessage;
4842
import jakarta.faces.component.UIViewRoot;
4943
import jakarta.faces.context.ExternalContext;
@@ -57,6 +51,12 @@
5751
import jakarta.servlet.http.Cookie;
5852
import jakarta.servlet.http.HttpServletRequest;
5953

54+
import com.sun.faces.config.WebConfiguration;
55+
import com.sun.faces.config.WebConfiguration.WebContextInitParameter;
56+
import com.sun.faces.facelets.tag.ui.UIDebug;
57+
import com.sun.faces.util.ByteArrayGuardAESCTR;
58+
import com.sun.faces.util.FacesLogger;
59+
6060
/**
6161
* <p>
6262
* How this implementation works
@@ -151,7 +151,7 @@ public class ELFlash extends Flash {
151151
*/
152152
static final String FLASH_NOW_REQUEST_KEY = FLASH_ATTRIBUTE_NAME + "n";
153153

154-
private enum CONSTANTS {
154+
enum CONSTANTS {
155155

156156
/**
157157
* The key in the FacesContext attributes map (hereafter referred to as contextMap) for the request scoped
@@ -200,7 +200,7 @@ private enum CONSTANTS {
200200
}
201201

202202
/** Creates a new instance of ELFlash */
203-
private ELFlash(ExternalContext extContext) {
203+
ELFlash(ExternalContext extContext) {
204204
flashInnerMap = new ConcurrentHashMap<>();
205205
WebConfiguration config = WebConfiguration.getInstance(extContext);
206206
String value;
@@ -680,7 +680,7 @@ boolean isKeepFlagSet(FacesContext context) {
680680
return Boolean.TRUE == context.getAttributes().get(CONSTANTS.KeepFlagAttributeName);
681681
}
682682

683-
private long getNewSequenceNumber() {
683+
long getNewSequenceNumber() {
684684
long result = sequenceNumber.incrementAndGet();
685685

686686
if (0 == result % numberOfFlashesBetweenFlashReapings) {
@@ -1123,7 +1123,7 @@ private PreviousNextFlashInfoManager getCurrentFlashManager(FacesContext context
11231123
* </p>
11241124
*/
11251125

1126-
private static final class PreviousNextFlashInfoManager {
1126+
static final class PreviousNextFlashInfoManager {
11271127

11281128
private FlashInfo previousRequestFlashInfo;
11291129

@@ -1139,7 +1139,7 @@ private PreviousNextFlashInfoManager(ByteArrayGuardAESCTR guard) {
11391139
this.guard = guard;
11401140
}
11411141

1142-
private PreviousNextFlashInfoManager(ByteArrayGuardAESCTR guard, Map<String, Map<String, Object>> innerMap) {
1142+
PreviousNextFlashInfoManager(ByteArrayGuardAESCTR guard, Map<String, Map<String, Object>> innerMap) {
11431143
this.guard = guard;
11441144
this.innerMap = innerMap;
11451145
}
@@ -1315,6 +1315,8 @@ void decode(FacesContext context, ELFlash flash, Cookie cookie) throws InvalidKe
13151315
nextRequestFlashInfo.setFlashMap(flashMap);
13161316
}
13171317
} catch (Throwable t) {
1318+
previousRequestFlashInfo = new FlashInfo();
1319+
previousRequestFlashInfo.setFlashMap(new HashMap<>(1));
13181320
context.getAttributes().put(CONSTANTS.ForceSetMaxAgeZero, Boolean.TRUE);
13191321
if (LOGGER.isLoggable(Level.SEVERE)) {
13201322
LOGGER.log(Level.SEVERE, "faces.externalcontext.flash.bad.cookie", new Object[] { value });
@@ -1390,7 +1392,7 @@ void setIncomingCookieCameFromRedirect(boolean incomingCookieCameFromRedirect) {
13901392
* Encapsulate one of the two maps that back the flash for the current request.
13911393
* </p>
13921394
*/
1393-
private static final class FlashInfo {
1395+
static final class FlashInfo {
13941396

13951397
/**
13961398
* <p>

impl/src/main/resources/com/sun/faces/LogStrings.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ faces.config.legacy.facelet.warning=JSF1029: Application is versioned at 2.0 (e
119119
faces.view.cannot.render.response.committed=JSF1030: Unable to render view ''{0}'' as the response has already been committed.
120120
faces.compcomp.unecessary.targets.attribute=JSF1092: {0} : Unnecessary specification of the ''targets'' attribute for composite attribute ''{1}''. The ''targets'' attribute is only necessary when the composite attribute is named ''action'', ''actionListener'', ''validator'', or ''valueChangeListener''.
121121
faces.compcomp.binding.eval.non.compcomp=JSF1093: {0} : UIComponent returned by expression evaluation is not a valid composite component. Value will be ignored.
122-
faces.externalcontext.flash.bad.cookie=JSF1094: Could not decode flash data from incoming cookie value {0}. Processing will continue, but the flash is unavailable for this request.
122+
faces.externalcontext.flash.bad.cookie=JSF1094: Could not decode flash data from incoming cookie value {0}. Processing will continue, but the flash is unavailable for this request. Most probably server was restarted without session persistence. One solution is to set java:comp/env/faces/FlashSecretKey with a fixed AES256 key.
123123
faces.externalcontext.flash.response.already.committed=JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.
124124
faces.metadata.uiviewroot.unavailable=JSF1096: UIViewRoot unavailable at the time view metadata was being processed. Metadata will be unavailable.
125125
faces.application.resource.invalid_if_modified_since_header=JSF1097: Unable to parse date sent by User Agent for If-Modified-Since header, {0}.

0 commit comments

Comments
 (0)