Skip to content

Commit 999aedb

Browse files
BalusCjasondlee
authored andcommittedMay 18, 2023
1 parent 48c8e4e commit 999aedb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎impl/src/main/java/com/sun/faces/context/ExternalContextImpl.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,16 @@ public class ExternalContextImpl extends ExternalContext {
100100
private boolean distributable;
101101

102102
private enum PREDEFINED_COOKIE_PROPERTIES {
103-
domain, maxAge, path, secure, httpOnly
103+
domain, maxAge, path, secure, httpOnly, attribute;
104+
105+
static PREDEFINED_COOKIE_PROPERTIES of(String key) {
106+
try {
107+
return valueOf(key);
108+
}
109+
catch (IllegalArgumentException ignore) {
110+
return attribute;
111+
}
112+
}
104113
}
105114

106115
static final Class theUnmodifiableMapClass = Collections.unmodifiableMap(new HashMap<>()).getClass();
@@ -762,7 +771,7 @@ public void addResponseCookie(String name, String value, Map<String, Object> pro
762771
if (properties != null && properties.size() != 0) {
763772
for (Map.Entry<String, Object> entry : properties.entrySet()) {
764773
String key = entry.getKey();
765-
PREDEFINED_COOKIE_PROPERTIES p = PREDEFINED_COOKIE_PROPERTIES.valueOf(key);
774+
PREDEFINED_COOKIE_PROPERTIES p = PREDEFINED_COOKIE_PROPERTIES.of(key);
766775
Object v = entry.getValue();
767776
switch (p) {
768777
case domain:

0 commit comments

Comments
 (0)