View Javadoc
1   //
2   // $Id: JUploadExceptionTooBigFile.java 918 2010-01-08 22:21:44Z etienne_sf $
3   //
4   // jupload - A file upload applet.
5   // Copyright 2007 The JUpload Team
6   //
7   // Created: ?
8   // Creator: William JinHua Kwong
9   // Last modified: $Date: 2010-01-08 23:21:44 +0100 (ven., 08 janv. 2010) $
10  //
11  // This program is free software; you can redistribute it and/or modify it under
12  // the terms of the GNU General Public License as published by the Free Software
13  // Foundation; either version 2 of the License, or (at your option) any later
14  // version. This program is distributed in the hope that it will be useful, but
15  // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17  // details. You should have received a copy of the GNU General Public License
18  // along with this program; if not, write to the Free Software Foundation, Inc.,
19  // 675 Mass Ave, Cambridge, MA 02139, USA.
20  
21  package wjhk.jupload2.exception;
22  
23  import wjhk.jupload2.gui.filepanel.SizeRenderer;
24  import wjhk.jupload2.policies.UploadPolicy;
25  
26  /**
27   * This exception indicates, that the file that is to be uploaded is too big.
28   * Note: the file to upload may be smaller than the file selected by the user.
29   * For instance, a picture may be reduced before upload.
30   */
31  public class JUploadExceptionTooBigFile extends JUploadException {
32  
33      /** A generated serialVersionUID, to avoid warning during compilation */
34      private static final long serialVersionUID = 4842380093113396023L;
35  
36      /**
37       * Creates a new instance.
38       * 
39       * @param filename The filename for the file in error
40       * @param uploadLength The length of this file
41       * @param uploadPolicy The current upload policy.
42       */
43      public JUploadExceptionTooBigFile(String filename, long uploadLength,
44              UploadPolicy uploadPolicy) {
45          super(uploadPolicy.getLocalizedString("errFileTooBig", filename,
46                  SizeRenderer.formatFileSize(uploadLength, uploadPolicy)));
47      }
48  }