Commits

Anonymous committed 7b65c68

Make Jalopy happy.

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@464573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (4)

src/java/com/opensymphony/webwork/dispatcher/multipart/MultiPartRequestWrapper.java

 package com.opensymphony.webwork.dispatcher.multipart;
 
 import com.opensymphony.webwork.config.Configuration;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
 import java.io.File;
 import java.io.IOException;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+
 import java.util.*;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
 
 /**
  * Parses a multipart request and provides a wrapper around the request. The parsing implementation used
                 }
 
                 // get the constructor
-                Constructor ctor = clazz.getDeclaredConstructor(new Class[]{
-                    Class.forName("javax.servlet.http.HttpServletRequest"),
-                    java.lang.String.class, int.class
-                });
+                Constructor ctor = clazz.getDeclaredConstructor(new Class[] {
+                        Class.forName("javax.servlet.http.HttpServletRequest"),
+                        java.lang.String.class, int.class
+                    });
 
                 // build the parameter list
-                Object[] parms = new Object[]{
+                Object[] parms = new Object[] {
                     request, saveDir, new Integer(maxSize)
                 };
 

src/java/com/opensymphony/webwork/interceptor/ExecuteAndWaitInterceptor.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
 package com.opensymphony.webwork.interceptor;
 
 import com.opensymphony.xwork.Action;
 import com.opensymphony.xwork.interceptor.Interceptor;
 
 import java.io.Serializable;
+
 import java.util.Map;
 
+
 /**
  * Executes an action in a background thread and then returns
  * to the "wait" result. On the next request, if the action
  * @author <a href="plightbo@yahoo.com">Pat Lightbody</a>
  */
 public class ExecuteAndWaitInterceptor implements Interceptor {
+    //~ Static fields/initializers /////////////////////////////////////////////
+
     public static final String KEY = "__execWait";
 
+    //~ Methods ////////////////////////////////////////////////////////////////
+
     public void destroy() {
     }
 
     public String intercept(ActionInvocation actionInvocation) throws Exception {
         String name = actionInvocation.getProxy().getActionName();
         Map session = actionInvocation.getInvocationContext().getSession();
+
         synchronized (session) {
             BackgroundProcess bp = (BackgroundProcess) session.get(KEY + name);
+
             if (bp == null) {
                 bp = new BackgroundProcess(actionInvocation);
                 session.put(KEY + name, bp);
             } else {
                 session.remove(KEY + name);
                 actionInvocation.getStack().push(bp.action);
+
                 return bp.result;
             }
         }
     }
 
+    //~ Inner Classes //////////////////////////////////////////////////////////
+
     class BackgroundProcess implements Serializable {
-        ActionInvocation invocation;
         Action action;
+        ActionInvocation invocation;
         String result;
         boolean done;
 
         public BackgroundProcess(final ActionInvocation invocation) {
             this.invocation = invocation;
             this.action = invocation.getAction();
+
             Thread t = new Thread(new Runnable() {
-                public void run() {
-                    try {
-                        result = action.execute();
-                    } catch (Exception e) {
-                        e.printStackTrace();
+                    public void run() {
+                        try {
+                            result = action.execute();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
+                        done = true;
                     }
-                    done = true;
-                }
-            });
+                });
             t.start();
         }
     }

src/java/com/opensymphony/webwork/interceptor/FileUploadInterceptor.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
 package com.opensymphony.webwork.interceptor;
 
 import com.opensymphony.webwork.ServletActionContext;
 import com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper;
+
 import com.opensymphony.xwork.Action;
 import com.opensymphony.xwork.ActionInvocation;
 import com.opensymphony.xwork.ValidationAware;
 import com.opensymphony.xwork.interceptor.Interceptor;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.io.File;
+
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Iterator;
 
+
 /**
  * Interceptor that is based off of {@link MultiPartRequestWrapper}. It adds the following
  * parameters, where [File Name] is the name given to the file uploaded by the HTML form:
  * of the three patterns above, such as setDocument(File document), setDocumentContentType(String contentType), etc.
  */
 public class FileUploadInterceptor implements Interceptor {
+    //~ Static fields/initializers /////////////////////////////////////////////
+
     protected static final Log log = LogFactory.getLog(FileUploadInterceptor.class);
 
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    protected Long maximumSize;
     protected String allowedTypes;
     protected String disallowedTypes;
-    protected Long maximumSize;
 
-    public void init() {
-    }
-
-    public void destroy() {
-    }
+    //~ Methods ////////////////////////////////////////////////////////////////
 
     public void setAllowedTypes(String allowedTypes) {
         this.allowedTypes = allowedTypes;
         this.maximumSize = maximumSize;
     }
 
+    public void destroy() {
+    }
+
+    public void init() {
+    }
+
     public String intercept(ActionInvocation invocation) throws Exception {
         if (!(ServletActionContext.getRequest() instanceof MultiPartRequestWrapper)) {
             if (log.isDebugEnabled()) {
 
         ValidationAware validation = null;
         Action action = invocation.getAction();
+
         if (action instanceof ValidationAware) {
             validation = (ValidationAware) action;
         }
 
         MultiPartRequestWrapper multiWrapper = (MultiPartRequestWrapper) ServletActionContext.getRequest();
+
         if (multiWrapper.hasErrors()) {
             Collection errors = multiWrapper.getErrors();
             Iterator i = errors.iterator();
+
             while (i.hasNext()) {
                 String error = (String) i.next();
 
         while (e.hasMoreElements()) {
             // get the value of this input tag
             String inputName = (String) e.nextElement();
+
             // get the content type
             String contentType = multiWrapper.getContentType(inputName);
+
             // get the name of the file from the input tag
             String fileName = multiWrapper.getFilesystemName(inputName);
+
             // Get a File object for the uploaded File
             File file = multiWrapper.getFile(inputName);
 
 
         // cleanup
         e = multiWrapper.getFileNames();
+
         while (e.hasMoreElements()) {
             String inputValue = (String) e.nextElement();
             File file = multiWrapper.getFile(inputValue);
             log.info("removing file " + inputValue + " " + file);
-            if (file != null && file.isFile()) file.delete();
+
+            if ((file != null) && file.isFile()) {
+                file.delete();
+            }
         }
 
         return result;

src/java/com/opensymphony/webwork/views/jsp/URLTag.java

 package com.opensymphony.webwork.views.jsp;
 
 import com.opensymphony.webwork.views.util.UrlHelper;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.io.IOException;
+
+import java.util.HashMap;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpUtils;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.PageContext;
-import java.io.IOException;
-import java.util.HashMap;
 
 
 /**