[Webfunds-commits] java/webfunds/sox SOXAccountException.java SOXAgentConnectException.java SOXAgentException.java SOXAgentReplyException.java SOXAgentURLException.java SOXArgsException.java SOXDepositException.java SOXException.java SOXIssuerException.java SOXKeyException.java SOXLaterException.java SOXPacketException.java SOXSubAccountException.java

Ian Grigg iang@cypherpunks.ai
Sun, 16 Jul 2000 15:23:36 -0400 (AST)


iang        00/07/16 15:23:36

  Modified:    webfunds/sox SOXAccountException.java
                        SOXAgentConnectException.java
                        SOXAgentException.java SOXAgentReplyException.java
                        SOXAgentURLException.java SOXArgsException.java
                        SOXDepositException.java SOXException.java
                        SOXIssuerException.java SOXKeyException.java
                        SOXLaterException.java SOXPacketException.java
                        SOXSubAccountException.java
  Log:
  rationalised all SOXExceptions to include same constructor set and
  unified set of numbers.  Compiles and runs, but not necessarily tied
  in as some numbers had to move.

Revision  Changes    Path
1.3       +4 -10     java/webfunds/sox/SOXAccountException.java

Index: SOXAccountException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXAccountException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SOXAccountException.java	2000/03/19 23:06:19	1.2
+++ SOXAccountException.java	2000/07/16 19:23:35	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXAccountException.java,v 1.2 2000/03/19 23:06:19 iang Exp $
+ * $Id: SOXAccountException.java,v 1.3 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -14,13 +14,7 @@
     extends SOXException
 {
 
-    public SOXAccountException(String msg)
-    {
-        super(1, msg);
-    }
-
-    public SOXAccountException(int num, String msg)
-    {
-        super(num, msg);
-    }
+    public SOXAccountException(String msg)            { super(UNKNOWN, msg); }
+    public SOXAccountException(int errno, String msg) { super(errno, msg); }
+    public SOXAccountException(int errno)             { super(errno, ""); }
 }



1.2       +4 -5      java/webfunds/sox/SOXAgentConnectException.java

Index: SOXAgentConnectException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXAgentConnectException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOXAgentConnectException.java	2000/04/15 19:05:44	1.1
+++ SOXAgentConnectException.java	2000/07/16 19:23:35	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXAgentConnectException.java,v 1.1 2000/04/15 19:05:44 iang Exp $
+ * $Id: SOXAgentConnectException.java,v 1.2 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -16,8 +16,7 @@
     extends SOXAgentException
 {
 
-    public SOXAgentConnectException(String msg)
-    {
-        super(msg);
-    }
+    public SOXAgentConnectException(String m)            { super(UNKNOWN, m); }
+    public SOXAgentConnectException(int errno, String m) { super(errno, m); }
+    public SOXAgentConnectException(int errno)           { super(errno, ""); }
 }



1.2       +4 -5      java/webfunds/sox/SOXAgentException.java

Index: SOXAgentException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXAgentException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOXAgentException.java	1999/10/31 17:27:08	1.1
+++ SOXAgentException.java	2000/07/16 19:23:35	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXAgentException.java,v 1.1 1999/10/31 17:27:08 iang Exp $
+ * $Id: SOXAgentException.java,v 1.2 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -15,8 +15,7 @@
     extends SOXException
 {
 
-    public SOXAgentException(String msg)
-    {
-        super(msg);
-    }
+    public SOXAgentException(String msg)            { super(UNKNOWN, msg); }
+    public SOXAgentException(int errno, String msg) { super(errno, msg); }
+    public SOXAgentException(int errno)             { super(errno, ""); }
 }



1.2       +4 -5      java/webfunds/sox/SOXAgentReplyException.java

Index: SOXAgentReplyException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXAgentReplyException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOXAgentReplyException.java	1999/10/31 17:27:08	1.1
+++ SOXAgentReplyException.java	2000/07/16 19:23:35	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXAgentReplyException.java,v 1.1 1999/10/31 17:27:08 iang Exp $
+ * $Id: SOXAgentReplyException.java,v 1.2 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -15,8 +15,7 @@
     extends SOXAgentException
 {
 
-    public SOXAgentReplyException(String msg)
-    {
-        super(msg);
-    }
+    public SOXAgentReplyException(String m)            { super(UNKNOWN, m); }
+    public SOXAgentReplyException(int errno, String m) { super(errno, m); }
+    public SOXAgentReplyException(int errno)           { super(errno, ""); }
 }



1.2       +4 -5      java/webfunds/sox/SOXAgentURLException.java

Index: SOXAgentURLException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXAgentURLException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOXAgentURLException.java	1999/10/31 17:27:08	1.1
+++ SOXAgentURLException.java	2000/07/16 19:23:35	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXAgentURLException.java,v 1.1 1999/10/31 17:27:08 iang Exp $
+ * $Id: SOXAgentURLException.java,v 1.2 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -15,8 +15,7 @@
     extends SOXAgentException
 {
 
-    public SOXAgentURLException(String msg)
-    {
-        super(msg);
-    }
+    public SOXAgentURLException(String msg)            { super(UNKNOWN, msg); }
+    public SOXAgentURLException(int errno, String msg) { super(errno, msg); }
+    public SOXAgentURLException(int errno)             { super(errno, ""); }
 }



1.2       +4 -13     java/webfunds/sox/SOXArgsException.java

Index: SOXArgsException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXArgsException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOXArgsException.java	2000/07/10 17:37:55	1.1
+++ SOXArgsException.java	2000/07/16 19:23:35	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXArgsException.java,v 1.1 2000/07/10 17:37:55 iang Exp $
+ * $Id: SOXArgsException.java,v 1.2 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) 2000 Systemics Inc on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -12,17 +12,8 @@
 public class SOXArgsException
     extends SOXException
 {
-    /**
-     * Create a new SOXArgsException object
-     * @param msg a short message describing the exception
-     */
-    public SOXArgsException(String msg)
-    {
-        super(1, msg);
-    }
 
-    public SOXArgsException(int num, String msg)
-    {
-        super(num, msg);
-    }
+    public SOXArgsException(String msg)            { super(UNKNOWN, msg); }
+    public SOXArgsException(int errno, String msg) { super(errno, msg); }
+    public SOXArgsException(int errno)             { super(errno, ""); }
 }



1.3       +4 -12     java/webfunds/sox/SOXDepositException.java

Index: SOXDepositException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXDepositException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SOXDepositException.java	2000/03/19 23:06:20	1.2
+++ SOXDepositException.java	2000/07/16 19:23:35	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXDepositException.java,v 1.2 2000/03/19 23:06:20 iang Exp $
+ * $Id: SOXDepositException.java,v 1.3 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -16,16 +16,8 @@
 public class SOXDepositException
     extends SOXException
 {
-    // int      number;
 
-    public SOXDepositException(int num, String msg)
-    {
-        super(num, msg);
-        // number = num;
-    }
-    
-    // public int getNumber()
-    // {
-    //     return number;
-    // }
+    public SOXDepositException(String msg)            { super(UNKNOWN, msg); }
+    public SOXDepositException(int errno, String msg) { super(errno, msg); }
+    public SOXDepositException(int errno)             { super(errno, ""); }
 }



1.4       +43 -1     java/webfunds/sox/SOXException.java

Index: SOXException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SOXException.java	2000/06/18 21:07:26	1.3
+++ SOXException.java	2000/07/16 19:23:35	1.4
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXException.java,v 1.3 2000/06/18 21:07:26 iang Exp $
+ * $Id: SOXException.java,v 1.4 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -16,12 +16,54 @@
     public int    getNumber() { return number; }
     public String toString() { return "(" + number + ") " + super.toString(); }
 
+    /**
+     *  Internal errors detected.
+     *  Positive numbers are reserved for SOX reply errors.
+     */
+    public static final int   UNKNOWN        = -1,
+
+                              FROZEN         = -2, // Sub or Ac is closed
+                              SERVER_DOWN    = -3, // SOX server context broken
+                              NO_SERVER      = -4, // No SOX server context
+                              BAD_PACKET     = -5,
+                              NO_RECEIPT     = -6, // should be in reply
+                              NO_CONTRACT    = -7, // not in store
+
+                              LATER_NET      = -8, // no comms at all
+                              LATER_DOWN     = -9, // comms ok but not to server
+
+                              LAST_ERROR     = -9;
+ 
+    public boolean isFrozen()           { return (number == FROZEN); }
+    public boolean isServerDown()       { return (number == SERVER_DOWN); }
+    public boolean isNoServer()         { return (number == NO_SERVER); }
+    public boolean isBadPacket()        { return (number == BAD_PACKET); }
+    public boolean isNoReceipt()        { return (number == NO_RECEIPT); }
+    public boolean isNoContract()       { return (number == NO_CONTRACT); }
+
+    public boolean isLaterNet()         { return (number == LATER_NET); }
+    public boolean isLaterDown()        { return (number == LATER_DOWN); }
+
+    public boolean isLater()
+    {
+        return (number == Errors.ERROR_LATER) ||
+               isLaterNet() || isLaterDown();
+    }
+
+
+    /**
+     *  getNumber() will return 0
+     */
     public SOXException(String msg)
     {
         super(msg);
 	number = 0;
     }
 
+    /**
+     *  @param num is an error code, undefined here,
+     *  extending classes to define, excepting 0 which means "it wasn't set"
+     */
     public SOXException(int num, String msg)
     {
         super(msg);



1.3       +1 -6      java/webfunds/sox/SOXIssuerException.java

Index: SOXIssuerException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXIssuerException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SOXIssuerException.java	2000/07/14 00:02:31	1.2
+++ SOXIssuerException.java	2000/07/16 19:23:35	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXIssuerException.java,v 1.2 2000/07/14 00:02:31 iang Exp $
+ * $Id: SOXIssuerException.java,v 1.3 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -13,13 +13,8 @@
 public class SOXIssuerException
     extends SOXException
 {
-    public final static int UNKNOWN     = -1,
-			    NO_CONTRACT = -6; // contract points to server
 
-    public boolean isNoContract()  { return number == NO_CONTRACT ; }
-
     public SOXIssuerException(String msg)            { super(UNKNOWN, msg); }
     public SOXIssuerException(int errno, String msg) { super(errno, msg); }
     public SOXIssuerException(int errno)             { super(errno, ""); }
-
 }



1.2       +8 -9      java/webfunds/sox/SOXKeyException.java

Index: SOXKeyException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXKeyException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOXKeyException.java	1999/09/23 23:58:52	1.1
+++ SOXKeyException.java	2000/07/16 19:23:35	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXKeyException.java,v 1.1 1999/09/23 23:58:52 iang Exp $
+ * $Id: SOXKeyException.java,v 1.2 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -9,19 +9,18 @@
 
 /**
  * This exception class is thrown when a badly formatted
- * key is encountered.
+ * local key is encountered.
  * It is generally fatal, as indicates local keys are bad.
- * It should not be thrown with respect to Issuer problems
- * like key request fail.
  *
- *   WAS InvalidKeyException
+ * It should not be thrown with respect to SOX Server problems
+ * like key request fail or bad key returned from SOX Server.
+ *
  */
 public class SOXKeyException
     extends SOXException
 {
 
-    public SOXKeyException(String msg)
-    {
-        super(msg);
-    }
+    public SOXKeyException(String msg)            { super(UNKNOWN, msg); }
+    public SOXKeyException(int errno, String msg) { super(errno, msg); }
+    public SOXKeyException(int errno)             { super(errno, ""); }
 }



1.6       +1 -9      java/webfunds/sox/SOXLaterException.java

Index: SOXLaterException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXLaterException.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SOXLaterException.java	2000/07/14 00:18:37	1.5
+++ SOXLaterException.java	2000/07/16 19:23:35	1.6
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXLaterException.java,v 1.5 2000/07/14 00:18:37 iang Exp $
+ * $Id: SOXLaterException.java,v 1.6 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -13,14 +13,6 @@
 public class SOXLaterException
     extends SOXException
 {
-    public final static int LATER       = Errors.ERROR_LATER,
-                            // my internal WebFunds errors (SOX are +ve)
-			    UNKNOWN     = -1,
-			    NET         = -2,    // your connection to net gone
-			    DOWN        = -3;    // this SOX server down
-
-    public boolean isNet()  { return number == NET ; }
-    public boolean isDown() { return number == DOWN ; }
 
     public SOXLaterException(String msg)            { super(UNKNOWN, msg); }
     public SOXLaterException(int errno, String msg) { super(errno, msg); }



1.3       +4 -13     java/webfunds/sox/SOXPacketException.java

Index: SOXPacketException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXPacketException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SOXPacketException.java	2000/03/19 23:06:20	1.2
+++ SOXPacketException.java	2000/07/16 19:23:35	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXPacketException.java,v 1.2 2000/03/19 23:06:20 iang Exp $
+ * $Id: SOXPacketException.java,v 1.3 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -15,17 +15,8 @@
 public class SOXPacketException
     extends SOXException
 {
-    /**
-     * Create a new SOXPacketException object
-     * @param msg a short message describing the exception
-     */
-    public SOXPacketException(String msg)
-    {
-        super(1, msg);
-    }
 
-    public SOXPacketException(int num, String msg)
-    {
-        super(num, msg);
-    }
+    public SOXPacketException(String msg)            { super(UNKNOWN, msg); }
+    public SOXPacketException(int errno, String msg) { super(errno, msg); }
+    public SOXPacketException(int errno)             { super(errno, ""); }
 }



1.5       +8 -27     java/webfunds/sox/SOXSubAccountException.java

Index: SOXSubAccountException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SOXSubAccountException.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SOXSubAccountException.java	2000/07/14 00:02:31	1.4
+++ SOXSubAccountException.java	2000/07/16 19:23:35	1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: SOXSubAccountException.java,v 1.4 2000/07/14 00:02:31 iang Exp $
+ * $Id: SOXSubAccountException.java,v 1.5 2000/07/16 19:23:35 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -8,35 +8,16 @@
 
 
 /**
- * This exception class is thrown when a sub account encounters an error.
+ *  This exception class is thrown when a sub account encounters
+ *  an unpredicted error.
+ *  This error indicates a bug of some sort, non-bug events should
+ *  cause other exceptions to be thrown?
  */
 public class SOXSubAccountException
     extends SOXException
 {
 
-    /**
-     *  Internal errors detected.
-     *  Positive numbers are unexpected SOX reply errors.
-     */
-    public static final int   FROZEN         = -2,
-                              SERVER_DOWN    = -3,
-                              NO_SERVER      = -4,
-                              BAD_PACKET     = -5,
-                              NO_CONTRACT    = -6;
-
-    public boolean isFrozen()           { return (number == FROZEN); }
-    public boolean isServerDown()       { return (number == SERVER_DOWN); }
-    public boolean isNoServer()         { return (number == NO_SERVER); }
-    public boolean isBadPacket()        { return (number == BAD_PACKET); }
-    public boolean isNoContract()       { return (number == NO_CONTRACT); }
-
-    public SOXSubAccountException(String msg)
-    {
-        super(1, msg);
-    }
-
-    public SOXSubAccountException(int num, String msg)
-    {
-        super(num, msg);
-    }
+    public SOXSubAccountException(String m)            { super(UNKNOWN, m); }
+    public SOXSubAccountException(int errno, String m) { super(errno, m); }
+    public SOXSubAccountException(int errno)           { super(errno, ""); }
 }