diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java index 6f0594769b..d3a90d4f25 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java @@ -353,7 +353,7 @@ protected Configuration createConfiguration(ServletContext servletContext) throw } protected Version getFreemarkerVersion(ServletContext servletContext) { - Version incompatibleImprovements = Configuration.VERSION_2_3_28; + Version incompatibleImprovements = Configuration.VERSION_2_3_33; String incompatibleImprovementsParam = servletContext.getInitParameter("freemarker." + Configuration.INCOMPATIBLE_IMPROVEMENTS_KEY_SNAKE_CASE); if (incompatibleImprovementsParam != null) { diff --git a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java index dfacfeea33..680fb115db 100644 --- a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java +++ b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java @@ -387,7 +387,7 @@ public void testNonceOfInvalidSession() { DoubleSelect dblSelect = new DoubleSelect(stack, req, res); dblSelect.evaluateParams(); - assertNull(dblSelect.getParameters().get("nonce")); + assertNull(dblSelect.getAttributes().get("nonce")); } public void testSetNullUiStaticContentPath() { diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java index f582b76e5b..15c0cbcee9 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java @@ -57,7 +57,7 @@ public void testTemplateLoaderBaseOnFile() throws Exception { servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null); String tmpPath = "file://" + FileUtils.getTempDirectoryPath(); - + // when manager.load(servletContext, tmpPath); @@ -70,7 +70,7 @@ public void testIncompatibleImprovementsByOverriding() throws Exception { FreemarkerManager manager = new FreemarkerManager() { @Override protected Version getFreemarkerVersion(ServletContext servletContext) { - return Configuration.VERSION_2_3_0; + return Configuration.VERSION_2_3_33; } }; container.inject(manager); @@ -79,7 +79,7 @@ protected Version getFreemarkerVersion(ServletContext servletContext) { manager.init(servletContext); // then - assertEquals(Configuration.VERSION_2_3_0, manager.config.getIncompatibleImprovements()); + assertEquals(Configuration.VERSION_2_3_33, manager.config.getIncompatibleImprovements()); } public void testIncompatibleImprovementsWithTemplate() throws Exception { @@ -91,18 +91,19 @@ public void testIncompatibleImprovementsWithTemplate() throws Exception { // when Writer out = new StringWriter(); - Map model = new HashMap<>(); + Map model = new HashMap<>(); model.put("error", "It's an error message"); tpl.process(model, out); // then + assertEquals(Configuration.VERSION_2_3_33, configuration.getIncompatibleImprovements()); assertEquals("", out.toString()); } public void testIncompatibleImprovementsByServletContext() throws Exception { // given - servletContext.setInitParameter("freemarker.incompatible_improvements", "2.3.0"); + servletContext.setInitParameter("freemarker.incompatible_improvements", "2.3.32"); FreemarkerManager manager = new FreemarkerManager(); container.inject(manager); @@ -110,7 +111,7 @@ public void testIncompatibleImprovementsByServletContext() throws Exception { manager.init(servletContext); // then - assertEquals(Configuration.VERSION_2_3_0, manager.config.getIncompatibleImprovements()); + assertEquals(Configuration.VERSION_2_3_32, manager.config.getIncompatibleImprovements()); } } @@ -119,5 +120,5 @@ class DummyFreemarkerManager extends FreemarkerManager { public void load(StrutsMockServletContext servletContext, String path) { createTemplateLoader(servletContext, path); } - + }