Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/util FileUpload.java

Project highlights: Architectural Overview

joist
Discussion topic

Hide all messages in topic

All messages in topic

CVS update: joist/java/org/joist/util FileUpload.java

Author dlr
Full name Daniel Rall
Date 2000-11-13 14:07:22 PST
Message User: dlr
  Date: 00/11/13 14:07:22

  Modified: java/org/joist/util FileUpload.java
  Log:
  Removed tab characters.
  
  Revision Changes Path
  1.9 +59 -59 joist/java/org/joist​/util/FileUpload.jav​a
  
  Index: FileUpload.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/util/FileUploa​d.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FileUpload.java 2000/11/13 22:02:04 1.8
  +++ FileUpload.java 2000/11/13 22:07:21 1.9
  @@ -73,7 +73,7 @@
    * This class is <i>not</i> thread-safe.
    *
    * @author <a href="mailto:dlr@col​lab.net">Daniel L. Rall</a>
  - * @version $Id: FileUpload.java,v 1.8 2000/11/13 22:02:04 dlr Exp $
  + * @version $Id: FileUpload.java,v 1.9 2000/11/13 22:07:21 dlr Exp $
    *
    * Copyright (c) 2000 CollabNet, Inc.
    */
  @@ -113,13 +113,13 @@
        * implement the interface of UnsecureServlet.
        * @param ctx The WebContext used by this request.
        * @param props The misc. information used by this file upload.
  - * @return The name of the template to use.
  + * @return The name of the template to use.
        *
        * @exception HandlerException
        * @exception RedirectException
        */
       public FileUpload (Connection conn, WebContext context, Properties props)
  - throws Exception
  + throws Exception
       {
           this.myProperties = props;
           String contentType = context.getRequest()​.getContentType();
  @@ -173,14 +173,14 @@
        * Performs the desired save activities.
        *
        * @param context The context of user interaction.
  - * @return The multipart request.
  + * @return The multipart request.
        *
        * @exception IOException
        */
       protected MultipartRequest getMultipartRequest (WebContext context)
  - throws IOException
  + throws IOException
       {
  - return new MultipartRequest(con​text.getRequest(), getSaveDirectory());
  + return new MultipartRequest(con​text.getRequest(), getSaveDirectory());
       }
   
       /**
  @@ -193,12 +193,12 @@
        * @exception IOException
        */
       protected MultipartRequest getMultipartRequest (WebContext context,
  - int maxPostSize)
  - throws IOException
  + int maxPostSize)
  + throws IOException
       {
  - return new MultipartRequest(con​text.getRequest(),
  - getSaveDirectory(),
  - maxPostSize);
  + return new MultipartRequest(con​text.getRequest(),
  + getSaveDirectory(),
  + maxPostSize);
       }
   
       /**
  @@ -209,47 +209,47 @@
        * @exception JoistException
        */
       protected void setFilesystemPermissions ()
  - throws JoistException
  + throws JoistException
       {
  - String perms = getFilesystemPermissions();
  + String perms = getFilesystemPermissions();
   
  - String path;
  - StringBuffer cmd = new StringBuffer();
  - int nbrFiles = files.size();
  - for (int i = 0; i < nbrFiles; i++)
  - {
  - // Build the command.
  - path = ((File)files.get(i)).getPath();
  - cmd.append("chmod ").append(perms).append(' ');
  - cmd.append(path);
  + String path;
  + StringBuffer cmd = new StringBuffer();
  + int nbrFiles = files.size();
  + for (int i = 0; i < nbrFiles; i++)
  + {
  + // Build the command.
  + path = ((File)files.get(i)).getPath();
  + cmd.append("chmod ").append(perms).append(' ');
  + cmd.append(path);
   
               if (debug) log.debug("Path to file is '" + path + '\'');
  +
  + // Execute the command.
  + try
  + {
  + Process p = Runtime.getRuntime()​.exec(cmd.toString()​);
  + if (p.waitFor() != 0)
  + {
  + // Command did not execute successfully.
  + throw new JoistException("File​Upload.setFilesystem​" +
  + "Permissions: Could not change " +
  + "permissions for file '" + path +
  + '\'');
  + }
  + }
  + catch (InterruptedException e)
  + {
  + log.exception(e);
  + }
  + catch (IOException e)
  + {
  + log.exception(e);
  + }
   
  - // Execute the command.
  - try
  - {
  - Process p = Runtime.getRuntime()​.exec(cmd.toString()​);
  - if (p.waitFor() != 0)
  - {
  - // Command did not execute successfully.
  - throw new JoistException("File​Upload.setFilesystem​" +
  - "Permissions: Could not change " +
  - "permissions for file '" + path +
  - '\'');
  - }
  - }
  - catch (InterruptedException e)
  - {
  - log.exception(e);
  - }
  - catch (IOException e)
  - {
  - log.exception(e);
  - }
  -
  - // Be ready for the next one!
  - cmd.setLength(0);
  - }
  + // Be ready for the next one!
  + cmd.setLength(0);
  + }
       }
   
       /**
  @@ -259,22 +259,22 @@
        * @param conn The JDBC database connection to use.
        * @param mreq The MultipartRequest to use.
        * @param ctx The WebContext to use.
  - * @return The <code>File</code> objects the uploaded files were
  + * @return The <code>File</code> objects the uploaded files were
        * saved as.
        */
       protected List processUploadedFiles (Connection conn, WebContext ctx,
                                            MultipartRequest mreq)
       {
  - List files = new ArrayList();
  + List files = new ArrayList();
   
  - // Iterate files, adding corresponding File objects for each.
  - Enumeration fileNames = mreq.getFileNames();
  - while (fileNames.hasMoreElements())
  - {
  - files.add(mreq.getFi​le((String)fileNames​.nextElement()));
  - }
  + // Iterate files, adding corresponding File objects for each.
  + Enumeration fileNames = mreq.getFileNames();
  + while (fileNames.hasMoreElements())
  + {
  + files.add(mreq.getFi​le((String)fileNames​.nextElement()));
  + }
   
  - return files;
  + return files;
       }
   
       /**
  @@ -286,8 +286,8 @@
        */
       protected String getSaveDirectory ()
       {
  - String dir = myProperties.getProp​erty("saveDirectory"​);
  - return (dir != null ? dir : System.getProperty("TEMP"));
  + String dir = myProperties.getProp​erty("saveDirectory"​);
  + return (dir != null ? dir : System.getProperty("TEMP"));
       }
   
       /**
  @@ -297,6 +297,6 @@
        */
       protected String getFilesystemPermissions ()
       {
  - return myProperties.getProp​erty("filesystemPerm​issions");
  + return myProperties.getProp​erty("filesystemPerm​issions");
       }
   }
Messages per page: