Author: martinc Date: Fri May 13 23:09:06 2005 New Revision: 170126 URL: http://svn.apache.org/viewcvs?rev=170126&view=rev Log: Fix a bunch more Checkstyle problems.
Modified: struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteCommand.java struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteForwardCommand.java struts/core/trunk/src/share/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java struts/core/trunk/src/share/org/apache/struts/chain/commands/servlet/PopulateActionForm.java struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java struts/core/trunk/src/share/org/apache/struts/chain/contexts/ServletActionContext.java struts/core/trunk/src/share/org/apache/struts/chain/contexts/WebActionContext.java struts/core/trunk/src/share/org/apache/struts/config/ActionConfig.java struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java struts/core/trunk/src/share/org/apache/struts/mock/MockActionServlet.java Modified: struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java (original) +++ struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java Fri May 13 23:09:06 2005 @@ -111,8 +111,11 @@ session.setAttribute(Globals.LOCALE_KEY, locale); - if (null==page) return mapping.findForward("success"); - else return new ActionForward(page); + if (null == page) { + return mapping.findForward("success"); + } else { + return new ActionForward(page); + } } Modified: struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java Fri May 13 23:09:06 2005 @@ -153,7 +153,9 @@ * @param moduleConfig */ protected void initCatalogFactory(ActionServlet servlet, ModuleConfig moduleConfig) { - if (this.catalogFactory != null) return; + if (this.catalogFactory != null) { + return; + } this.catalogFactory = CatalogFactory.getInstance(); } Modified: struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteCommand.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteCommand.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteCommand.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteCommand.java Fri May 13 23:09:06 2005 @@ -112,7 +112,9 @@ */ protected Command getCommand(String commandName, String catalogName) { - if (commandName == null) return null; + if (commandName == null) { + return null; + } Command command = null; Catalog catalog = null; Modified: struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteForwardCommand.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteForwardCommand.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteForwardCommand.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/commands/ExecuteForwardCommand.java Fri May 13 23:09:06 2005 @@ -37,7 +37,9 @@ */ protected Command getCommand(ActionContext context) { ForwardConfig forwardConfig = context.getForwardConfig(); - if (forwardConfig == null) return null; + if (forwardConfig == null) { + return null; + } return getCommand(forwardConfig.getCommand(), forwardConfig.getCatalog()); } Modified: struts/core/trunk/src/share/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java Fri May 13 23:09:06 2005 @@ -36,8 +36,7 @@ */ public class WrappingLookupCommand implements Filter { - public WrappingLookupCommand() - { + public WrappingLookupCommand() { catalogName = null; name = null; nameKey = null; @@ -54,43 +53,35 @@ private static final Log log = LogFactory.getLog(WrappingLookupCommand.class); - public String getCatalogName() - { + public String getCatalogName() { return catalogName; } - public void setCatalogName(String catalogName) - { + public void setCatalogName(String catalogName) { this.catalogName = catalogName; } - public String getName() - { + public String getName() { return name; } - public void setName(String name) - { + public void setName(String name) { this.name = name; } - public String getNameKey() - { + public String getNameKey() { return nameKey; } - public void setNameKey(String nameKey) - { + public void setNameKey(String nameKey) { this.nameKey = nameKey; } - public boolean isOptional() - { + public boolean isOptional() { return optional; } - public void setOptional(boolean optional) - { + public void setOptional(boolean optional) { this.optional = optional; } @@ -103,18 +94,17 @@ } public boolean execute(Context context) - throws Exception - { + throws Exception { log.trace("execute ["+this+"]"); Command command = getCommand(context); - if(command != null) + if(command != null) { return command.execute(getContext(context)); - else - return false; + } else { + return false; + } } - public boolean postprocess(Context context, Exception exception) - { + public boolean postprocess(Context context, Exception exception) { Command command = getCommand(context); if(command != null && (command instanceof Filter)) { try { @@ -135,8 +125,7 @@ return false; } - protected Command getCommand(Context context) - { + protected Command getCommand(Context context) { CatalogFactory catalogFactory = CatalogFactory.getInstance(); String catalogName = getCatalogName(); Catalog catalog = null; @@ -157,20 +146,16 @@ name = (String)context.get(getNameKey()); } - if(name != null) - { + if(name != null) { log.debug("Lookup command " + name + " in catalog " + catalogName); command = catalog.getCommand(name); log.debug("Found command " + command + "; optional: " + isOptional()); - if(command == null && !isOptional()) - { + if(command == null && !isOptional()) { throw new IllegalArgumentException("Cannot find command '" + name + "' in catalog '" + catalogName + "'"); - } else - { + } else { return command; } - } else - { + } else { throw new IllegalArgumentException("No command name"); } } Modified: struts/core/trunk/src/share/org/apache/struts/chain/commands/servlet/PopulateActionForm.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/commands/servlet/PopulateActionForm.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/commands/servlet/PopulateActionForm.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/commands/servlet/PopulateActionForm.java Fri May 13 23:09:06 2005 @@ -45,8 +45,7 @@ protected void populate(ActionContext context, ActionConfig actionConfig, - ActionForm actionForm) throws Exception - { + ActionForm actionForm) throws Exception { ServletActionContext saContext = (ServletActionContext) context; RequestUtils.populate(actionForm, actionConfig.getPrefix(), actionConfig.getSuffix(), saContext.getRequest()); } Modified: struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java Fri May 13 23:09:06 2005 @@ -107,9 +107,15 @@ public abstract Map getSessionScope(); public Map getScope(String scopeName) { - if (REQUEST_SCOPE.equals(scopeName)) return this.getRequestScope(); - if (SESSION_SCOPE.equals(scopeName)) return this.getSessionScope(); - if (APPLICATION_SCOPE.equals(scopeName)) return this.getApplicationScope(); + if (REQUEST_SCOPE.equals(scopeName)) { + return this.getRequestScope(); + } + if (SESSION_SCOPE.equals(scopeName)) { + return this.getSessionScope(); + } + if (APPLICATION_SCOPE.equals(scopeName)) { + return this.getApplicationScope(); + } throw new IllegalArgumentException("Invalid scope: " + scopeName); } Modified: struts/core/trunk/src/share/org/apache/struts/chain/contexts/ServletActionContext.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/ServletActionContext.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/contexts/ServletActionContext.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/ServletActionContext.java Fri May 13 23:09:06 2005 @@ -55,18 +55,15 @@ // ------------------------------- // Servlet specific properties // ------------------------------- - public ServletContext getContext() - { + public ServletContext getContext() { return swcontext().getContext(); } - public HttpServletRequest getRequest() - { + public HttpServletRequest getRequest() { return swcontext().getRequest(); } - public HttpServletResponse getResponse() - { + public HttpServletResponse getResponse() { return swcontext().getResponse(); } @@ -138,7 +135,9 @@ public void addMessages(ActionMessages messages) { - if (messages == null) return; + if (messages == null) { + return; + } ActionMessages requestMessages = getMessages(); if (requestMessages == null) { @@ -151,7 +150,9 @@ public void addErrors(ActionMessages errors) { - if (errors == null) return; + if (errors == null) { + return; + } ActionMessages requestErrors = getErrors(); if (requestErrors == null) { @@ -192,7 +193,4 @@ token.resetToken(getRequest()); } - - - -} \ No newline at end of file +} Modified: struts/core/trunk/src/share/org/apache/struts/chain/contexts/WebActionContext.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/WebActionContext.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/contexts/WebActionContext.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/WebActionContext.java Fri May 13 23:09:06 2005 @@ -42,38 +42,31 @@ super.release(); } - public Map getApplicationScope() - { + public Map getApplicationScope() { return wcontext().getApplicationScope(); } - public Map getHeader() - { + public Map getHeader() { return wcontext().getHeader(); } - public Map getHeaderValues() - { + public Map getHeaderValues() { return wcontext().getHeaderValues(); } - public Map getInitParam() - { + public Map getInitParam() { return wcontext().getInitParam(); } - public Map getParam() - { + public Map getParam() { return wcontext().getParam(); } - public Map getParamValues() - { + public Map getParamValues() { return wcontext().getParamValues(); } - public Map getRequestScope() - { + public Map getRequestScope() { return wcontext().getRequestScope(); } @@ -81,13 +74,11 @@ * <p>Return the map returned by our nested <code>WebContext</code>'s * <code>getParamValues()</code> method. </p> */ - public Map getParameterMap() - { + public Map getParameterMap() { return getParamValues(); } - public Map getSessionScope() - { + public Map getSessionScope() { return wcontext().getSessionScope(); } Modified: struts/core/trunk/src/share/org/apache/struts/config/ActionConfig.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ActionConfig.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/ActionConfig.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/ActionConfig.java Fri May 13 23:09:06 2005 @@ -425,14 +425,16 @@ ArrayList list = new ArrayList(); while (true) { int comma = roles.indexOf(','); - if (comma < 0) + if (comma < 0) { break; + } list.add(roles.substring(0, comma).trim()); roles = roles.substring(comma + 1); } roles = roles.trim(); - if (roles.length() > 0) + if (roles.length() > 0) { list.add(roles); + } roleNames = (String[]) list.toArray(new String[list.size()]); } Modified: struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java Fri May 13 23:09:06 2005 @@ -99,10 +99,11 @@ */ public void setRequest(HttpServletRequest request) { this.request = request; - if (this.request == null) + if (this.request == null) { setSession(null); - else + } else { setSession(this.request.getSession()); + } } /** @@ -172,8 +173,9 @@ public ActionMessages getActionMessages() { - if (this.application == null) + if (this.application == null) { return null; + } return (ActionMessages) this.application.getAttribute(Globals.MESSAGE_KEY); } @@ -290,13 +292,15 @@ // Is there a mapping associated with this request? ActionMapping mapping = getMapping(); - if (mapping == null) + if (mapping == null) { return (null); + } // Is there a form bean associated with this mapping? String attribute = mapping.getAttribute(); - if (attribute == null) + if (attribute == null) { return (null); + } // Look up the existing form bean, if any ActionForm instance = null; @@ -354,16 +358,19 @@ String value = action; int question = action.indexOf("?"); - if (question >= 0) + if (question >= 0) { value = value.substring(0, question); + } int slash = value.lastIndexOf("/"); int period = value.lastIndexOf("."); - if ((period >= 0) && (period > slash)) + if ((period >= 0) && (period > slash)) { value = value.substring(0, period); - if (value.startsWith("/")) + } + if (value.startsWith("/")) { return (value); - else + } else { return ("/" + value); + } } @@ -380,8 +387,9 @@ if (servletMapping != null) { String queryString = null; int question = action.indexOf("?"); - if (question >= 0) + if (question >= 0) { queryString = action.substring(question); + } String actionMapping = getActionMappingName(action); if (servletMapping.startsWith("*.")) { value.append(actionMapping); @@ -390,15 +398,17 @@ value.append(servletMapping.substring(0, servletMapping.length() - 2)); value.append(actionMapping); } - if (queryString != null) + if (queryString != null) { value.append(queryString); + } } // Otherwise, assume extension mapping is in use and extension is // already included in the action property else { - if (!action.startsWith("/")) + if (!action.startsWith("/")) { value.append("/"); + } value.append(action); } @@ -415,15 +425,18 @@ if ((session != null) && (response != null)) { boolean redirect = false; - if (forward != null) + if (forward != null) { redirect = forward.getRedirect(); + } - if (redirect) + if (redirect) { return response.encodeRedirectURL(url); - else + } else { return response.encodeURL(url); - } else + } + } else { return (url); + } } // ------------------------------------------------ Presentation API @@ -435,8 +448,9 @@ // HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - if (request == null) + if (request == null) { return null; + } StringBuffer result = RequestUtils.requestToServerUriStringBuffer(request); return result.toString(); } @@ -446,15 +460,17 @@ */ public String getBaseRef() { - if (request == null) + if (request == null) { return null; + } StringBuffer result = RequestUtils.requestToServerStringBuffer(request); String path = null; - if (forward == null) + if (forward == null) { path = request.getRequestURI(); - else + } else { path = request.getContextPath() + forward.getPath(); + } result.append(path); return result.toString(); @@ -469,8 +485,9 @@ public String getLink(String name) { ActionForward forward = getActionForward(name); - if (forward == null) + if (forward == null) { return null; + } StringBuffer path = new StringBuffer(this.request.getContextPath()); path.append(forward.getPath()); @@ -490,8 +507,9 @@ public String getMessage(String key) { MessageResources resources = getMessageResources(); - if (resources == null) + if (resources == null) { return null; + } return resources.getMessage(RequestUtils.getUserLocale(request, null), key); @@ -507,20 +525,21 @@ MessageResources resources = getMessageResources(); - if (resources == null) + if (resources == null) { return null; + } // Return the requested message - if (args == null) + if (args == null) { return resources.getMessage( RequestUtils.getUserLocale(request, null), key); - else + } else { return resources.getMessage( RequestUtils.getUserLocale(request, null), key, args); - + } } /** Modified: struts/core/trunk/src/share/org/apache/struts/mock/MockActionServlet.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/mock/MockActionServlet.java?rev=170126&r1=170125&r2=170126&view=diff ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/mock/MockActionServlet.java (original) +++ struts/core/trunk/src/share/org/apache/struts/mock/MockActionServlet.java Fri May 13 23:09:06 2005 @@ -44,68 +44,63 @@ * @version $Rev$ $Date$ */ public class MockActionServlet extends ActionServlet { - protected ServletContext servletContext; - protected ServletConfig servletConfig; + protected ServletContext servletContext; + protected ServletConfig servletConfig; /** * Constructor. */ - public MockActionServlet( ServletContext servletContext, ServletConfig servletConfig ) - { - this.servletContext = servletContext; - this.servletConfig = servletConfig; - } + public MockActionServlet(ServletContext servletContext, + ServletConfig servletConfig) { + this.servletContext = servletContext; + this.servletConfig = servletConfig; + } /** * Constructor. */ - public MockActionServlet( ) - { + public MockActionServlet() { ; // do nothing - } + } /** * Set property * @param servletContext */ - public void setServletContext( ServletContext servletContext ) - { - this.servletContext = servletContext; - } + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + } /** * Get property * @return */ - public ServletContext getServletContext( ) - { - return servletContext; - } + public ServletContext getServletContext() { + return servletContext; + } /** * Set property * @param servletConfig */ - public void setServletConfig( ServletConfig servletConfig ) - { - this.servletConfig = servletConfig; - } + public void setServletConfig(ServletConfig servletConfig) { + this.servletConfig = servletConfig; + } /** * Get property * @return */ - public ServletConfig getServletConfig( ) - { - return servletConfig; - } - - /** - * Expose as public so that test classes can exercise things which - * retrieve messages. - */ - public void initInternal() throws ServletException { - super.initInternal(); - } + public ServletConfig getServletConfig() { + return servletConfig; + } + + /** + * Expose as public so that test classes can exercise things which + * retrieve messages. + */ + public void initInternal() throws ServletException { + super.initInternal(); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]