Revision: 20057
          http://sourceforge.net/p/gate/code/20057
Author:   markagreenwood
Date:     2017-02-02 09:51:16 +0000 (Thu, 02 Feb 2017)
Log Message:
-----------
added the LuckyException back as removing it would break old versions of 
plugins that used it, but it is now deprecated so could be removed at some 
future date

Added Paths:
-----------
    gate/branches/sawdust2/gate-core/src/main/java/gate/util/LuckyException.java

Added: 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/LuckyException.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/LuckyException.java    
                            (rev 0)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/LuckyException.java    
    2017-02-02 09:51:16 UTC (rev 20057)
@@ -0,0 +1,70 @@
+/*
+ *  LuckyException.java
+ *
+ *  Copyright (c) 1995-2012, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Valentin Tablan 06/2000
+ *
+ *  $Id: LuckyException.java 17600 2014-03-08 18:47:11Z markagreenwood $
+ */
+package gate.util;
+
+/**
+ * This exception is intended to be used in places where there definitely
+ * shouldn't be any exceptions thrown but the API requires us to catch some, 
eg:
+ * <code>
+ * try{
+ *   if( a != null){
+ *     a.doSomething();
+ *   }
+ * }catch(NullPointerException npe){
+ *   throw new LuckyException("I found a null pointer!");
+ * }
+ *</code> Of course the system will never require you to catch
+ * NullPOinterException as it derives from RuntimeException, but I couldn't 
come
+ * with a better example.
+ * 
+ * @deprecated serves no purpose over and above either
+ *             {@link gate.util.GateRuntimeException GateRuntimeException} or
+ *             just plain {@link java.lang.RuntimeException RuntimeException}
+ *             and one of those should be used instead.
+ */
+@Deprecated
+public class LuckyException extends RuntimeException {
+
+       private static final long serialVersionUID = -8051339390451934567L;
+
+       /** Default constructor, creates a new execption with the default 
message */
+       public LuckyException() {
+               super(defaultMessage);
+       }
+
+       /**
+        * Creates a new exception with the provided message prepended to the
+        * default one on a separate line.
+        * 
+        * @param message
+        *            the uses message
+        */
+       public LuckyException(String message) {
+               super(message + "\n" + defaultMessage);
+       }
+
+       public LuckyException(String message, Throwable cause) {
+               super(message + "\n" + defaultMessage, cause);
+       }
+
+       public LuckyException(Throwable cause) {
+               super(defaultMessage, cause);
+       }
+
+       /** The default message carried by this type of exceptions */
+       static String defaultMessage = "Congratulations, you found the ONLY bug 
in GATE!";
+
+}// end class LuckyException

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to