You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2007/01/18 04:13:28 UTC
svn commit: r497293 [1/3] - in /struts/struts2/trunk/core: ./
src/main/java/org/apache/struts2/components/
src/main/java/org/apache/struts2/portlet/dispatcher/
src/main/java/org/apache/struts2/portlet/result/
src/main/java/org/apache/struts2/portlet/ut...
Author: mrdon
Date: Wed Jan 17 19:13:27 2007
New Revision: 497293
URL: http://svn.apache.org/viewvc?view=rev&rev=497293
Log:
Removed unnecessary Commons Lang usage in portlet classes
WW-1652
Modified:
struts/struts2/trunk/core/pom.xml
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java
struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld
struts/struts2/trunk/core/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
Modified: struts/struts2/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/pom.xml?view=diff&rev=497293&r1=497292&r2=497293
==============================================================================
--- struts/struts2/trunk/core/pom.xml (original)
+++ struts/struts2/trunk/core/pom.xml Wed Jan 17 19:13:27 2007
@@ -293,13 +293,6 @@
<version>1.0.4</version>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.0</version>
- <optional>true</optional>
- </dependency>
-
<!-- Ajax -->
<dependency>
<groupId>uk.ltd.getahead</groupId>
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java?view=diff&rev=497293&r1=497292&r2=497293
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java Wed Jan 17 19:13:27 2007
@@ -29,7 +29,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.lang.StringUtils;
import org.apache.struts.annotations.StrutsTag;
import org.apache.struts.annotations.StrutsTagAttribute;
import org.apache.struts2.StrutsConstants;
@@ -50,6 +49,7 @@
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil;
import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.TextUtils;
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory;
import com.opensymphony.xwork2.validator.FieldValidator;
import com.opensymphony.xwork2.validator.ValidationInterceptor;
@@ -370,7 +370,7 @@
}
String type = "action";
- if (StringUtils.isNotEmpty(method)) {
+ if (TextUtils.stringSet(method)) {
if ("GET".equalsIgnoreCase(method.trim())) {
type = "render";
}
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java?view=diff&rev=497293&r1=497292&r2=497293
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java Wed Jan 17 19:13:27 2007
@@ -37,7 +37,6 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.StrutsConstants;
@@ -55,16 +54,15 @@
import org.apache.struts2.portlet.context.ServletContextHolderListener;
import org.apache.struts2.util.AttributeMap;
-import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.FileManager;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionProxyFactory;
-import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.TextUtils;
/**
* <!-- START SNIPPET: javadoc -->
@@ -211,7 +209,7 @@
"defaultPreviewAction");
parseModeConfig(cfg, new PortletMode("edit_defaults"),
"editDefaultsNamespace", "defaultEditDefaultsAction");
- if (StringUtils.isEmpty(portletNamespace)) {
+ if (!TextUtils.stringSet(portletNamespace)) {
portletNamespace = "";
}
LocalizedTextUtil
@@ -237,20 +235,20 @@
PortletMode portletMode, String nameSpaceParam,
String defaultActionParam) {
String namespace = portletConfig.getInitParameter(nameSpaceParam);
- if (StringUtils.isEmpty(namespace)) {
+ if (!TextUtils.stringSet(namespace)) {
namespace = "";
}
modeMap.put(portletMode, namespace);
String defaultAction = portletConfig
.getInitParameter(defaultActionParam);
- if (StringUtils.isEmpty(defaultAction)) {
+ if (!TextUtils.stringSet(defaultAction)) {
defaultAction = DEFAULT_ACTION_NAME;
}
StringBuffer fullPath = new StringBuffer();
- if (StringUtils.isNotEmpty(portletNamespace)) {
+ if (TextUtils.stringSet(portletNamespace)) {
fullPath.append(portletNamespace + "/");
}
- if (StringUtils.isNotEmpty(namespace)) {
+ if (TextUtils.stringSet(namespace)) {
fullPath.append(namespace + "/");
}
fullPath.append(defaultAction);
@@ -404,7 +402,7 @@
request.setAttribute("struts.valueStack", proxy.getInvocation()
.getStack());
if (PortletActionConstants.RENDER_PHASE.equals(phase)
- && StringUtils.isNotEmpty(request
+ && TextUtils.stringSet(request
.getParameter(EVENT_ACTION))) {
ActionProxy action = (ActionProxy) request.getPortletSession()
@@ -461,7 +459,7 @@
mapping = (ActionMapping) actionMap.get(request.getPortletMode());
} else {
String actionPath = request.getParameter(ACTION_PARAM);
- if (StringUtils.isEmpty(actionPath)) {
+ if (!TextUtils.stringSet(actionPath)) {
mapping = (ActionMapping) actionMap.get(request
.getPortletMode());
} else {
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java?view=diff&rev=497293&r1=497292&r2=497293
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java Wed Jan 17 19:13:27 2007
@@ -34,7 +34,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;
@@ -43,6 +42,7 @@
import org.apache.struts2.portlet.context.PortletActionContext;
import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.util.TextUtils;
/**
* Result type that includes a JSP to render.
@@ -174,7 +174,7 @@
LOG.debug("RenderRequest: " + req);
LOG.debug("RenderResponse: " + res);
res.setContentType(contentType);
- if (StringUtils.isNotEmpty(title)) {
+ if (TextUtils.stringSet(title)) {
res.setTitle(title);
}
LOG.debug("Location: " + finalLocation);
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java?view=diff&rev=497293&r1=497292&r2=497293
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java Wed Jan 17 19:13:27 2007
@@ -34,12 +34,12 @@
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.StrutsException;
import org.apache.struts2.portlet.PortletActionConstants;
import org.apache.struts2.portlet.context.PortletActionContext;
+import com.opensymphony.xwork2.util.TextUtils;
/**
* Helper class for creating Portlet URLs. Portlet URLs are fundamentally different from regular
@@ -84,7 +84,7 @@
LOG.debug("Creating url. Action = " + action + ", Namespace = "
+ namespace + ", Type = " + type);
namespace = prependNamespace(namespace, portletMode);
- if(StringUtils.isEmpty(portletMode)) {
+ if (!TextUtils.stringSet(portletMode)) {
portletMode = PortletActionContext.getRenderRequest().getPortletMode().toString();
}
String result = null;
@@ -101,7 +101,7 @@
params.put(key, new String[] { val });
}
}
- if (StringUtils.isNotEmpty(namespace)) {
+ if (TextUtils.stringSet(namespace)) {
StringBuffer sb = new StringBuffer();
sb.append(namespace);
if(!action.startsWith("/") && !namespace.endsWith("/")) {
@@ -140,7 +140,7 @@
result = url.toString();
// TEMP BUG-WORKAROUND FOR DOUBLE ESCAPING OF AMPERSAND
if(result.indexOf("&") >= 0) {
- result = StringUtils.replace(result, "&", "&");
+ result = result.replace("&", "&");
}
return result;
@@ -158,22 +158,22 @@
private static String prependNamespace(String namespace, String portletMode) {
StringBuffer sb = new StringBuffer();
PortletMode mode = PortletActionContext.getRenderRequest().getPortletMode();
- if(StringUtils.isNotEmpty(portletMode)) {
+ if(TextUtils.stringSet(portletMode)) {
mode = new PortletMode(portletMode);
}
String portletNamespace = PortletActionContext.getPortletNamespace();
String modeNamespace = (String)PortletActionContext.getModeNamespaceMap().get(mode);
LOG.debug("PortletNamespace: " + portletNamespace + ", modeNamespace: " + modeNamespace);
- if(StringUtils.isNotEmpty(portletNamespace)) {
+ if(TextUtils.stringSet(portletNamespace)) {
sb.append(portletNamespace);
}
- if(StringUtils.isNotEmpty(modeNamespace)) {
+ if(TextUtils.stringSet(modeNamespace)) {
if(!modeNamespace.startsWith("/")) {
sb.append("/");
}
sb.append(modeNamespace);
}
- if(StringUtils.isNotEmpty(namespace)) {
+ if(TextUtils.stringSet(namespace)) {
if(!namespace.startsWith("/")) {
sb.append("/");
}
@@ -256,7 +256,7 @@
private static WindowState getWindowState(RenderRequest portletReq,
String windowState) {
WindowState state = portletReq.getWindowState();
- if (StringUtils.isNotEmpty(windowState)) {
+ if (TextUtils.stringSet(windowState)) {
state = portletReq.getWindowState();
if ("maximized".equalsIgnoreCase(windowState)) {
state = WindowState.MAXIMIZED;
@@ -284,7 +284,7 @@
String portletMode) {
PortletMode mode = portletReq.getPortletMode();
- if (StringUtils.isNotEmpty(portletMode)) {
+ if (TextUtils.stringSet(portletMode)) {
mode = portletReq.getPortletMode();
if ("edit".equalsIgnoreCase(portletMode)) {
mode = PortletMode.EDIT;