[Webfunds-commits] java/webfunds/sox MailItem.java Receipt.java SOXException.java

Ian Grigg iang@cypherpunks.ai
Sun, 18 Jun 2000 17:07:27 -0400 (AST)


iang        00/06/18 17:07:27

  Modified:    webfunds/client/sox SOXWallet.java
               webfunds/sox MailItem.java Receipt.java SOXException.java
  Log:
  comments, exceptions.  fixed SOXEx to display ex number.

Revision  Changes    Path
1.121     +12 -3     java/webfunds/client/sox/SOXWallet.java

Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- SOXWallet.java	2000/06/11 22:31:25	1.120
+++ SOXWallet.java	2000/06/18 21:07:26	1.121
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.120 2000/06/11 22:31:25 iang Exp $
+/* $Id: SOXWallet.java,v 1.121 2000/06/18 21:07:26 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -70,6 +70,7 @@
     protected   WalletContext context;
 
 
+    // these should probably be protected
     public void error(String e)
     {
         logmsg("[ " + e + " ]");
@@ -104,6 +105,8 @@
         no_net          = "No Internet detected - check your connectivity.";
 
 
+/////////  Initialisation  //////////////////////////////
+
     // bug gets set directly by WalletManager
     public SOXWallet()                          { super(); debug(fix); }
 
@@ -260,6 +263,10 @@
 
     }
 
+
+
+/////////  Acquire Things  //////////////////////////////
+
     /**
      *  Client Wallet Interface
      */
@@ -1579,10 +1586,12 @@
     }
 
     /**
-     *  Handle this mail that came via another request.
-     *  OTOH, the subaccount does identify the account.
+     *  Handle this mail that came via another request
+     *  or another subaccount.
+     *  The subaccount must identify the account and the SOXServer.
      *  All mail items must come from the same SOXServer,
      *  (but are not necessarily the same subaccount, etc).
+     *  This points to a flaw in the sox object model.
      */
     protected void internalUpdate(SubAccount sub, MailItem[] mails)
     {



1.5       +13 -4     java/webfunds/sox/MailItem.java

Index: MailItem.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/MailItem.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MailItem.java	2000/06/05 00:53:40	1.4
+++ MailItem.java	2000/06/18 21:07:26	1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: MailItem.java,v 1.4 2000/06/05 00:53:40 iang Exp $
+ * $Id: MailItem.java,v 1.5 2000/06/18 21:07:26 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -15,7 +15,7 @@
  *  A Mail item is different from other objects here because
  *  it is first and foremost a byte array, not an object.  This
  *  precedence is imposed due to the need to sign the correct
- *  data so the issuer can remove the mail.
+ *  data so the SOX server can remove the mail.
  */
 public class MailItem
     extends Encodable
@@ -24,7 +24,7 @@
     public int                       version;     // should be zero
 
     /**
-     *  Mail type numbers.
+     *  Mail Type numbers.
      *        0-111          reserved for SOX.
      *        112-127        deliberately unallocated as experimental block.
      *        128-143        Systemics application stuff.
@@ -32,22 +32,31 @@
      */
     public final static int          RECEIPT         = 1;
 
+    /**
+     *  SOX 2 is delivering receipts to WebFunds as themselves,
+     *  not wrapped up in MailItems.  We need to finesse such
+     *  byte arrays into MailItems for a changeover period.
+     */
     /*package*/ final static int RECEIPT_OLD_VERSION = 2; // as first byte
 
     // No, I won't recover the object for you.  I'm just the mailman.
     public boolean isReceipt()       { return type == RECEIPT ; }
 
     /**
-     * The mail packet as it is passed over the net, and signed for.
+     *  The mail packet as it is passed over the net, and signed for.
      */
     protected byte[] buf;
     public int hashCode() { return buf.hashCode(); }
 
+    /**
+     *  The mail item consists of a version, a type and a message.
+     */
     protected byte[] msg;
     protected int    type;
 
     /** the full Mail with headers is the signed component */
     public byte[] getMail()    { return buf; }
+    /** the Message component is to be recovered according to Type */
     public byte[] getMessage() { return msg; }
     public int    getType()    { return type; }
     public MailId getMailId()  { return MailId.newInstance(buf); }



1.38      +7 -3      java/webfunds/sox/Receipt.java

Index: Receipt.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Receipt.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- Receipt.java	2000/05/28 02:59:56	1.37
+++ Receipt.java	2000/06/18 21:07:26	1.38
@@ -1,5 +1,5 @@
 /*
- * $Id: Receipt.java,v 1.37 2000/05/28 02:59:56 iang Exp $
+ * $Id: Receipt.java,v 1.38 2000/06/18 21:07:26 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -288,9 +288,13 @@
      * @param is the previously encoded receipt inputstream
      */
     public Receipt(InputStream is)
-        throws IOException, SOXPacketException
+        throws SOXPacketException
     {
-        decode(is);
+        try {
+            decode(is);
+        } catch (IOException ex) {
+            throw new SOXPacketException("IOEx: " + ex);
+        }
     }
 
     /**



1.3       +5 -3      java/webfunds/sox/SOXException.java

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