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-5349 Remove Struts core dependency on OGNL VarRefs #763

Merged
merged 2 commits into from
Oct 13, 2023
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
12 changes: 0 additions & 12 deletions core/src/main/java/org/apache/struts2/components/UIBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,6 @@ public String getTemplateDir() {
result = findString(this.templateDir);
}

// If templateDir is not explicitly given,
// try to find attribute which states the dir set to use
if (StringUtils.isBlank(result)) {
result = stack.findString("#attr.templateDir");
}

// Default template set
if (StringUtils.isBlank(result)) {
result = defaultTemplateDir;
Expand Down Expand Up @@ -634,12 +628,6 @@ public String getTheme() {
}
}

// If theme set is not explicitly given,
// try to find attribute which states the theme set to use
if (StringUtils.isBlank(result)) {
result = stack.findString("#attr.theme");
}

// Default theme set
if (StringUtils.isBlank(result)) {
result = defaultUITheme;
Expand Down
38 changes: 0 additions & 38 deletions core/src/test/java/org/apache/struts2/components/UIBeanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;


import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -144,28 +143,6 @@ public void testGetThemeFromForm() {
assertEquals("foo", txtFld.getTheme());
}

public void testGetThemeFromContext() {
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
Map<String, Object> context = Collections.singletonMap("theme", "bar");
ActionContext.getContext().put("attr", context);

TextField txtFld = new TextField(stack, req, res);
assertEquals("bar", txtFld.getTheme());
}

public void testGetThemeFromContextNonString() {
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
Map<String, Object> context = Collections.singletonMap("theme", 12);
ActionContext.getContext().put("attr", context);

TextField txtFld = new TextField(stack, req, res);
assertEquals("12", txtFld.getTheme());
}

public void testMergeTemplateNullEngineException() {
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
Expand Down Expand Up @@ -221,21 +198,6 @@ public void testGetTemplateDirExplicit() {
assertEquals(explicitTemplateDir, txtFld.getTemplateDir());
}

public void testGetTemplateDirAttr() {
String attrTemplateDir = "attrTemplateDirectory";
String defaultTemplateDir = "defaultTemplateDirectory";
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
Map<String, Object> context = Collections.singletonMap("templateDir", attrTemplateDir);
ActionContext.getContext().put("attr", context);

TextField txtFld = new TextField(stack, req, res);
txtFld.setDefaultTemplateDir(defaultTemplateDir);

assertEquals(attrTemplateDir, txtFld.getTemplateDir());
}

public void testGetTemplateDirDefault() {
String defaultTemplateDir = "defaultTemplateDirectory";
ValueStack stack = ActionContext.getContext().getValueStack();
Expand Down