WW-4715 Uses isDefined function instead of null-checking

This commit is contained in:
Lukasz Lenart
2016-11-16 07:21:38 +01:00
parent ef2939ffd0
commit a245226b7f
2 changed files with 5 additions and 4 deletions
@@ -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;
}