mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
WW-4715 Uses isDefined function instead of null-checking
This commit is contained in:
+4
-3
@@ -27,6 +27,7 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
|
||||
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.Parameter;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
@@ -93,9 +94,9 @@ public class ProfilingActivationInterceptor extends AbstractInterceptor {
|
||||
@Override
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
if (devMode) {
|
||||
Object val = invocation.getInvocationContext().getParameters().get(profilingKey);
|
||||
if (val != null) {
|
||||
String sval = (val instanceof String ? (String)val : ((String[])val)[0]);
|
||||
Parameter val = invocation.getInvocationContext().getParameters().get(profilingKey);
|
||||
if (val.isDefined()) {
|
||||
String sval = val.getValue();
|
||||
boolean enable = BooleanUtils.toBoolean(sval);
|
||||
UtilTimerStack.setActive(enable);
|
||||
invocation.getInvocationContext().getParameters().remove(profilingKey);
|
||||
|
||||
@@ -299,7 +299,7 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
|
||||
}
|
||||
}
|
||||
|
||||
if (ActionContext.getContext().getParameters().get(sessionReset) != null) {
|
||||
if (ActionContext.getContext().getParameters().get(sessionReset).isDefined()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user