Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WW-5427 Upgrades Freemarker incompatible_improvements to version 2.3.33 #1088

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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 {
Expand All @@ -91,26 +91,27 @@ public void testIncompatibleImprovementsWithTemplate() throws Exception {

// when
Writer out = new StringWriter();
Map<String, String> model = new HashMap<>();
Map<String, String> 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("<input type=\"text\" onclick=\"this.alert('It&#39;s an error message')\"/>", 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);

// when
manager.init(servletContext);

// then
assertEquals(Configuration.VERSION_2_3_0, manager.config.getIncompatibleImprovements());
assertEquals(Configuration.VERSION_2_3_32, manager.config.getIncompatibleImprovements());
}
}

Expand All @@ -119,5 +120,5 @@ class DummyFreemarkerManager extends FreemarkerManager {
public void load(StrutsMockServletContext servletContext, String path) {
createTemplateLoader(servletContext, path);
}

}
Loading