Skip to content

Commit

Permalink
Merge pull request caelum#1102 from cristianoperez/remove-unnecessary…
Browse files Browse the repository at this point in the history
…-session-creation

Remove unnecessary session creation
  • Loading branch information
Turini authored Oct 17, 2017
2 parents dcbe485 + 77a261c commit 7bce8e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class JstlLocalization {

private final HttpServletRequest request;

/**
/**
* @deprecated CDI eyes only
*/
protected JstlLocalization() {
Expand Down Expand Up @@ -119,7 +119,7 @@ private Object findByKey(String key) {
return value;
}

value = Config.get(request.getSession(), key);
value = Config.get(request.getSession(createNewSession()), key);
if (value != null) {
return value;
}
Expand All @@ -131,4 +131,8 @@ private Object findByKey(String key) {

return request.getServletContext().getInitParameter(key);
}

protected boolean createNewSession(){
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

/**
* Test class for {@link JstlLocalization}.
*
*
* @author Otávio Scherer Garcia
*/
public class JstlLocalizationTest {
Expand Down Expand Up @@ -70,7 +70,7 @@ protected Object[][] getContents() {
LocalizationContext context = new LocalizationContext(bundle);
when(request.getAttribute(FMT_LOCALIZATION_CONTEXT + ".request")).thenReturn(context);

when(request.getSession()).thenReturn(session);
when(request.getSession(false)).thenReturn(session);
when(request.getServletContext()).thenReturn(servletContext);
}

Expand Down

0 comments on commit 7bce8e6

Please sign in to comment.