Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions impl/src/main/java/com/sun/faces/context/flash/ELFlash.java
Original file line number Diff line number Diff line change
Expand Up @@ -1379,17 +1379,17 @@ void decode(FacesContext context, ELFlash flash, Cookie cookie) throws InvalidKe
String temp;
String value;

String urlDecodedValue = null;
String urlDecodedValue;

try {
urlDecodedValue = URLDecoder.decode(cookie.getValue(), "UTF-8");
} catch (UnsupportedEncodingException uee) {
urlDecodedValue = cookie.getValue();
}

value = guard.decrypt(urlDecodedValue);

try {
value = guard.decrypt(urlDecodedValue);

int i = value.indexOf("_");

// IMPORTANT: what was "next" when the cookie was
Expand Down Expand Up @@ -1442,15 +1442,16 @@ void decode(FacesContext context, ELFlash flash, Cookie cookie) throws InvalidKe
}
nextRequestFlashInfo.setFlashMap(flashMap);
}
} catch(InvalidKeyException e) {
throw e;
} catch (Throwable t) {
context.getAttributes().put(CONSTANTS.ForceSetMaxAgeZero, Boolean.TRUE);
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.log(Level.SEVERE,
"jsf.externalcontext.flash.bad.cookie",
new Object [] { value });
new Object [] { urlDecodedValue });
}
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public String encrypt(String value) {

public String decrypt(String value) throws InvalidKeyException {

byte[] bytes = DatatypeConverter.parseBase64Binary(value);;
byte[] bytes = DatatypeConverter.parseBase64Binary(value);

try {
byte[] iv = new byte[16];
Expand Down Expand Up @@ -214,4 +214,4 @@ private static byte[] concatBytes(byte[] array1, byte[] array2) {
return cBytes;
}

}
}