View Javadoc
1   //
2   // $Id: JUploadException.java 95 2007-05-02 03:27:05Z
3   // /C=DE/ST=Baden-Wuerttemberg/O=ISDN4Linux/OU=Fritz
4   // Elfert/CN=svn-felfert@isdn4linux.de/emailAddress=fritz@fritz-elfert.de $
5   //
6   // jupload - A file upload applet.
7   // Copyright 2007 The JUpload Team
8   //
9   // Created: 2008-04-09
10  // Creator: etienne_sf
11  // Last modified: $Date: 2008-11-28 11:45:19 +0100 (ven., 28 nov. 2008) $
12  //
13  // This program is free software; you can redistribute it and/or modify it under
14  // the terms of the GNU General Public License as published by the Free Software
15  // Foundation; either version 2 of the License, or (at your option) any later
16  // version. This program is distributed in the hope that it will be useful, but
17  // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19  // details. You should have received a copy of the GNU General Public License
20  // along with this program; if not, write to the Free Software Foundation, Inc.,
21  // 675 Mass Ave, Cambridge, MA 02139, USA.
22  
23  package wjhk.jupload2.exception;
24  
25  import wjhk.jupload2.policies.UploadPolicy;
26  import wjhk.jupload2.upload.DefaultFileUploadThread;
27  
28  /**
29   * This class is thrown in the {@link DefaultFileUploadThread}, when it detects
30   * that the user clicked on the stop button. Using an exception allows to
31   * interrupt the whole process. It's up to each method to close/free any
32   * resource.
33   * 
34   * @author etienne_sf
35   * 
36   */
37  public class JUploadInterrupted extends Exception {
38  
39      /**
40       * A default serial UID.
41       */
42      private static final long serialVersionUID = 1L;
43  
44      /**
45       * The standard constructor for this class.
46       * 
47       * @param detectedInMethod The full name (with class) of the method that
48       *            creates this exception. Used to log all needed information.
49       * @param uploadPolicy The current upload policy, used to log a message.
50       */
51      public JUploadInterrupted(String detectedInMethod, UploadPolicy uploadPolicy) {
52          super("Upload stopped by the user");
53          uploadPolicy.displayInfo(getMessage() + " (interruption detected in: "
54                  + detectedInMethod + ")");
55      }
56  
57  }