You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/12/30 13:11:28 UTC
[1/2] struts git commit: WW-4695 Puts back commons-collections 3.x to
override Velocity's transitive dependency
Repository: struts
Updated Branches:
refs/heads/master f78d90ee2 -> 3ce21403e
WW-4695 Puts back commons-collections 3.x to override Velocity's transitive dependency
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/e38a7136
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e38a7136
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e38a7136
Branch: refs/heads/master
Commit: e38a71365a2224c4753153a9fde3012459c98eb8
Parents: f78d90e
Author: Lukasz Lenart <lu...@apache.org>
Authored: Fri Dec 30 08:06:06 2016 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Fri Dec 30 08:06:06 2016 +0100
----------------------------------------------------------------------
pom.xml | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/e38a7136/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 49bbd80..fbfc1c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -699,6 +699,12 @@
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
+ <!-- it's a dependency of Velocity defined here to override the transitive one -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
[2/2] struts git commit: WW-4102 Reduces LOG visibility
Posted by lu...@apache.org.
WW-4102 Reduces LOG visibility
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3ce21403
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3ce21403
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3ce21403
Branch: refs/heads/master
Commit: 3ce21403ee3df02aba11ae32c5e7ca54875ad220
Parents: e38a713
Author: Lukasz Lenart <lu...@apache.org>
Authored: Fri Dec 30 14:11:16 2016 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Fri Dec 30 14:11:16 2016 +0100
----------------------------------------------------------------------
.../java/com/opensymphony/xwork2/ActionSupport.java | 5 -----
.../interceptor/ExceptionMappingInterceptor.java | 2 +-
.../xwork2/interceptor/MethodFilterInterceptor.java | 5 +++--
.../xwork2/interceptor/TimerInterceptor.java | 3 ++-
.../xwork2/validator/ValidationInterceptor.java | 14 +++++++-------
.../apache/struts2/interceptor/TokenInterceptor.java | 8 +++++---
.../xwork2/interceptor/TimerInterceptorTest.java | 9 ---------
.../struts2/config_browser/ListValidatorsAction.java | 4 +++-
.../apache/struts2/config_browser/ShowJarsAction.java | 7 +++++--
9 files changed, 26 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java
index 76fbcba..d2b551a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java
@@ -19,21 +19,16 @@ import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import java.io.Serializable;
import java.util.*;
-
/**
* Provides a default implementation for the most common actions.
* See the documentation for all the interfaces this class implements for more detailed information.
*/
public class ActionSupport implements Action, Validateable, ValidationAware, TextProvider, LocaleProvider, Serializable {
- protected static Logger LOG = LogManager.getLogger(ActionSupport.class);
-
private final ValidationAwareSupport validationAware = new ValidationAwareSupport();
private transient TextProvider textProvider;
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
index 38700c0..259fa46 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
@@ -153,7 +153,7 @@ import java.util.Map;
*/
public class ExceptionMappingInterceptor extends AbstractInterceptor {
- protected static final Logger LOG = LogManager.getLogger(ExceptionMappingInterceptor.class);
+ private static final Logger LOG = LogManager.getLogger(ExceptionMappingInterceptor.class);
protected Logger categoryLogger;
protected boolean logEnabled = false;
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java
index c23933e..2fec042 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java
@@ -70,7 +70,8 @@ import java.util.Set;
* @see com.opensymphony.xwork2.validator.ValidationInterceptor
*/
public abstract class MethodFilterInterceptor extends AbstractInterceptor {
- protected transient Logger log = LogManager.getLogger(getClass());
+
+ private static final Logger LOG = LogManager.getLogger(MethodFilterInterceptor.class);
protected Set<String> excludeMethods = Collections.emptySet();
protected Set<String> includeMethods = Collections.emptySet();
@@ -104,7 +105,7 @@ public abstract class MethodFilterInterceptor extends AbstractInterceptor {
// ValidationInterceptor
boolean applyMethod = MethodFilterInterceptorUtil.applyMethod(excludeMethods, includeMethods, method);
if (!applyMethod) {
- log.debug("Skipping Interceptor... Method [{}] found in exclude list.", method);
+ LOG.debug("Skipping Interceptor... Method [{}] found in exclude list.", method);
}
return applyMethod;
}
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/main/java/com/opensymphony/xwork2/interceptor/TimerInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/TimerInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/TimerInterceptor.java
index 7cc4918..d2cc534 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/TimerInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/TimerInterceptor.java
@@ -93,7 +93,8 @@ import org.apache.logging.log4j.Logger;
* @author Claus Ibsen
*/
public class TimerInterceptor extends AbstractInterceptor {
- protected static final Logger LOG = LogManager.getLogger(TimerInterceptor.class);
+
+ private static final Logger LOG = LogManager.getLogger(TimerInterceptor.class);
protected Logger categoryLogger;
protected String logCategory;
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java
index 4f34468..169f054 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java
@@ -129,14 +129,14 @@ import org.apache.logging.log4j.Logger;
*/
public class ValidationInterceptor extends MethodFilterInterceptor {
- private boolean validateAnnotatedMethodOnly;
-
- private ActionValidatorManager actionValidatorManager;
-
private static final Logger LOG = LogManager.getLogger(ValidationInterceptor.class);
-
+
private final static String VALIDATE_PREFIX = "validate";
private final static String ALT_VALIDATE_PREFIX = "validateDo";
+
+ private boolean validateAnnotatedMethodOnly;
+
+ private ActionValidatorManager actionValidatorManager;
private boolean alwaysInvokeValidate = true;
private boolean programmatic = true;
@@ -212,8 +212,8 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
String context = this.getValidationContext(proxy);
String method = proxy.getMethod();
- if (log.isDebugEnabled()) {
- log.debug("Validating {}/{} with method {}.", invocation.getProxy().getNamespace(), invocation.getProxy().getActionName(), method);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Validating {}/{} with method {}.", invocation.getProxy().getNamespace(), invocation.getProxy().getActionName(), method);
}
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
index 86a3efd..7307c81 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
@@ -26,6 +26,8 @@ import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.util.TokenHelper;
@@ -116,7 +118,7 @@ import javax.servlet.http.HttpSession;
*/
public class TokenInterceptor extends MethodFilterInterceptor {
- private static final long serialVersionUID = -6680894220590585506L;
+ private static final Logger LOG = LogManager.getLogger(TokenInterceptor.class);
public static final String INVALID_TOKEN_CODE = "invalid.token";
@@ -135,7 +137,7 @@ public class TokenInterceptor extends MethodFilterInterceptor {
*/
@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
- log.debug("Intercepting invocation to check for valid transaction token.");
+ LOG.debug("Intercepting invocation to check for valid transaction token.");
return handleToken(invocation);
}
@@ -165,7 +167,7 @@ public class TokenInterceptor extends MethodFilterInterceptor {
if (action instanceof ValidationAware) {
((ValidationAware) action).addActionError(errorMessage);
} else {
- log.warn(errorMessage);
+ LOG.warn(errorMessage);
}
return INVALID_TOKEN_CODE;
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/core/src/test/java/com/opensymphony/xwork2/interceptor/TimerInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/TimerInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/TimerInterceptorTest.java
index 424d607..290001a 100644
--- a/core/src/test/java/com/opensymphony/xwork2/interceptor/TimerInterceptorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/TimerInterceptorTest.java
@@ -55,21 +55,18 @@ public class TimerInterceptorTest extends XWorkTestCase {
public void testDefault() throws Exception {
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testNoNamespace() throws Exception {
ap.setNamespace(null);
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myAction!execute] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testInputMethod() throws Exception {
ap.setMethod("input");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!input] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testTraceLevel() throws Exception {
@@ -89,35 +86,30 @@ public class TimerInterceptorTest extends XWorkTestCase {
interceptor.setLogLevel("info");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testWarnLevel() throws Exception {
interceptor.setLogLevel("warn");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testErrorLevel() throws Exception {
interceptor.setLogLevel("error");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testFatalLevel() throws Exception {
interceptor.setLogLevel("fatal");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testLogCategory() throws Exception {
interceptor.setLogCategory("com.mycompany.myapp.actiontiming");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertNotSame(interceptor.logger, TimerInterceptor.LOG);
}
public void testLogCategoryLevel() throws Exception {
@@ -125,7 +117,6 @@ public class TimerInterceptorTest extends XWorkTestCase {
interceptor.setLogLevel("error");
interceptor.intercept(mai);
assertTrue(interceptor.message.startsWith("Executed action [myApp/myAction!execute] took "));
- assertNotSame(interceptor.logger, TimerInterceptor.LOG);
assertEquals("com.mycompany.myapp.actiontiming", interceptor.getLogCategory());
}
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java
----------------------------------------------------------------------
diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java
index 355310d..3fbc1c2 100644
--- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java
+++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java
@@ -27,6 +27,8 @@ import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.validator.ActionValidatorManager;
import com.opensymphony.xwork2.validator.Validator;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.util.Collections;
import java.util.List;
@@ -37,7 +39,7 @@ import java.util.List;
*/
public class ListValidatorsAction extends ActionSupport {
- private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LogManager.getLogger(ListValidatorsAction.class);
private String clazz;
private String context;
http://git-wip-us.apache.org/repos/asf/struts/blob/3ce21403/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
----------------------------------------------------------------------
diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
index 4343bf2..9f1aa5a 100644
--- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
+++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
@@ -22,6 +22,8 @@
package org.apache.struts2.config_browser;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.net.URL;
@@ -35,6 +37,8 @@ import java.util.Properties;
*/
public class ShowJarsAction extends ActionNamesAction {
+ private static final Logger LOG = LogManager.getLogger(ShowJarsAction.class);
+
public List<Properties> getJarPoms() {
try {
return configHelper.getJarProperties();
@@ -52,8 +56,7 @@ public class ShowJarsAction extends ActionNamesAction {
try {
return ClassLoaderUtil.getResources("struts-plugin.xml", ShowJarsAction.class, false);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOG.error("Cannot load struts-plugin.xml", e);
}
return null;
}