Details
-
Type: Bug
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 3.3, EE-3.3.0.GA
-
Fix Version/s: EE-3.3.0.GA, 4.0.BETA, 4.0
-
Component/s: Sample Apps
-
Labels:None
-
Environment:Chat sample app
-
Assignee Priority:P3
-
Affects:Sample App./Tutorial
Description
The chat sample supports internationalizing messages but tries to use the FacesContext to determine the Locale during logout:
public static String getLocalizedMessage(String messagePatternKey, String[] messageArgs){
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();
Locale locale = root.getLocale();
String localizedPattern = ResourceUtil.getI18NString(locale,messagePatternKey);
return MessageFormat.format(localizedPattern,(Object[])messageArgs);
}
When a session expires, the container thread does not have a FacesContext leading to the NPE. We need to check for FacesContext in this case and just use the default locale.
public static String getLocalizedMessage(String messagePatternKey, String[] messageArgs){
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();
Locale locale = root.getLocale();
String localizedPattern = ResourceUtil.getI18NString(locale,messagePatternKey);
return MessageFormat.format(localizedPattern,(Object[])messageArgs);
}
When a session expires, the container thread does not have a FacesContext leading to the NPE. We need to check for FacesContext in this case and just use the default locale.
Activity
Deryk Sinotte
created issue -
Deryk Sinotte
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Deryk Sinotte [ deryk.sinotte ] | |
Priority | Major [ 3 ] | Minor [ 4 ] |
Assignee Priority | P3 [ 10012 ] |
Deryk Sinotte
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Affects | Sample App./Tutorial [ 10001 ] | |
Fix Version/s | 3.4 [ 10770 ] | |
Resolution | Fixed [ 1 ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #36296 | Wed Jun 19 11:12:25 MDT 2013 | deryk.sinotte | |
Files Changed | ||||
MODIFY
/icefaces3/trunk/icefaces/samples/core/chat/src/main/java/org/icefaces/sample/portlet/chat/resources/ResourceUtil.java
|
Ken Fyten
made changes -
Fix Version/s | 4.0 [ 11382 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Marking as fixed. Now checking for instance of FacesContext during logout and, if null, use default Locale.