Skip to content

Commit 9130e31

Browse files
authored
Merge pull request #1088 from apache/feature/WW-5427-incompatible-improvements
WW-5427 Upgrades Freemarker incompatible_improvements to version 2.3.33
2 parents 3d255ca + c3e0b9c commit 9130e31

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ protected Configuration createConfiguration(ServletContext servletContext) throw
353353
}
354354

355355
protected Version getFreemarkerVersion(ServletContext servletContext) {
356-
Version incompatibleImprovements = Configuration.VERSION_2_3_28;
356+
Version incompatibleImprovements = Configuration.VERSION_2_3_33;
357357

358358
String incompatibleImprovementsParam = servletContext.getInitParameter("freemarker." + Configuration.INCOMPATIBLE_IMPROVEMENTS_KEY_SNAKE_CASE);
359359
if (incompatibleImprovementsParam != null) {

core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testTemplateLoaderBaseOnFile() throws Exception {
5757
servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null);
5858

5959
String tmpPath = "file://" + FileUtils.getTempDirectoryPath();
60-
60+
6161
// when
6262
manager.load(servletContext, tmpPath);
6363

@@ -70,7 +70,7 @@ public void testIncompatibleImprovementsByOverriding() throws Exception {
7070
FreemarkerManager manager = new FreemarkerManager() {
7171
@Override
7272
protected Version getFreemarkerVersion(ServletContext servletContext) {
73-
return Configuration.VERSION_2_3_0;
73+
return Configuration.VERSION_2_3_33;
7474
}
7575
};
7676
container.inject(manager);
@@ -79,7 +79,7 @@ protected Version getFreemarkerVersion(ServletContext servletContext) {
7979
manager.init(servletContext);
8080

8181
// then
82-
assertEquals(Configuration.VERSION_2_3_0, manager.config.getIncompatibleImprovements());
82+
assertEquals(Configuration.VERSION_2_3_33, manager.config.getIncompatibleImprovements());
8383
}
8484

8585
public void testIncompatibleImprovementsWithTemplate() throws Exception {
@@ -91,26 +91,27 @@ public void testIncompatibleImprovementsWithTemplate() throws Exception {
9191

9292
// when
9393
Writer out = new StringWriter();
94-
Map<String, String> model = new HashMap<>();
94+
Map<String, String> model = new HashMap<>();
9595
model.put("error", "It's an error message");
9696

9797
tpl.process(model, out);
9898

9999
// then
100+
assertEquals(Configuration.VERSION_2_3_33, configuration.getIncompatibleImprovements());
100101
assertEquals("<input type=\"text\" onclick=\"this.alert('It&#39;s an error message')\"/>", out.toString());
101102
}
102103

103104
public void testIncompatibleImprovementsByServletContext() throws Exception {
104105
// given
105-
servletContext.setInitParameter("freemarker.incompatible_improvements", "2.3.0");
106+
servletContext.setInitParameter("freemarker.incompatible_improvements", "2.3.32");
106107
FreemarkerManager manager = new FreemarkerManager();
107108
container.inject(manager);
108109

109110
// when
110111
manager.init(servletContext);
111112

112113
// then
113-
assertEquals(Configuration.VERSION_2_3_0, manager.config.getIncompatibleImprovements());
114+
assertEquals(Configuration.VERSION_2_3_32, manager.config.getIncompatibleImprovements());
114115
}
115116
}
116117

@@ -119,5 +120,5 @@ class DummyFreemarkerManager extends FreemarkerManager {
119120
public void load(StrutsMockServletContext servletContext, String path) {
120121
createTemplateLoader(servletContext, path);
121122
}
122-
123+
123124
}

0 commit comments

Comments
 (0)