File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
core/src/main/java/org/apache/struts2/interceptor Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 34
34
35
35
import javax .servlet .http .Cookie ;
36
36
import javax .servlet .http .HttpServletResponse ;
37
+ import javax .servlet .http .HttpSession ;
38
+
37
39
import java .util .Locale ;
38
40
import java .util .Map ;
39
41
@@ -296,12 +298,16 @@ public Locale read(ActionInvocation invocation) {
296
298
Map <String , Object > session = invocation .getInvocationContext ().getSession ();
297
299
298
300
if (session != null ) {
299
- String sessionId = ServletActionContext .getRequest ().getSession ().getId ();
300
- synchronized (sessionId .intern ()) {
301
- Object sessionLocale = session .get (attributeName );
302
- if (sessionLocale != null && sessionLocale instanceof Locale ) {
303
- locale = (Locale ) sessionLocale ;
304
- LOG .debug ("Applied session locale: {}" , locale );
301
+ //[WW-4741] Do not force session creation while this is a read operation
302
+ HttpSession httpSession = ServletActionContext .getRequest ().getSession (false );
303
+ if (null != httpSession ) {
304
+ String sessionId = httpSession .getId ();
305
+ synchronized (sessionId .intern ()) {
306
+ Object sessionLocale = session .get (attributeName );
307
+ if (sessionLocale != null && sessionLocale instanceof Locale ) {
308
+ locale = (Locale ) sessionLocale ;
309
+ LOG .debug ("Applied session locale: {}" , locale );
310
+ }
305
311
}
306
312
}
307
313
}
You can’t perform that action at this time.
0 commit comments