Skip to content

Commit

Permalink
Merge branch 'release/2.3.22'
Browse files Browse the repository at this point in the history
Conflicts:
	apps/blank/pom.xml
	apps/jboss-blank/pom.xml
	apps/mailreader/pom.xml
	apps/pom.xml
	apps/portlet/pom.xml
	apps/rest-showcase/pom.xml
	apps/showcase/pom.xml
	archetypes/pom.xml
	archetypes/struts2-archetype-angularjs/pom.xml
	archetypes/struts2-archetype-blank/pom.xml
	archetypes/struts2-archetype-convention/pom.xml
	archetypes/struts2-archetype-dbportlet/pom.xml
	archetypes/struts2-archetype-plugin/pom.xml
	archetypes/struts2-archetype-portlet/pom.xml
	archetypes/struts2-archetype-starter/pom.xml
	assembly/pom.xml
	bom/pom.xml
	bundles/admin/pom.xml
	bundles/demo/pom.xml
	bundles/pom.xml
	core/pom.xml
	plugins/cdi/pom.xml
	plugins/codebehind/pom.xml
	plugins/config-browser/pom.xml
	plugins/convention/pom.xml
	plugins/dojo/pom.xml
	plugins/dwr/pom.xml
	plugins/embeddedjsp/pom.xml
	plugins/gxp/pom.xml
	plugins/jasperreports/pom.xml
	plugins/java8-support/pom.xml
	plugins/javatemplates/pom.xml
	plugins/jfreechart/pom.xml
	plugins/jsf/pom.xml
	plugins/json/pom.xml
	plugins/junit/pom.xml
	plugins/osgi/pom.xml
	plugins/oval/pom.xml
	plugins/pell-multipart/pom.xml
	plugins/plexus/pom.xml
	plugins/pom.xml
	plugins/portlet-tiles/pom.xml
	plugins/portlet/pom.xml
	plugins/rest/pom.xml
	plugins/sitegraph/pom.xml
	plugins/sitemesh/pom.xml
	plugins/spring/pom.xml
	plugins/struts1/pom.xml
	plugins/testng/pom.xml
	plugins/tiles/pom.xml
	plugins/tiles3/pom.xml
	pom.xml
	xwork-core/pom.xml
  • Loading branch information
lukaszlenart committed Mar 19, 2015
2 parents 438d2ce + 3e23f21 commit aeed126
Show file tree
Hide file tree
Showing 80 changed files with 349 additions and 150 deletions.
2 changes: 1 addition & 1 deletion apps/jboss-blank/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-jboss-blank</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion apps/mailreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-mailreader</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion apps/portlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-portlet</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions apps/rest-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>

Expand Down
2 changes: 1 addition & 1 deletion apps/showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-showcase</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-archetypes</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-angularjs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-blank/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-convention/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-dbportlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-portlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/struts2-archetype-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-assembly</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>

<artifactId>struts2-bom</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Struts 2 Bill of Materials</name>
Expand All @@ -25,7 +25,7 @@
</licenses>

<properties>
<struts-version.version>2.3.21</struts-version.version>
<struts-version.version>2.3.23-SNAPSHOT</struts-version.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion bundles/admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-osgi-admin-bundle</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bundles/demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-osgi-demo-bundle</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>

<artifactId>struts2-osgi-bundles</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.21</version>
<version>2.3.23-SNAPSHOT</version>
</parent>
<artifactId>struts2-core</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/apache/struts2/StrutsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,6 @@ public final class StrutsConstants {
public static final String STRUTS_ADDITIONAL_EXCLUDED_PATTERNS = "struts.additional.excludedPatterns";
public static final String STRUTS_ADDITIONAL_ACCEPTED_PATTERNS = "struts.additional.acceptedPatterns";

public static final String STRUTS_CONTENT_TYPE_MATCHER = "struts.contentTypeMatcher";

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class Component {
*/
protected static ConcurrentMap<Class<?>, Collection<String>> standardAttributesMap = new ConcurrentHashMap<Class<?>, Collection<String>>();

protected boolean devMode = false;
protected ValueStack stack;
protected Map parameters;
protected ActionMapper actionMapper;
Expand Down Expand Up @@ -97,7 +98,12 @@ private String getComponentName() {

return name.substring(dot + 1).toLowerCase();
}


@Inject(value = StrutsConstants.STRUTS_DEVMODE, required = false)
public void setDevMode(String devMode) {
this.devMode = Boolean.parseBoolean(devMode);
}

@Inject
public void setActionMapper(ActionMapper mapper) {
this.actionMapper = mapper;
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/org/apache/struts2/components/Date.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ public boolean end(Writer writer, String body) {
date = (java.util.Date) dateObject;
} else if(dateObject instanceof Calendar){
date = ((Calendar) dateObject).getTime();
} else {
if (devMode) {
LOG.error("Expression [#0] passed to <s:date/> tag which was evaluated to [#1](#2) isn't instance of java.util.Date nor java.util.Calendar!",
name, dateObject, (dateObject != null ? dateObject.getClass() : "null"));
} else {
LOG.debug("Expression [#0] passed to <s:date/> tag which was evaluated to [#1](#2) isn't instance of java.util.Date nor java.util.Calendar!",
name, dateObject, (dateObject != null ? dateObject.getClass() : "null"));
}
}
} catch (Exception e) {
LOG.error("Could not convert object with key '#0' to a java.util.Date instance", name);
Expand Down
6 changes: 0 additions & 6 deletions core/src/main/java/org/apache/struts2/components/Hidden.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,4 @@ protected String getDefaultTemplate() {
return TEMPLATE;
}

@Override
public void evaluateParams() {
super.evaluateParams();
label = null;
addParameter("label", null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.apache.struts2.dispatcher.StaticContentLoader;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.multipart.MultiPartRequest;
import org.apache.struts2.util.ContentTypeMatcher;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.util.UrlHelper;
import org.apache.struts2.views.velocity.VelocityManager;
Expand Down Expand Up @@ -327,6 +328,12 @@
* <td>request</td>
* <td>Used across different interceptors to check if given string matches one of the accepted patterns</td>
* </tr>
* <tr>
* <td>org.apache.struts2.util.ContentTypeMatcher</td>
* <td>struts.contentTypeMatcher</td>
* <td>singleton</td>
* <td>Matches content type of uploaded files (since 2.3.22)</td>
* </tr>
* </table>
*
* <!-- END SNIPPET: extensionPoints -->
Expand Down Expand Up @@ -391,6 +398,7 @@ public void register(ContainerBuilder builder, LocatableProperties props) {
alias(ReflectionProvider.class, StrutsConstants.STRUTS_REFLECTIONPROVIDER, builder, props);
alias(ReflectionContextFactory.class, StrutsConstants.STRUTS_REFLECTIONCONTEXTFACTORY, builder, props);
alias(PatternMatcher.class, StrutsConstants.STRUTS_PATTERNMATCHER, builder, props);
alias(ContentTypeMatcher.class, StrutsConstants.STRUTS_CONTENT_TYPE_MATCHER, builder, props);
alias(StaticContentLoader.class, StrutsConstants.STRUTS_STATIC_CONTENT_LOADER, builder, props);
alias(UnknownHandlerManager.class, StrutsConstants.STRUTS_UNKNOWN_HANDLER_MANAGER, builder, props);
alias(UrlHelper.class, StrutsConstants.STRUTS_URL_HELPER, builder, props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ public HttpServletRequest wrapRequest(HttpServletRequest request) throws IOExcep
if (content_type != null && content_type.contains("multipart/form-data")) {
MultiPartRequest mpr = getMultiPartRequest();
LocaleProvider provider = getContainer().getInstance(LocaleProvider.class);
request = new MultiPartRequestWrapper(mpr, request, getSaveDir(), provider);
request = new MultiPartRequestWrapper(mpr, request, getSaveDir(), provider, disableRequestAttributeValueStackLookup);
} else {
request = new StrutsRequestWrapper(request, disableRequestAttributeValueStackLookup);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,18 @@ public void setMethod(String method) {
}

protected List<String> getProhibitedResultParams() {
return Arrays.asList(DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", "prependServletContext", "suppressEmptyParameters", "anchor");
return Arrays.asList(
DEFAULT_PARAM,
"namespace",
"method",
"encode",
"parse",
"location",
"prependServletContext",
"suppressEmptyParameters",
"anchor",
"statusCode"
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ protected void sendRedirect(HttpServletResponse response, String finalLocation)
*/
protected boolean isPathUrl(String url) {
try {
URI uri = URI.create(url);
String rawUrl = url;
if (url.contains("?")) {
rawUrl = url.substring(0, url.indexOf("?"));
}
URI uri = URI.create(rawUrl.replaceAll(" ", "%20"));
if (uri.isAbsolute()) {
URL validUrl = uri.toURL();
if (LOG.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
/** The default parameter */
public static final String DEFAULT_PARAM = "location";

/** use UTF-8 as this is the recommended encoding by W3C to avoid incompatibilities. */
public static final String DEFAULT_URL_ENCODING = "UTF-8";

private boolean parse;
private boolean encode;
private String location;
Expand Down Expand Up @@ -240,9 +243,7 @@ public Object evaluate(String parsedValue) {
if (encode) {
if (parsedValue != null) {
try {
// use UTF-8 as this is the recommended encoding by W3C to
// avoid incompatibilities.
return URLEncoder.encode(parsedValue, "UTF-8");
return URLEncoder.encode(parsedValue, DEFAULT_URL_ENCODING);
}
catch(UnsupportedEncodingException e) {
if (LOG.isWarnEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void setMaxSize(String maxSize) {
*
* @param bufferSize
*/
@Inject(StrutsConstants.STRUTS_MULTIPART_BUFFERSIZE)
@Inject(value = StrutsConstants.STRUTS_MULTIPART_BUFFERSIZE, required = false)
public void setBufferSize(String bufferSize) {
this.bufferSize = Integer.parseInt(bufferSize);
}
Expand Down Expand Up @@ -357,7 +357,7 @@ private long getRequestSize(HttpServletRequest request) {
private void addFileSkippedError(String fileName, HttpServletRequest request) {
String exceptionMessage = "Skipped file " + fileName + "; request size limit exceeded.";
FileSizeLimitExceededException exception = new FileUploadBase.FileSizeLimitExceededException(exceptionMessage, getRequestSize(request), maxSize);
String message = buildMessage(exception, new Object[]{fileName, getRequestSize(request), maxSize});
String message = buildErrorMessage(exception, new Object[]{fileName, getRequestSize(request), maxSize});
if (!errors.contains(message))
errors.add(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package org.apache.struts2.dispatcher.multipart;

import com.opensymphony.xwork2.DefaultLocaleProvider;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.logging.Logger;
Expand Down Expand Up @@ -71,8 +72,10 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
* @param saveDir Target directory for any files that we save
* @param provider
*/
public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir, LocaleProvider provider) {
super(request);
public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request,
String saveDir, LocaleProvider provider,
boolean disableRequestAttributeValueStackLookup) {
super(request, disableRequestAttributeValueStackLookup);
errors = new ArrayList<String>();
multi = multiPartRequest;
defaultLocale = provider.getLocale();
Expand All @@ -90,6 +93,10 @@ public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletReq
}
}

public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir, LocaleProvider provider) {
this(multiPartRequest, request, saveDir, provider, false);
}

protected void setLocale(HttpServletRequest request) {
if (defaultLocale == null) {
defaultLocale = request.getLocale();
Expand Down
Loading

0 comments on commit aeed126

Please sign in to comment.